Merge remote-tracking branch 'Dolibarr/13.0' into 13_fix_edit_expedition_field

This commit is contained in:
Francis Appels 2021-01-07 18:30:25 +01:00
commit d371df66b7
27 changed files with 320 additions and 182 deletions

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$error = 0; $error = 0;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy")); $langs->loadLangs(array("bills", "accountancy", "compta"));
$mesg = ''; $mesg = '';
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -41,7 +41,9 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$accountingaccount = GETPOST('accountingaccount', 'alpha');
$account_number = GETPOST('account_number', 'string');
$label = GETPOST('label', 'alpha');
// Security check // Security check
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
@ -65,104 +67,118 @@ if (GETPOST('cancel', 'alpha'))
if ($action == 'add' && $user->rights->accounting->chartofaccount) if ($action == 'add' && $user->rights->accounting->chartofaccount)
{ {
if (!$cancel) { if (!$cancel) {
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS; if (!$account_number)
dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
{ {
$account_number = GETPOST('account_number', 'string'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
$action = 'create';
} elseif (!$label)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'create';
} else { } else {
$account_number = clean_account(GETPOST('account_number', 'string')); $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
}
if (GETPOST('account_parent', 'int') <= 0) dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
{ $result = $db->query($sql);
$account_parent = 0; $obj = $db->fetch_object($result);
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$object->fk_pcg_version = $obj->pcg_version; // Clean code
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$object->active = 1;
$res = $object->create($user); // To manage zero or not at the end of the accounting account
if ($res == - 3) { if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
$error = 1; $account_number = $account_number;
$action = "create"; } else {
setEventMessages($object->error, $object->errors, 'errors'); $account_number = clean_account($account_number);
} elseif ($res == - 4) { }
$error = 2;
$action = "create"; if (GETPOST('account_parent', 'int') <= 0) {
setEventMessages($object->error, $object->errors, 'errors'); $account_parent = 0;
} elseif ($res < 0) } else {
{ $account_parent = GETPOST('account_parent', 'int');
$error++; }
setEventMessages($object->error, $object->errors, 'errors');
$action = "create"; $object->fk_pcg_version = $obj->pcg_version;
} $object->pcg_type = GETPOST('pcg_type', 'alpha');
if (!$error) $object->account_number = $account_number;
{ $object->account_parent = $account_parent;
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs'); $object->account_category = GETPOST('account_category', 'alpha');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1); $object->label = $label;
header("Location: ".$urltogo); $object->labelshort = GETPOST('labelshort', 'alpha');
exit; $object->active = 1;
$res = $object->create($user);
if ($res == -3) {
$error = 1;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res == -4) {
$error = 2;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
if (!$error) {
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: " . $urltogo);
exit;
}
} }
} }
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) { } elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
if (!$cancel) { if (!$cancel) {
$result = $object->fetch($id); if (!$account_number)
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
{ {
$account_number = GETPOST('account_number', 'string'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
} else { $action = 'update';
$account_number = clean_account(GETPOST('account_number', 'string')); } elseif (!$label)
}
if (GETPOST('account_parent', 'int') <= 0)
{ {
$account_parent = 0; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'update';
} else { } else {
$account_parent = GETPOST('account_parent', 'int'); $result = $object->fetch($id);
}
$object->fk_pcg_version = $obj->pcg_version; $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
if ($result > 0) { // Clean code
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo); // To manage zero or not at the end of the accounting account
exit(); if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
} else { $account_number = $account_number;
$mesg = $object->error; } else {
$account_number = clean_account($account_number);
}
if (GETPOST('account_parent', 'int') <= 0) {
$account_parent = 0;
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = $label;
$object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user);
if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
header("Location: " . $urltogo);
exit();
} else {
$mesg = $object->error;
}
} }
} else { } else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id); $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
@ -222,7 +238,7 @@ if ($action == 'create') {
// Account number // Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>';
print '<td><input name="account_number" size="30" value="'.$accountingaccount.'"></td></tr>'; print '<td><input name="account_number" size="30" value="'.$account_number.'"></td></tr>';
// Label // Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy", "compta"));
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
@ -88,6 +88,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
} else { } else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y'); $year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1; $year_end = $year_start + 1;
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) if ($month_end < 1)
@ -322,7 +323,9 @@ if ($action != 'export_csv')
$root_account_number = $tmparrayforrootaccount['account_number']; $root_account_number = $tmparrayforrootaccount['account_number'];
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) { if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>'; $link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) {
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
if (!empty($show_subgroup)) if (!empty($show_subgroup))

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy", "compta"));
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');

View File

@ -48,6 +48,14 @@ $search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code"); $search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@ -128,6 +136,7 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
); );
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@ -181,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = ''; $search_date_endyear = '';
$search_date_endmonth = ''; $search_date_endmonth = '';
$search_date_endday = ''; $search_date_endday = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_date_export_startyear = '';
$search_date_export_startmonth = '';
$search_date_export_startday = '';
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
$search_debit = ''; $search_debit = '';
$search_credit = ''; $search_credit = '';
$search_lettering_code = ''; $search_lettering_code = '';
@ -251,6 +268,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled; $filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled); $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
} }
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
} }
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@ -490,6 +515,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
// Date export
if (!empty($arrayfields['t.date_export']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
@ -512,6 +548,7 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -542,13 +579,12 @@ while ($i < min($num, $limit))
// Is it a break ? // Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { $colnumber = 5;
$colnumber = 3; $colnumberend = 7;
$colnumberend = 7;
} else { if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
$colnumber = 4; if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber; $colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend; $colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account // Show a subtotal by accounting account
@ -581,7 +617,7 @@ while ($i < min($num, $limit))
// Show the break account // Show the break account
print "<tr>"; print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte); if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>'; else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>'; print '</td>';
@ -722,6 +758,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Exported operation date
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@ -750,14 +793,6 @@ while ($i < min($num, $limit))
} }
if ($num > 0) { if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber; $colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend; $colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">'; print '<tr class="liste_total">';

View File

@ -48,6 +48,14 @@ $search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code"); $search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@ -128,6 +136,7 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
); );
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@ -149,6 +158,7 @@ if ($search_date_end && empty($search_date_endyear)) {
/* /*
* Action * Action
*/ */
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
@ -180,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = ''; $search_date_endyear = '';
$search_date_endmonth = ''; $search_date_endmonth = '';
$search_date_endday = ''; $search_date_endday = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_date_export_startyear = '';
$search_date_export_startmonth = '';
$search_date_export_startday = '';
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
$search_debit = ''; $search_debit = '';
$search_credit = ''; $search_credit = '';
$search_lettering_code = ''; $search_lettering_code = '';
@ -250,6 +268,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled; $filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled); $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
} }
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
} }
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@ -287,7 +313,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
} }
// Make a redirect to avoid to launch the delete later after a back button // Make a redirect to avoid to launch the delete later after a back button
header("Location: listbysubaccount.php".($param ? '?'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit; exit;
} else { } else {
setEventMessages("NoRecordDeleted", null, 'warnings'); setEventMessages("NoRecordDeleted", null, 'warnings');
@ -304,7 +330,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
header("Location: listbysubaccount.php?noreset=1".($param ? '&'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit; exit;
} }
} }
@ -403,7 +429,6 @@ if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
} }
@ -494,6 +519,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
// Date export
if (!empty($arrayfields['t.date_export']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
@ -516,6 +552,7 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -546,13 +583,12 @@ while ($i < min($num, $limit))
// Is it a break ? // Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { $colnumber = 5;
$colnumber = 3; $colnumberend = 7;
$colnumberend = 7;
} else { if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
$colnumber = 4; if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber; $colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend; $colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account // Show a subtotal by accounting account
@ -585,7 +621,7 @@ while ($i < min($num, $limit))
// Show the break account // Show the break account
print "<tr>"; print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') { if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account); print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account);
} else { } else {
@ -734,6 +770,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Exported operation date
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@ -762,14 +805,6 @@ while ($i < min($num, $limit))
} }
if ($num > 0) { if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber; $colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend; $colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">'; print '<tr class="liste_total">';

View File

@ -795,7 +795,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,"; $sql .= " t.label_operation,";
$sql .= " t.debit,"; $sql .= " t.debit,";
$sql .= " t.credit,"; $sql .= " t.credit,";
$sql .= " t.montant,"; $sql .= " t.montant as amount,";
$sql .= " t.sens,"; $sql .= " t.sens,";
$sql .= " t.multicurrency_amount,"; $sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,"; $sql .= " t.multicurrency_code,";
@ -806,7 +806,8 @@ class BookKeeping extends CommonObject
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,"; $sql .= " t.journal_label,";
$sql .= " t.piece_num,"; $sql .= " t.piece_num,";
$sql .= " t.date_creation"; $sql .= " t.date_creation,";
$sql .= " t.date_export";
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -823,6 +824,8 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; $sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') { } elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1); $sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') { } elseif ($key == 't.reconciled_option') {
@ -878,7 +881,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation; $line->label_operation = $obj->label_operation;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$line->montant = $obj->montant; $line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount; $line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code; $line->multicurrency_code = $obj->multicurrency_code;
@ -889,7 +893,8 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label; $line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation; $line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_export = $this->db->jdate($obj->date_export);
$this->lines[] = $line; $this->lines[] = $line;
@ -941,7 +946,7 @@ class BookKeeping extends CommonObject
$sql .= " t.credit,"; $sql .= " t.credit,";
$sql .= " t.lettering_code,"; $sql .= " t.lettering_code,";
$sql .= " t.date_lettering,"; $sql .= " t.date_lettering,";
$sql .= " t.montant,"; $sql .= " t.montant as amount,";
$sql .= " t.sens,"; $sql .= " t.sens,";
$sql .= " t.fk_user_author,"; $sql .= " t.fk_user_author,";
$sql .= " t.import_key,"; $sql .= " t.import_key,";
@ -1019,7 +1024,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation; $line->label_operation = $obj->label_operation;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$line->montant = $obj->montant; $line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code; $line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering; $line->date_lettering = $obj->date_lettering;

View File

@ -621,6 +621,7 @@ if ($id == 11)
// 'contract' => $langs->trans('Contract'), // 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'), 'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'), 'project_task' => $langs->trans('Task'),
'ticket' => $langs->trans('Ticket'),
'agenda' => $langs->trans('Agenda'), 'agenda' => $langs->trans('Agenda'),
'dolresource' => $langs->trans('Resource'), 'dolresource' => $langs->trans('Resource'),
// old deprecated // old deprecated
@ -1492,11 +1493,9 @@ if ($id)
continue; continue;
} }
if ($value == 'element') if ($value == 'element') {
{
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
} elseif ($value == 'source') } elseif ($value == 'source') {
{
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
} elseif ($valuetoshow == 'all') { } elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All'); $valuetoshow = $langs->trans('All');

View File

@ -181,8 +181,10 @@ if (empty($reshook))
unset($_POST['qty_frozen']); unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']); unset($_POST['disable_stock_change']);
$object->fetchLines(); $object->fetchLines();
}
$object->calculateCosts();
}
} }
} }
@ -221,7 +223,9 @@ if (empty($reshook))
unset($_POST['qty_frozen']); unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']); unset($_POST['disable_stock_change']);
$object->fetchLines(); $object->fetchLines();
$object->calculateCosts();
} }
} }
} }

