Debug v17

This commit is contained in:
Laurent Destailleur 2022-12-09 16:51:06 +01:00
parent 7510ed68a8
commit 247d950e6a
3 changed files with 26 additions and 21 deletions

View File

@ -274,24 +274,27 @@ function getDefaultDatesForTransfer()
{
global $db, $conf;
$date_start = '';
$date_end = '';
$pastmonth = 0;
$pastmonthyear = 0;
// Period by default on transfer (0: previous month | 1: current month | 2: fiscal year)
$periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER);
if ($periodbydefaultontransfer == 2) {
$sql = "SELECT date_start, date_end FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
if ($periodbydefaultontransfer == 2) { // fiscal year
$sql = "SELECT date_start, date_end FROM ".MAIN_DB_PREFIX."accounting_fiscalyear";
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$date_start = strtotime($fiscalYear->date_start);
$date_end = strtotime($fiscalYear->date_end);
$obj = $db->fetch_object($res);
$date_start = $db->jdate($obj->date_start);
$date_end = $db->jdate($obj->date_end);
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
$year_start = dol_print_date(dol_now(), '%Y');
if ($conf->global->SOCIETE_FISCAL_MONTH_START > dol_print_date(dol_now(), '%m')) {
if ($month_start > dol_print_date(dol_now(), '%m')) {
$year_start = $year_start - 1;
}
$year_end = $year_start + 1;
@ -303,17 +306,17 @@ function getDefaultDatesForTransfer()
$date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$date_end = dol_get_last_day($year_end, $month_end);
}
} elseif ($periodbydefaultontransfer == 1) {
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$pastmonth = strftime("%m", dol_now());
} elseif ($periodbydefaultontransfer == 1) { // current month
$year_current = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$pastmonth = (int) dol_print_date(dol_now('gmt'), '%m', 'gmt');
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
}
} else {
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$pastmonth = strftime("%m", dol_now()) - 1;
} else { // previous month
$year_current = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$pastmonth = (int) dol_print_date(dol_now('gmt'), '%m', 'gmt') - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;

View File

@ -74,12 +74,12 @@ MemberTypeCanNotBeDeleted=Member type can not be deleted
NewSubscription=New contribution
NewSubscriptionDesc=This form allows you to record your subscription as a new member of the foundation. If you want to renew your subscription (if already a member), please contact foundation board instead by email %s.
Subscription=Contribution
AnyAmountWithAdvisedAmount=Any amount with a recommended amount of %s %s
AnyAmountWithoutAdvisedAmount=Any amount
AnyAmountWithAdvisedAmount=Any amount of your choice, recommended %s
AnyAmountWithoutAdvisedAmount=Any amount of your choice
CanEditAmountShort=Any amount
CanEditAmountShortForValues=recommended, any amount
MembershipDuration=Duration
GetMembershipButtonLabel=Get membership
GetMembershipButtonLabel=Join
Subscriptions=Contributions
SubscriptionLate=Late
SubscriptionNotReceived=Contribution never received

View File

@ -200,7 +200,7 @@ if (empty($reshook) && $action == 'add') {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
}
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'";
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login = '".$db->escape(GETPOST('login'))."'";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
@ -779,7 +779,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $caneditamount) {
print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
print ' '.$langs->trans("Currency".$conf->currency).'<span class="opacitymedium"> ';
print $amount>0? $langs->trans("AnyAmountWithAdvisedAmount", $amount, $langs->trans("Currency".$conf->currency)): $langs->trans("AnyAmountWithoutAdvisedAmount");
print $amount > 0 ? $langs->trans("AnyAmountWithAdvisedAmount", price($amount, 0, $langs, 1, -1, -1, $conf->currency)): $langs->trans("AnyAmountWithoutAdvisedAmount");
print '</span>';
} else {
print '<input type="hidden" name="amount" id="amount" class="flat amount" value="'.$showedamount.'">';
@ -815,12 +815,14 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
$publiccounters = getDolGlobalString("MEMBER_COUNTERS_ARE_PUBLIC");
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut as status, d.morphy, COUNT(a.rowid) AS membercount";
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut as status, d.morphy,";
$sql .= " COUNT(a.rowid) AS membercount";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as a";
$sql .= " ON d.rowid = a.fk_adherent_type AND a.statut>0";
$sql .= " ON d.rowid = a.fk_adherent_type AND a.statut > 0";
$sql .= " WHERE d.entity IN (".getEntity('member_type').")";
$sql .= " AND d.statut=1 GROUP BY d.rowid";
$sql .= " AND d.statut=1";
$sql .= " GROUP BY d.rowid, d.libelle, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut, d.morphy";
$result = $db->query($sql);
if ($result) {