GSList *gsb_data_mix_get_children ( gint transaction_number, gboolean return_number, gboolean is_transaction ) { if ( is_transaction ) return ( gsb_data_transaction_get_children ( transaction_number, return_number ) ); else return ( gsb_data_scheduled_get_children ( transaction_number, return_number ) ); }
/** * set the next date in the scheduled transaction * if it's above the limit date, that transaction is deleted * if it's a split, the children are updated too * if the scheduled transaction is finished, it's removed from the list and from the scheduled transactions * * \param scheduled_number the scheduled transaction we want to increase * * \return FALSE if the scheduled transaction is finished, TRUE else * */ gboolean gsb_scheduler_increase_scheduled ( gint scheduled_number ) { GDate *new_date; g_return_val_if_fail ( g_date_valid (gsb_data_scheduled_get_date (scheduled_number)), TRUE ); /* increase the date of the scheduled_transaction */ new_date = gsb_scheduler_get_next_date ( scheduled_number, gsb_data_scheduled_get_date (scheduled_number)); /* we continue to work only if new_date is not null (null mean reach the end) */ if (new_date) { /* set the new date */ gsb_data_scheduled_set_date ( scheduled_number, new_date); if ( gsb_data_scheduled_get_split_of_scheduled ( scheduled_number )) { GSList *children_numbers_list; /* if there is some children, set the new date too */ children_numbers_list = gsb_data_scheduled_get_children ( scheduled_number, TRUE ); while ( children_numbers_list ) { gint child_number; child_number = GPOINTER_TO_INT ( children_numbers_list -> data ); gsb_data_scheduled_set_date ( child_number, new_date ); children_numbers_list = children_numbers_list -> next; } g_slist_free (children_numbers_list); } g_date_free (new_date); } else { /* the scheduled transaction is over, we remove it */ /* update the main page */ gsb_main_page_update_finished_scheduled_transactions (scheduled_number); /* remove the scheduled transaction */ /* !! important to remove first from the list... */ gsb_scheduler_list_remove_transaction_from_list ( scheduled_number ); gsb_data_scheduled_remove_scheduled (scheduled_number); return FALSE; } return TRUE; }
/** * get the children of a split scheduled transaction, * make the transactions from them and append them to the transactions list * * * \param scheduled_number the number of the mother scheduled transaction (the split) * \param transaction_number the number of the transaction created from that scheduled (so, the future mother of the children) * * \return FALSE * * */ gboolean gsb_scheduler_execute_children_of_scheduled_transaction ( gint scheduled_number, gint transaction_number ) { GSList *children_numbers_list; children_numbers_list = gsb_data_scheduled_get_children ( scheduled_number, TRUE ); while ( children_numbers_list ) { gint child_number; child_number = GPOINTER_TO_INT ( children_numbers_list -> data ); /* pbiava the 03/16/2009 supprime le crash quand on execute la transaction * a partir du planificateur risque d'effet de bord */ if ( child_number > 0 ) gsb_scheduler_create_transaction_from_scheduled_transaction ( child_number, transaction_number ); children_numbers_list = children_numbers_list -> next; } g_slist_free (children_numbers_list); return FALSE; }