View File

@ -113,7 +113,6 @@ if (!empty($conf->global->PRODUCT_USE_UNITS))
{ {
$coldisplay++; $coldisplay++;
print '<td class="nobottom linecoluseunit left">'; print '<td class="nobottom linecoluseunit left">';
// print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
print '</td>'; print '</td>';
} }

View File

@ -112,7 +112,6 @@ if (!empty($conf->global->PRODUCT_USE_UNITS))
{ {
$coldisplay++; $coldisplay++;
print '<td class="nobottom linecoluseunit left">'; print '<td class="nobottom linecoluseunit left">';
// print $form->selectUnits($line->fk_unit, "units");
print '</td>'; print '</td>';
} }

View File

@ -58,11 +58,15 @@ if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype); $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) accessforbidden(); if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) accessforbidden();
$hookmanager->initHooks(array('bankline'));
/* /*
* Actions * Actions
*/ */
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($cancel) if ($cancel)
{ {
if ($backtopage) if ($backtopage)

View File

@ -40,11 +40,14 @@ if (!$user->rights->banque->transfer)
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$error = 0; $error = 0;
$hookmanager->initHooks(array('banktransfer'));
/* /*
* Actions * Actions
*/ */
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($action == 'add') if ($action == 'add')
{ {
$langs->load("errors"); $langs->load("errors");

View File

@ -182,8 +182,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
if (!$dateech) if (!$dateech)
{ {
setEventMessages($langs->trans("ErrorFieldReqrequire_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
uired", $langs->transnoentities("Date")), null, 'errors');
$action = 'edit'; $action = 'edit';
} elseif (!$dateperiod) } elseif (!$dateperiod)
{ {

View File

@ -91,7 +91,7 @@ class box_birthdays extends ModeleBoxes
$sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = 1"; $sql .= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY u.birth ASC"; $sql .= " ORDER BY DAY(u.birth) ASC";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);

View File

@ -91,7 +91,7 @@ class box_birthdays_members extends ModeleBoxes
$sql .= " WHERE u.entity IN (".getEntity('adherent').")"; $sql .= " WHERE u.entity IN (".getEntity('adherent').")";
$sql .= " AND u.statut = 1"; $sql .= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY u.birth ASC"; $sql .= " ORDER BY DAY(u.birth) ASC";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);

View File

@ -105,6 +105,7 @@ class box_shipments extends ModeleBoxes
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
if ($user->socid > 0) $sql.= " AND s.rowid = ".$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id;
else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);

View File

@ -680,7 +680,8 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
if (!is_array($out)) { if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
$out = str_replace(array('&quot;', '"', '../'), '', trim($out)); $out = str_replace(array('&quot;', '"'), "''", trim($out));
$out = str_replace(array('../'), '', $out);
// keep lines feed // keep lines feed
$out = dol_string_nohtmltag($out, 0); $out = dol_string_nohtmltag($out, 0);
} }

View File

@ -365,14 +365,15 @@ class pdf_rouget extends ModelePdfExpedition
$tab_top_alt = $tab_top; $tab_top_alt = $tab_top;
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
//$tab_top_alt += 1; //$tab_top_alt += 1;
// Tracking number // Tracking number
if (!empty($object->tracking_number)) if (!empty($object->tracking_number))
{ {
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
$object->getUrlTrackingStatus($object->tracking_number); $object->getUrlTrackingStatus($object->tracking_number);
if (!empty($object->tracking_url)) if (!empty($object->tracking_url))
{ {

View File

@ -198,11 +198,21 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) {
$sendto = ''; $sendto = '';
if (empty($user->socid) && empty($user->email)) {
$object->fetch_thirdparty(); //if contact selected send to email's contact else send to email's thirdparty
$sendto = $object->thirdparty->email;
} else { $contactid = GETPOST('contactid', 'alpha');
$sendto = $user->email;
if (!empty($contactid)) {
$contact = new Contact($this->db);
$res = $contact->fetch($contactid);
}
if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
$sendto = $contact->email;
} elseif (!empty($object->fk_soc)) {
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
} }
if ($sendto) { if ($sendto) {

View File

@ -1079,7 +1079,7 @@ if (empty($reshook))
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
if (GETPOST('price_ht') != '') if (GETPOST('price_ht') != '' || GETPOST('multicurrency_subprice') != '')
{ {
$up = price2num(GETPOST('price_ht')); $up = price2num(GETPOST('price_ht'));
$price_base_type = 'HT'; $price_base_type = 'HT';

View File

@ -1112,4 +1112,5 @@ UpToDate=Up-to-date
OutOfDate=Out-of-date OutOfDate=Out-of-date
EventReminder=Event Reminder EventReminder=Event Reminder
UpdateForAllLines=Update for all lines UpdateForAllLines=Update for all lines
OnHold=On hold OnHold=On hold
Civility=Civility

View File

@ -5428,7 +5428,6 @@ class Product extends CommonObject
$langs->load('products'); $langs->load('products');
$label_type = 'label'; $label_type = 'label';
if ($type == 'short') { if ($type == 'short') {
$label_type = 'short_label'; $label_type = 'short_label';
} }

View File

@ -486,7 +486,11 @@ if ($resql)
} }
} }
llxHeader('', $title, $helpurl, ''); foreach ($searchCategoryProductList as $searchCategoryProduct) {
$paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct);
}
llxHeader('', $title, $helpurl, '', 0, 0, "", "", $paramsCat);
// Displays product removal confirmation // Displays product removal confirmation
if (GETPOST('delprod')) { if (GETPOST('delprod')) {

View File

@ -1513,12 +1513,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
//} //}
// Supplier // Supplier
//if ($object->fournisseur) { if (!empty($conf->fournisseur->enabled)) {
print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td><td colspan="3">'; print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1);
print img_picto('', 'category').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print img_picto('', 'category').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>"; print "</td></tr>";
//} }
} }
// Multicurrency // Multicurrency
@ -2133,17 +2133,19 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print "</td></tr>"; print "</td></tr>";
// Supplier // Supplier
print '<tr class="visibleifsupplier"><td>'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td>'; if (!empty($conf->fournisseur->enabled)) {
print '<td colspan="3">'; print '<tr class="visibleifsupplier"><td>'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); print '<td colspan="3">';
$c = new Categorie($db); $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1);
$cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); $c = new Categorie($db);
$arrayselected = array(); $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER);
foreach ($cats as $cat) { $arrayselected = array();
$arrayselected[] = $cat->id; foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print img_picto('', 'category').$form->multiselectarray('suppcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
} }
print img_picto('', 'category').$form->multiselectarray('suppcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
} }
// Multicurrency // Multicurrency
@ -2509,7 +2511,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
} }
// Supplier // Supplier
if ($object->fournisseur) { if (!empty($conf->fournisseur->enabled) && $object->fournisseur) {
print '<tr><td>'.$langs->trans("SuppliersCategoriesShort").'</td>'; print '<tr><td>'.$langs->trans("SuppliersCategoriesShort").'</td>';
print '<td>'; print '<td>';
print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);

View File

@ -3621,8 +3621,8 @@ class Societe extends CommonObject
*/ */
public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '')
{ {
// phpcs:enable // phpcs:enable
global $user, $langs; global $conf, $user, $langs;
dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG);
@ -3656,6 +3656,23 @@ class Societe extends CommonObject
// Cree et positionne $this->id // Cree et positionne $this->id
$result = $this->create($user); $result = $this->create($user);
if ($result >= 0) { if ($result >= 0) {
// Auto-create contact on thirdparty creation
if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT)) {
// Fill fields needed by contact
$this->name_bis = $member->lastname;
$this->firstname = $member->firstname;
$this->civility_id = $member->civility_id;
dol_syslog("We ask to create a contact/address too", LOG_DEBUG);
$result = $this->create_individual($user);
if ($result < 0)
{
setEventMessages($this->error, $this->errors, 'errors');
$this->db->rollback();
return -1;
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
$sql .= " SET fk_soc=".$this->id; $sql .= " SET fk_soc=".$this->id;
$sql .= " WHERE rowid=".$member->id; $sql .= " WHERE rowid=".$member->id;

View File

@ -36,7 +36,7 @@ if (!$user->rights->user->user->lire && !$user->admin) {
} }
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('users', 'companies', 'hrm')); $langs->loadLangs(array('users', 'companies', 'hrm', 'salaries'));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)

