extern struct HomeBank *GLOBALS;
+/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
+
+
+static void
+da_archive_clean(Archive *item)
+{
+ if(item != NULL)
+ {
+ if(item->memo != NULL)
+ {
+ g_free(item->memo);
+ item->memo = NULL;
+ }
+
+
+
+
+
+ //5.3 added as it was a leak
+ if(item->tags != NULL)
+ {
+ g_free(item->tags);
+ item->tags = NULL;
+ }
+ if(item->splits != NULL)
+ {
+ da_split_destroy(item->splits);
+ item->splits = NULL;
+ item->flags &= ~(OF_SPLIT); //Flag that Splits are cleared
+ }
+ }
+}
+
+
+void da_archive_free(Archive *item)
+{
+ if(rc_unref(item))
+ {
+ da_archive_clean(item);
+ rc_free(item);
+ }
+}
+
+
Archive *da_archive_malloc(void)
{
Archive *item;
}
-void da_archive_free(Archive *item)
-{
- if(rc_unref(item))
- {
- if(item->memo != NULL)
- g_free(item->memo);
- if(item->splits != NULL)
- da_split_destroy(item->splits);
- rc_free(item);
- }
-}
-
-
void da_archive_destroy(GList *list)
{
GList *tmplist = g_list_first(list);
{
Archive *item = tmplist->data;
- max_key = MAX(item->key, max_key);
+ max_key = MAX(item->key, max_key);
tmplist = g_list_next(tmplist);
}
-
+
return max_key;
}
GLOBALS->changes_count++;
}
- //#1340142 check split category
+ //#1340142 check split category
if( item->splits != NULL )
{
nbsplit = da_splits_consistency(item->splits);
GLOBALS->changes_count++;
}
}
-
+
// check payee exists
pay = da_pay_get(item->kpay);
if(pay == NULL)
arc->splits = da_splits_clone(txn->splits);
if( da_splits_length (arc->splits) > 0 )
arc->flags |= OF_SPLIT; //Flag that Splits are active
-
+
return arc;
}
/* get the final post date and free */
nextpostdate = g_date_get_julian(tmpdate);
-
+
return nextpostdate;
}
finalpostdate = postdate;
-
+
tmpdate = g_date_new_julian(finalpostdate);
/* manage weekend exception */
if( arc->weekend > 0 )
}
}
}
-
+
/* get the final post date and free */
finalpostdate = g_date_get_julian(tmpdate);
g_date_free(tmpdate);
-
+
return finalpostdate;
}
if(arc->flags & OF_LIMIT)
nblate = MIN(nblate, arc->limit);
-
+
nblate = MIN(nblate, 11);
*/
-
+
// pre 5.1 way
post_date = g_date_new();
}
arc->daygap = CLAMP(lastday - g_date_get_day(post_date), 0, 3);
-
+
DB( g_print(" daygap is %d\n", arc->daygap) );
}
else
DB( g_print("\n[scheduled] date_get_post_max\n") );
//add until xx of the next month (excluded)
- if(GLOBALS->auto_smode == 0)
+ if(GLOBALS->auto_smode == 0)
{
DB( g_print(" - max is %d of next month\n", GLOBALS->auto_weekday) );
-
+
today = g_date_new_julian(GLOBALS->today);
//we compute user xx weekday of next month
g_date_set_day(maxdate, GLOBALS->auto_weekday);
if(g_date_get_day (today) >= GLOBALS->auto_weekday)
g_date_add_months(maxdate, 1);
-
+
nbdays = g_date_days_between(today, maxdate);
-
+
g_date_free(maxdate);
g_date_free(today);
}
maxpostdate = scheduled_date_get_post_max();
txn = da_transaction_malloc();
-
+
list = g_list_first(GLOBALS->arc_list);
while (list != NULL)
{
while(mydate < maxpostdate)
{
DB( hb_print_date(mydate, arc->memo) );
-
+
da_transaction_init_from_template(txn, arc);
txn->date = scheduled_get_postdate(arc, mydate);
/* todo: ? fill in cheque number */
}
da_transaction_free (txn);
-
+
return count;
}