View File

@ -294,20 +294,20 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$result=GETPOST("param1", 'int'); $result=GETPOST("param1", 'int');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 222); $this->assertEquals($result, 222, 'Test on param1 with no 3rd param');
$result=GETPOST("param1", 'int', 2); $result=GETPOST("param1", 'int', 2);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 333); $this->assertEquals($result, 333, 'Test on param1 with 3rd param = 2');
// Test alpha // Test alpha
$result=GETPOST("param2", 'alpha'); $result=GETPOST("param2", 'alpha');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals($result, $_GET["param2"]); $this->assertEquals($result, $_GET["param2"], 'Test on param2');
$result=GETPOST("param3", 'alpha'); // Must return string sanitized from char " $result=GETPOST("param3", 'alpha'); // Must return string sanitized from char "
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 'na/b#e(pr)qq-rr\cc'); $this->assertEquals($result, '\'\'na/b#e(pr)qq-rr\cc', 'Test on param3');
$result=GETPOST("param4", 'alpha'); // Must return string sanitized from ../ $result=GETPOST("param4", 'alpha'); // Must return string sanitized from ../
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -346,7 +346,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
// With alphanohtml, we must convert the html entities like &#110; // With alphanohtml, we must convert the html entities like &#110;
$result=GETPOST("param8", 'alphanohtml'); $result=GETPOST("param8", 'alphanohtml');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals("Hacker<svg onload='console.log(123)'", $result); $this->assertEquals("Hacker<svg onload='console.log(''123'')'", $result);
$result=GETPOST("param9", 'alphanohtml'); $result=GETPOST("param9", 'alphanohtml');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";