Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW---Do-not-select-a-default-recipient

This commit is contained in:
Anthony Berton 2023-01-26 09:03:40 +01:00
commit f2bafe337a
51 changed files with 766 additions and 296 deletions

View File

@ -493,7 +493,7 @@ if (empty($reshook)) {
if ($conf->global->ACCOUNTING_REEXPORT == 1) { if ($conf->global->ACCOUNTING_REEXPORT == 1) {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
} }
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -1002,11 +1002,14 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
// Button re-export // Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) { if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> '; $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
$newcardbutton .= '</a>';
} else { } else {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> '; $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').'';
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
$newcardbutton .= '</a>';
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
if ($user->hasRight('accounting', 'mouvements', 'export')) { if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export')); $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
@ -1040,7 +1043,7 @@ if ($massaction == 'preunletteringauto') {
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
if ($massactionbutton && $contextpage != 'poslist') { if ($massactionbutton && $contextpage != 'poslist') {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
@ -1066,7 +1069,7 @@ print $moreforfilter;
print '</div>'; print '</div>';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">'; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -1222,8 +1225,7 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
}
if (!empty($arrayfields['t.piece_num']['checked'])) { if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
} }

View File

@ -723,7 +723,7 @@ class AccountingAccount extends CommonObject
} }
/** /**
* Return Suggest accounting accounts to bind * Return a suggested account (from chart of accounts) to bind
* *
* @param Societe $buyer Object buyer * @param Societe $buyer Object buyer
* @param Societe $seller Object seller * @param Societe $seller Object seller
@ -733,6 +733,8 @@ class AccountingAccount extends CommonObject
* @param array $accountingAccount Array of Accounting account * @param array $accountingAccount Array of Accounting account
* @param string $type Customer / Supplier * @param string $type Customer / Supplier
* @return array|int Accounting accounts suggested or < 0 if technical error. * @return array|int Accounting accounts suggested or < 0 if technical error.
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
*/ */
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '') public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
{ {

View File

@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int'); $default_account = GETPOST('default_account', 'int');
// Select Box // Select Box
@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$search_country = GETPOST('search_country', 'alpha'); $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -520,8 +519,8 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -640,7 +639,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>'; print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
// Ref Product // Ref Product
print '<td class="tdoverflowmax150">'; print '<td class="tdoverflowmax100">';
if ($product_static->id > 0) { if ($product_static->id > 0) {
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
} }
@ -649,7 +648,7 @@ if ($result) {
} }
print '</td>'; print '</td>';
// Description // Description of line
print '<td class="tdoverflowonsmartphone small">'; print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -683,15 +682,22 @@ if ($result) {
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
// First show default account for any products
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') { } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport"); $shelp .= $langs->trans("SaleExport");
} }
$s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
// Now show account for product
if ($product_static->id > 0) { if ($product_static->id > 0) {
print '<br>'; print '<br>';
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';

View File

@ -58,6 +58,8 @@ $year_current = $year_start;
// Validate History // Validate History
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (!isModEnabled('accounting')) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database // Clean database
$db->begin(); $db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd";
@ -110,8 +112,7 @@ if ($action == 'validatehistory') {
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid"; $sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity); $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity);
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er"; $sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity); $sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; $sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
@ -182,6 +183,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>'; $textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>'; $textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsVentilation")."&nbsp;".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy'); print load_fiche_titre($langs->trans("ExpenseReportsVentilation")."&nbsp;".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy');
print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>';
@ -253,7 +255,7 @@ $sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number'; $sql .= ' ORDER BY aa.account_number';
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -419,8 +418,8 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', ''); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', '');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);

View File

@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int'); $default_account = GETPOST('default_account', 'int');
// Select Box // Select Box
@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$search_country = GETPOST('search_country', 'alpha'); $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -112,7 +111,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -532,8 +531,8 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -712,14 +711,19 @@ if ($result) {
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') { } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport"); $shelp .= $langs->trans("SaleExport");
} }
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
if ($product_static->id > 0) { if ($product_static->id > 0) {
print '<br>'; print '<br>';
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';

View File

@ -171,4 +171,82 @@ class AdherentStats extends Stats
return $this->_getAllByYear($sql); return $this->_getAllByYear($sql);
} }
/**
* Return count of member by status group by adh type, total and average
*
* @param int $numberYears Years to scan
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
*/
public function countMembersByTagAndStatus($numberYears = 2)
{
global $user;
$now = dol_now();
$endYear = date('Y');
$startYear = $endYear - $numberYears;
$sql = "SELECT c.rowid as fk_categorie, c.label as label";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type";
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
$sql .= " AND c.fk_parent = 0";
$sql .= " GROUP BY c.rowid";
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
$MembersCountArray = [];
$totalstatus = array(
'label' => 'Total',
'members_draft' => 0,
'members_pending' => 0,
'members_uptodate' => 0,
'members_expired' => 0,
'members_excluded' => 0,
'members_resiliated' => 0
);
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$MembersCountArray[$objp->fk_categorie] = array(
'label' => $objp->label,
'members_draft' => (int) $objp->members_draft,
'members_pending' => (int) $objp->members_pending,
'members_uptodate' => (int) $objp->members_uptodate,
'members_expired' => (int) $objp->members_expired,
'members_excluded' => (int) $objp->members_excluded,
'members_resiliated' => (int) $objp->members_resiliated
);
$totalrow = 0;
foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) {
if ($key!='label') {
$totalrow += $nb;
$totalstatus[$key] += $nb;
}
}
$MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow;
$i++;
}
$this->db->free($result);
$MembersCountArray['total'] = $totalstatus;
$MembersCountArray['total']['all'] = array_sum($totalstatus);
}
return $MembersCountArray;
}
} }

View File

@ -30,9 +30,9 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -41,47 +41,51 @@ $langs->loadLangs(array("members", "companies"));
// Get parameters // Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ');
$mode = GETPOST('mode', 'alpha');
// Search fields // Search fields
$search = GETPOST("search", 'alpha'); $search = GETPOST("search", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha');
$search_lastname = GETPOST("search_lastname", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha');
$search_firstname = GETPOST("search_firstname", 'alpha'); $search_firstname = GETPOST("search_firstname", 'alpha');
$search_gender = GETPOST("search_gender", 'alpha'); $search_gender = GETPOST("search_gender", 'alpha');
$search_civility = GETPOST("search_civility", 'alpha'); $search_civility = GETPOST("search_civility", 'alpha');
$search_company = GETPOST('search_company', 'alphanohtml'); $search_company = GETPOST('search_company', 'alphanohtml');
$search_login = GETPOST("search_login", 'alpha'); $search_login = GETPOST("search_login", 'alpha');
$search_address = GETPOST("search_address", 'alpha'); $search_address = GETPOST("search_address", 'alpha');
$search_zip = GETPOST("search_zip", 'alpha'); $search_zip = GETPOST("search_zip", 'alpha');
$search_town = GETPOST("search_town", 'alpha'); $search_town = GETPOST("search_town", 'alpha');
$search_state = GETPOST("search_state", 'alpha'); $search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
$search_country = GETPOST("search_country", 'alpha'); $search_country = GETPOST("search_country", 'alpha');
$search_phone = GETPOST("search_phone", 'alpha'); $search_phone = GETPOST("search_phone", 'alpha');
$search_phone_perso = GETPOST("search_phone_perso", 'alpha'); $search_phone_perso = GETPOST("search_phone_perso", 'alpha');
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha'); $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_type = GETPOST("search_type", 'alpha'); $search_type = GETPOST("search_type", 'alpha');
$search_email = GETPOST("search_email", 'alpha'); $search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'int'); $search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha'); $search_morphy = GETPOST("search_morphy", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", 'alpha')); $search_import_key = trim(GETPOST("search_import_key", 'alpha'));
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha'); $catid = GETPOST("catid", 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma'); // statut
$filter = GETPOST("filter", 'alpha'); $filter = GETPOST("filter", 'alpha');
if ($filter) { if ($filter) {
$search_filter = $filter; // For backward compatibility $search_filter = $filter; // For backward compatibility
} }
$statut = GETPOST("statut", 'alpha'); $statut = GETPOST("statut", 'alpha');
if ($statut != '') { if ($statut != '') {
$search_status = $statut; // For backward compatibility $search_status = $statut; // For backward compatibility
@ -93,6 +97,7 @@ if ($search_status < -2) {
$search_status = ''; $search_status = '';
} }
// Pagination parameters
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');

View File

@ -117,7 +117,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') { } elseif ($action == 'del') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
if ($conf->global->COMMANDE_ADDON_PDF == "$value") { if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) {
dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity); dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
} }
} }
@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) {
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->COMMANDE_ADDON_PDF == $name) { if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';

View File

@ -29,15 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
$langs->loadLangs(array('bookmarks', 'admin')); $langs->loadLangs(array('bookmarks', 'admin'));
// Get Parameters // Get Parameters
$action = GETPOST('action', 'aZ09'); $id = GETPOST("id", 'int');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search
$id = GETPOST("id", 'int'); $backtopage = GETPOST('backtopage', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'aZ09'); $mode = GETPOST('mode', 'aZ09');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;

View File

@ -33,18 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills")); $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills"));
$action = GETPOST('action', 'aZ09'); // Get Parameters
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$confirm = GETPOST('confirm', 'alpha');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int'); $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
@ -70,6 +74,7 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
// Search Fields
$search_id = GETPOST('search_id', 'alpha'); $search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha'); $search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha'); $search_note = GETPOST('search_note', 'alpha');
@ -106,6 +111,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
$filtert = $user->id; $filtert = $user->id;
} }
// Pagination parameters
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');

View File

@ -1419,7 +1419,7 @@ if ($object->id > 0) {
$sql .= ', f.total_tva'; $sql .= ', f.total_tva';
$sql .= ', f.total_ttc'; $sql .= ', f.total_ttc';
$sql .= ', f.entity'; $sql .= ', f.entity';
$sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status'; $sql .= ', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
$sql .= ', s.nom, s.rowid as socid'; $sql .= ', s.nom, s.rowid as socid';
$sql .= ', SUM(pf.amount) as am'; $sql .= ', SUM(pf.amount) as am';
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
@ -1493,7 +1493,12 @@ if ($object->id > 0) {
//print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td>'; print '</td>';
if ($objp->df > 0) { if ($objp->df > 0) {
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->df), 'day').'</td>'; print '<td class="right" width="80px">'.$langs->trans('DateInvoice').": ".dol_print_date($db->jdate($objp->df), 'day').'</td>';
} else {
print '<td class="right"><b>!!!</b></td>';
}
if ($objp->dl > 0) {
print '<td class="right" width="80px">'.$langs->trans('DateMaxPayment').": ".dol_print_date($db->jdate($objp->dl), 'day').'</td>';
} else { } else {
print '<td class="right"><b>!!!</b></td>'; print '<td class="right"><b>!!!</b></td>';
} }

View File

@ -27,20 +27,24 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("mails"); $langs->load('mails');
$sortfield = GETPOST('sortfield', 'aZ09comma'); // Get Parameters
$sortorder = GETPOST('sortorder', 'aZ09comma');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$optioncss = GETPOST('optioncss', 'alpha');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $optioncss = GETPOST('optioncss', 'alpha');
// Pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0; $page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (!$sortorder) { if (!$sortorder) {
$sortorder = "DESC"; $sortorder = "DESC";
} }
@ -48,10 +52,12 @@ if (!$sortfield) {
$sortfield = "m.date_creat"; $sortfield = "m.date_creat";
} }
// Search Fields
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha"); $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
$filteremail = GETPOST('filteremail', 'alpha'); $filteremail = GETPOST('filteremail', 'alpha');
// Initialize objects
$object = new Mailing($db); $object = new Mailing($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -128,7 +134,9 @@ if (empty($reshook)) {
* View * View
*/ */
llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing'); // Page Header
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing';
llxHeader('', $langs->trans("Mailing"), $help_url);
$form = new Form($db); $form = new Form($db);

View File

@ -62,21 +62,23 @@ if (isModEnabled("expedition")) {
$langs->loadLangs(array('sendings')); $langs->loadLangs(array('sendings'));
} }
// Get Parameters
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist';
$mode = GETPOST('mode', 'alpha'); $mode = GETPOST('mode', 'alpha');
$search_user = GETPOST('search_user', 'int'); // Search Fields
$search_sale = GETPOST('search_sale', 'int'); $search_user = GETPOST('search_user', 'int');
$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_sale = GETPOST('search_sale', 'int');
$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_refcustomer = GETPOST('search_refcustomer', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha');
$search_refproject = GETPOST('search_refproject', 'alpha'); $search_refproject = GETPOST('search_refproject', 'alpha');
$search_project = GETPOST('search_project', 'alpha'); $search_project = GETPOST('search_project', 'alpha');
@ -140,15 +142,15 @@ $search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int')
$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear); $search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear); $search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
$search_status = GETPOST('search_status', 'alpha'); $search_status = GETPOST('search_status', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$object_statut = GETPOST('search_statut', 'alpha'); $object_statut = GETPOST('search_statut', 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
// Pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
@ -263,6 +265,7 @@ foreach ($object->fields as $key => $val) {
$fieldstosearchall['t.'.$key] = $val['label']; $fieldstosearchall['t.'.$key] = $val['label'];
} }
}*/ }*/
// Definition of array of fields for columns // Definition of array of fields for columns
/*$arrayfields = array(); /*$arrayfields = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
@ -278,9 +281,11 @@ foreach ($object->fields as $key => $val) {
); );
} }
}*/ }*/
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
// Permissions
$permissiontoread = $user->rights->propal->lire; $permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->creer; $permissiontoadd = $user->rights->propal->creer;
$permissiontodelete = $user->rights->propal->supprimer; $permissiontodelete = $user->rights->propal->supprimer;

View File

@ -144,9 +144,12 @@ $form = new Form($db);
$title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card"); $title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card");
$help_url = ''; $help_url = '';
llxHeader('', $title, $helpurl); llxHeader('', $title, $help_url);
if ($action == 'create') { if ($action == 'create') {
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n"; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n";

View File

@ -272,7 +272,7 @@ if ($id > 0 || $ref) {
print $formconfirm; print $formconfirm;
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action == 'settransmitted') { if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') {
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">'; print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="infotrans">'; print '<input type="hidden" name="action" value="infotrans">';
@ -291,7 +291,7 @@ if ($id > 0 || $ref) {
print '<br>'; print '<br>';
} }
if (!empty($object->date_trans) && empty($object->date_credit) && $user->rights->prelevement->bons->credit && $action == 'setcredited') { if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') {
$btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited"); $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">'; print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -822,6 +822,9 @@ while ($i < min($num, $limit)) {
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'cd.qty'; $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty';
} }
if (!$i) {
$totalarray['val']['cd.qty'] = $obj->qty;
}
$totalarray['val']['cd.qty'] += $obj->qty; $totalarray['val']['cd.qty'] += $obj->qty;
} }
if (!empty($arrayfields['cd.total_ht']['checked'])) { if (!empty($arrayfields['cd.total_ht']['checked'])) {

View File

@ -753,7 +753,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$';
} }
foreach ($listofobjectref as $tmppdf) { foreach ($listofobjectref as $tmppdf) {
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\']+\.pdf$'; // To include PDF generated from ODX files
} }
$listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true);

View File

@ -0,0 +1,278 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2022 Waël Almoman <info@almoman.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_members_by_tags.php
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last modofied members
*/
class box_members_by_tags extends ModeleBoxes
{
public $boxcode = "box_members_by_tags";
public $boximg = "object_user";
public $boxlabel = "BoxTitleMembersByTags";
public $depends = array("adherent", "categorie");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
$this->enabled = 0; // disabled for external users
}
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$staticmember = new Adherent($this->db);
$year = date('Y');
$numberyears = empty(getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH")) ? 2 : getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH");
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").' ('.$year-$numberyears.' - '.$year.')');
if ($user->rights->adherent->lire) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$stats = new AdherentStats($this->db, $user->socid, $user->id);
// Show array
$sumMembers= $stats->countMembersByTagAndStatus($numberyears);
if ($sumMembers) {
$line = 0;
$this->info_box_contents[$line][] = array(
'td' => 'class=""',
'text' => '',
);
// Members Status To Valid
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Waiting for subscription
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus,
);
// Up to date
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus,
);
// Expired
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Excluded
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Resiliated
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Total row
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"',
'text' => $langs->trans("Total")
);
$line++;
foreach ($sumMembers as $key => $data) {
$adhtype = new AdherentType($this->db);
$adhtype->id = $key;
if ($key=='total') {
break;
}
$adhtype->label = $data['label'];
$AdherentType[$key] = $adhtype;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $adhtype->getNomUrl(1, dol_size(32)),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_draft']) && $data['members_draft'] > 0 ? $data['members_draft'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_excluded']) && $data['members_excluded'] > 0 ? $data['members_excluded'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_resiliated']) && $data['members_resiliated'] > 0 ? $data['members_resiliated'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''),
'asis' => 1,
);
$line++;
}
if (count($sumMembers) == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center" colspan="6"',
'text' => $langs->trans("NoRecordedMembersByType")
);
} else {
$this->info_box_contents[$line][] = array(
'tr' => 'class="liste_total"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_draft'].' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_uptodate'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_expired'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_excluded'].' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_resiliated'].' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['all'],
'asis' => 1
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength' => 500,
'text' => ($this->db->error() . ' sql=' . $sql)
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -464,6 +464,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
closedir($handle); closedir($handle);
} }
} }
//echo "<pre>";print_r($modules);echo "</pre>";
asort($orders); asort($orders);

View File

@ -1104,7 +1104,7 @@ abstract class CommonDocGenerator
public function getColumnContentXStart($colKey) public function getColumnContentXStart($colKey)
{ {
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
return $colDef['xStartPos'] + $colDef['content']['padding'][3]; return (isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0) + $colDef['content']['padding'][3];
} }
/** /**

View File

@ -1291,11 +1291,11 @@ abstract class CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete all links between an object $this and all its contacts * Delete all links between an object $this and all its contacts in llx_element_contact
* *
* @param string $source '' or 'internal' or 'external' * @param string $source '' or 'internal' or 'external'
* @param string $code Type of contact (code or id) * @param string $code Type of contact (code or id)
* @return int >0 if OK, <0 if KO * @return int <0 if KO, 0=Nothing done, >0 if OK
*/ */
public function delete_linked_contact($source = '', $code = '') public function delete_linked_contact($source = '', $code = '')
{ {
@ -1311,11 +1311,15 @@ abstract class CommonObject
$listId = implode(",", $temp); $listId = implode(",", $temp);
} }
// If $listId is empty, we have not criteria on fk_c_type_contact so we will delete record on element_id for
// any type or record instead of only the ones of the current object. So we do nothing in such a case.
if (empty($listId)) {
return 0;
}
$sql = "DELETE FROM ".$this->db->prefix()."element_contact"; $sql = "DELETE FROM ".$this->db->prefix()."element_contact";
$sql .= " WHERE element_id = ".((int) $this->id); $sql .= " WHERE element_id = ".((int) $this->id);
if (!empty($listId)) { $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
$sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
}
dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {

View File

@ -785,6 +785,11 @@ class Conf
$this->global->USE_STRICT_CSV_RULES = 2; $this->global->USE_STRICT_CSV_RULES = 2;
} }
// By default, option is on. Once set by user, this code is useless
if (!isset($this->global->ACCOUNTING_REEXPORT)) {
$this->global->ACCOUNTING_REEXPORT = 1;
}
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) { if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
$this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;

View File

@ -6287,7 +6287,7 @@ class Form
if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
// We also add the buyer // We also add the buyer country code
if (is_numeric($type)) { if (is_numeric($type)) {
if ($type == 1) { // We know product is a service if ($type == 1) { // We know product is a service
$code_country .= ",'".$societe_acheteuse->country_code."'"; $code_country .= ",'".$societe_acheteuse->country_code."'";

View File

@ -21,7 +21,6 @@
*/ */
class FormSetup class FormSetup
{ {
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
@ -1082,16 +1081,18 @@ class FormSetupItem
} }
} }
} elseif (preg_match('/emailtemplate:/', $this->type)) { } elseif (preg_match('/emailtemplate:/', $this->type)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; if ($this->fieldValue > 0) {
$formmail = new FormMail($this->db); include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
$tmp = explode(':', $this->type); $tmp = explode(':', $this->type);
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
if (is_numeric($template) && $template < 0) { if (is_numeric($template) && $template < 0) {
$this->setErrors($formmail->errors); $this->setErrors($formmail->errors);
}
$out.= $this->langs->trans($template->label);
} }
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) { } elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db); $c = new Categorie($this->db);
@ -1117,6 +1118,7 @@ class FormSetupItem
} }
} elseif ($this->type == 'product') { } elseif ($this->type == 'product') {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$product = new Product($this->db); $product = new Product($this->db);
$resprod = $product->fetch($this->fieldValue); $resprod = $product->fetch($this->fieldValue);
if ($resprod > 0) { if ($resprod > 0) {

View File

@ -4085,7 +4085,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye', 'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
'help', 'holiday', 'help', 'holiday',
'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', 'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement',
'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right',
@ -5743,9 +5743,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
// If force rounding // If force rounding
if ((string) $forcerounding != '-1') { if ((string) $forcerounding != '-1') {
if ($forcerounding == 'MU') { if ($forcerounding === 'MU') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT; $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT;
} elseif ($forcerounding == 'MT') { } elseif ($forcerounding === 'MT') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT; $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT;
} elseif ($forcerounding >= 0) { } elseif ($forcerounding >= 0) {
$nbdecimal = $forcerounding; $nbdecimal = $forcerounding;
@ -6490,7 +6490,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) {
if ($seller_in_cee && $buyer_in_cee) { if ($seller_in_cee && $buyer_in_cee) {
$isacompany = $thirdparty_buyer->isACompany(); $isacompany = $thirdparty_buyer->isACompany();
if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!isValidVATID($thirdparty_buyer)) { if (!isValidVATID($thirdparty_buyer)) {
$isacompany = 0; $isacompany = 0;
@ -6539,7 +6539,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
// If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule // If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule
if (($seller_in_cee && $buyer_in_cee)) { if (($seller_in_cee && $buyer_in_cee)) {
$isacompany = $thirdparty_buyer->isACompany(); $isacompany = $thirdparty_buyer->isACompany();
if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!isValidVATID($thirdparty_buyer)) { if (!isValidVATID($thirdparty_buyer)) {
$isacompany = 0; $isacompany = 0;

View File

@ -198,6 +198,7 @@ class modAdherent extends DolibarrModules
4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'), 4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'),
5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'), 5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'),
6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'), 6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'),
7 => array('file'=>'box_members_by_tags.php', 'enabledbydefaulton'=>'membersindex'),
); );
// Permissions // Permissions

View File

@ -208,6 +208,13 @@ class modTicket extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'manage'; $this->rights[$r][4] = 'manage';
$r++;
$this->rights[$r][0] = 56006; // id de la permission
$this->rights[$r][1] = "Export ticket"; // libelle de la permission
//$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'export';
/* Seems not used and in conflict with societe->client->voir (see all thirdparties) /* Seems not used and in conflict with societe->client->voir (see all thirdparties)
$r++; $r++;
$this->rights[$r][0] = 56005; // id de la permission $this->rights[$r][0] = 56005; // id de la permission
@ -318,6 +325,27 @@ class modTicket extends DolibarrModules
'target' => '', 'target' => '',
'user' => 0); 'user' => 0);
$r++; $r++;
// Exports
//--------
$r = 1;
// Export list of tickets and attributes
$langs->load("ticket");
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("ticket", "export"));
$this->export_icon[$r]='ticket';
$keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)';
$this->export_sql_end[$r] .=' WHERE 1 = 1';
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')';
$r++;
} }
/** /**

View File

@ -41,6 +41,11 @@ class DolLogsCollector extends MessagesCollector
*/ */
protected $maxnboflines; protected $maxnboflines;
/**
* @var int number of lines
*/
protected $nboflines;
/** /**
* Constructor * Constructor
* *
@ -54,7 +59,7 @@ class DolLogsCollector extends MessagesCollector
parent::__construct($name); parent::__construct($name);
$this->nboflines = 0; $this->nboflines = 0;
$this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output $this->maxnboflines = getDolGlobalInt('DEBUGBAR_LOGS_LINES_NUMBER', 250); // High number slows seriously output
$this->path = $path ?: $this->getLogsFile(); $this->path = $path ?: $this->getLogsFile();
} }

View File

@ -772,7 +772,7 @@ class Don extends CommonObject
*/ */
public function setPaid($id, $modepayment = 0) public function setPaid($id, $modepayment = 0)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2, paid = 1";
if ($modepayment) { if ($modepayment) {
$sql .= ", fk_payment = ".((int) $modepayment); $sql .= ", fk_payment = ".((int) $modepayment);
} }
@ -782,6 +782,7 @@ class Don extends CommonObject
if ($resql) { if ($resql) {
if ($this->db->affected_rows($resql)) { if ($this->db->affected_rows($resql)) {
$this->statut = 2; $this->statut = 2;
$this->paid = 1;
return 1; return 1;
} else { } else {
return 0; return 0;

View File

@ -24,8 +24,6 @@
// Put here all includes required by your class file // Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/** /**
* Class for EmailCollectorAction * Class for EmailCollectorAction
@ -113,37 +111,6 @@ class EmailCollectorAction extends CommonObject
public $status; public $status;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
// If this object has a subtable with lines
// /**
// * @var string Name of subtable line
// */
//public $table_element_line = 'emailcollectoractiondet';
// /**
// * @var string Field with ID of parent key if this field has a parent
// */
//public $fk_element = 'fk_emailcollectoraction';
// /**
// * @var string Name of subtable class that manage subtable lines
// */
//public $class_element_line = 'EmailcollectorActionline';
// /**
// * @var array List of child tables. To test if we can delete object.
// */
//protected $childtables=array();
// /**
// * @var EmailcollectorActionLine[] Array of subtable lines
// */
//public $lines = array();
/** /**
* Constructor * Constructor
* *
@ -225,16 +192,14 @@ class EmailCollectorAction extends CommonObject
// Clear fields // Clear fields
$object->ref = "copy_of_".$object->ref; $object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title; // $object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique // Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) { if (is_array($object->array_options) && count($object->array_options) > 0) {
$extrafields->fetch_name_optionals_label($this->table_element); $extrafields->fetch_name_optionals_label($this->table_element);
foreach ($object->array_options as $key => $option) { foreach ($object->array_options as $key => $option) {
$shortkey = preg_replace('/options_/', '', $key); $shortkey = preg_replace('/options_/', '', $key);
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
//var_dump($key);
//var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]); unset($object->array_options[$key]);
} }
} }
@ -271,26 +236,10 @@ class EmailCollectorAction extends CommonObject
public function fetch($id, $ref = null) public function fetch($id, $ref = null)
{ {
$result = $this->fetchCommon($id, $ref); $result = $this->fetchCommon($id, $ref);
// if ($result > 0 && !empty($this->table_element_line)) {
// $this->fetchLinesCommon();
// }
return $result; return $result;
} }
/**
* Load object lines in memory from the database
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*public function fetchLines()
{
$this->lines=array();
// Load lines with object EmailcollectorActionLine
return count($this->lines)?1:0;
}*/
/** /**
* Update object into database * Update object into database
* *
@ -336,7 +285,6 @@ class EmailCollectorAction extends CommonObject
} }
$result = ''; $result = '';
$companylink = '';
$label = '<u>'.$langs->trans("EmailcollectorAction").'</u>'; $label = '<u>'.$langs->trans("EmailcollectorAction").'</u>';
$label .= '<br>'; $label .= '<br>';
@ -487,7 +435,7 @@ class EmailCollectorAction extends CommonObject
$this->user_creation_id = $obj->fk_user_creat; $this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif; $this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
} }

View File

@ -206,16 +206,14 @@ class EmailCollectorFilter extends CommonObject
// Clear fields // Clear fields
$object->ref = "copy_of_".$object->ref; $object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title; // $object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique // Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) { if (is_array($object->array_options) && count($object->array_options) > 0) {
$extrafields->fetch_name_optionals_label($this->table_element); $extrafields->fetch_name_optionals_label($this->table_element);
foreach ($object->array_options as $key => $option) { foreach ($object->array_options as $key => $option) {
$shortkey = preg_replace('/options_/', '', $key); $shortkey = preg_replace('/options_/', '', $key);
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
//var_dump($key);
//var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]); unset($object->array_options[$key]);
} }
} }
@ -252,26 +250,10 @@ class EmailCollectorFilter extends CommonObject
public function fetch($id, $ref = null) public function fetch($id, $ref = null)
{ {
$result = $this->fetchCommon($id, $ref); $result = $this->fetchCommon($id, $ref);
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
return $result; return $result;
} }
/**
* Load object lines in memory from the database
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*public function fetchLines()
{
$this->lines=array();
// Load lines with object EmailcollectorFilterLine
return count($this->lines)?1:0;
}*/
/** /**
* Update object into database * Update object into database
* *
@ -317,7 +299,6 @@ class EmailCollectorFilter extends CommonObject
} }
$result = ''; $result = '';
$companylink = '';
$label = '<u>'.$langs->trans("EmailcollectorFilter").'</u>'; $label = '<u>'.$langs->trans("EmailcollectorFilter").'</u>';
$label .= '<br>'; $label .= '<br>';
@ -468,7 +449,7 @@ class EmailCollectorFilter extends CommonObject
$this->user_creation_id = $obj->fk_user_creat; $this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif; $this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
} }

View File

@ -1210,11 +1210,17 @@ if (empty($reshook)) {
unset($date); unset($date);
} else { } else {
$error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
$action = ''; if (!$error) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
exit;
} else {
$action = '';
}
} }
if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) {

View File

@ -3071,7 +3071,8 @@ if ($action == 'create') {
} }
if (isset($objectidnext) && $objectidnext > 0) { if (isset($objectidnext) && $objectidnext > 0) {
$facthatreplace = new FactureFournisseur($db); $facthatreplace = new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
$facthatreplace->fetch($objectidnext);
print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>'; print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>';
} }
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {

View File

@ -1065,20 +1065,21 @@ class Job extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $selected, $langs; global $selected, $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto); $return .= img_picto('', $this->picto);
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>'; $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'deplacement')) { /*if (property_exists($this, 'deplacement')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span>'; $return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span>';
$return .= ' : <span class="info-box-label ">'.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].'</span>'; $return .= ' : <span class="info-box-label ">'.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].'</span>';
} }*/
if (property_exists($this, 'description') && !(empty($this->description))) { if (property_exists($this, 'description') && !(empty($this->description))) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Description").'</span> : '; //$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Description").'</span> : ';
$return .= '<br><span class="info-box-label ">'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).'</span>'; $return .= '<br><span class="info-box-label ">'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).'</span>';
} }
$return .= '</div>'; $return .= '</div>';

View File

@ -116,11 +116,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field // If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) { if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1, 1, '1'); $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array( $arrayfields['t.'.$key] = array(
'label'=>$val['label'], 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'], 'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : '' 'help'=> isset($val['help']) ? $val['help'] : ''
); );
@ -137,18 +137,15 @@ $permissiontoread = $user->rights->hrm->all->read;
$permissiontoadd = $user->rights->hrm->all->write; $permissiontoadd = $user->rights->hrm->all->write;
$permissiontodelete = $user->rights->hrm->all->delete; $permissiontodelete = $user->rights->hrm->all->delete;
// Security check
if (empty($conf->hrm->enabled)) {
accessforbidden('Module not enabled');
}
// Security check (enable the most restrictive one) // Security check (enable the most restrictive one)
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->hrm->enabled)) accessforbidden(); if (!isModEnabled('hrm')) {
accessforbidden('Module hrm not enabled');
}
if (!$permissiontoread) accessforbidden(); if (!$permissiontoread) accessforbidden();
@ -257,17 +254,17 @@ foreach ($search as $key => $val) {
$mode_search = 2; $mode_search = 2;
} }
if ($search[$key] != '') { if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
} }
} else { } else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) { if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
} }
if (preg_match('/_dtend$/', $key)) { if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
} }
} }
} }
@ -287,7 +284,7 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required /* If a group by is required
$sql .= " GROUP BY "; $sql .= " GROUP BY ";
foreach($object->fields as $key => $val) { foreach($object->fields as $key => $val) {
$sql .= "t.".$key.", "; $sql .= "t.".$db->escape($key).", ";
} }
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -302,8 +299,6 @@ $sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
*/ */
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -313,24 +308,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
$db->free($resql);
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql); // Complete request and execute it with limit
if (!$resql) { $sql .= $db->order($sortfield, $sortorder);
dol_print_error($db); if ($limit) {
exit; $sql .= $db->plimit($limit + 1, $offset);
}
$num = $db->num_rows($resql);
} }
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Direct jump if only one record found // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -373,11 +368,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.urlencode($limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key])) {
foreach ($search[$key] as $skey) { foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey); if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
} }
} else { } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]); $param .= '&search_'.$key.'='.urlencode($search[$key]);
} }
} }
@ -398,7 +399,7 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
); );
if ($permissiontodelete) { if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
@ -435,9 +436,12 @@ $trackid = 'xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) { if ($search_all) {
$setupstring = '';
foreach ($fieldstosearchall as $key => $val) { foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if JOBPOSITION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
} }
@ -461,7 +465,7 @@ if (!empty($moreforfilter)) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@ -471,7 +475,15 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// Fields title search // Fields title search
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$searchkey = empty($search[$key]) ? '' : $search[$key];
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') { if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
@ -479,7 +491,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -487,9 +499,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -497,6 +507,12 @@ foreach ($object->fields as $key => $val) {
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>'; print '</div>';
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
} }
print '</td>'; print '</td>';
} }
@ -509,16 +525,23 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="liste_titre maxwidthsearch">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$searchpicto = $form->showFilterButtons(); print '<td class="liste_titre maxwidthsearch">';
print $searchpicto; $searchpicto = $form->showFilterButtons();
print '</td>'; print $searchpicto;
print '</td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label // Fields title label
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') { if ($key == 'status') {
@ -527,21 +550,26 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
$totalarray['nbfield']++;
} }
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
$totalarray['nbfield']++;
print '</tr>'."\n"; print '</tr>'."\n";
@ -559,9 +587,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0; $totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) { $imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) { if (empty($obj)) {
break; // Should not happen break; // Should not happen
@ -571,29 +601,35 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
if ($mode == 'kanban') { if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$object->deplacement = $obj->deplacement; $object->deplacement = $obj->deplacement;
$object->description = $obj->description; $object->description = $obj->description;
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($i == 0) {
$selected = 0; print '<tr><td colspan="'.$savnbfield.'">';
if (in_array($object->id, $arrayofselected)) { print '<div class="box-flex-container">';
$selected = 1;
}
print $object->getKanbanView('');
} }
if ($i == (min($num, $limit) - 1)) { // Output Kanban
print $object->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>'; print '</div>';
print '</td></tr>'; print '</td></tr>';
} }
} else { } else {
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; $j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@ -614,7 +650,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>'; print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') { if ($key == 'status') {
print $object->getLibStatut(5); print $object->getLibStatut(5);
} elseif ($key == 'rowid') { } elseif ($key == 'rowid') {
@ -649,21 +689,24 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="nowrap center">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined print '<td class="nowrap center">';
$selected = 0; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if (in_array($object->id, $arrayofselected)) { $selected = 0;
$selected = 1; if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>'; print '</td>';
} }
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
print '</tr>'."\n"; print '</tr>'."\n";
} }
$i++; $i++;
} }
@ -678,14 +721,14 @@ if ($num == 0) {
$colspan++; $colspan++;
} }
} }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} }
$db->free($resql); $db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</table>'."\n"; print '</table>'."\n";

View File

@ -78,6 +78,7 @@
-- Portugal -- Portugal
-- Romania -> for Departmements -- Romania -> for Departmements
-- San Salvador -- San Salvador
-- Slovakia
-- Slovenia -- Slovenia
-- Spain -- Spain
-- Switzerland/Suisse -> for Departmements/Cantons -- Switzerland/Suisse -> for Departmements/Cantons
@ -450,6 +451,13 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 8
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental');
-- Slovakia Regions (rowid country=201)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20101', 'SK01', NULL, 'Bratislava Region');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20102', 'SK02', NULL, 'Western Slovakia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20103', 'SK03', NULL, 'Central Slovakia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20104', 'SK04', NULL, 'Eastern Slovakia');
-- Slovenia Regions (rowid country=202) -- Slovenia Regions (rowid country=202)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia');

View File

@ -14,8 +14,8 @@ ACCOUNTING_EXPORT_ENDLINE=Select the carriage return type
ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name
ThisService=This service ThisService=This service
ThisProduct=This product ThisProduct=This product
DefaultForService=Default for service DefaultForService=Default for services
DefaultForProduct=Default for product DefaultForProduct=Default for products
ProductForThisThirdparty=Product for this thirdparty ProductForThisThirdparty=Product for this thirdparty
ServiceForThisThirdparty=Service for this thirdparty ServiceForThisThirdparty=Service for this thirdparty
CantSuggest=Can't suggest CantSuggest=Can't suggest
@ -101,7 +101,8 @@ ShowAccountingAccount=Show accounting account
ShowAccountingJournal=Show accounting journal ShowAccountingJournal=Show accounting journal
ShowAccountingAccountInLedger=Show accounting account in ledger ShowAccountingAccountInLedger=Show accounting account in ledger
ShowAccountingAccountInJournals=Show accounting account in journals ShowAccountingAccountInJournals=Show accounting account in journals
AccountAccountingSuggest=Accounting account suggested DataUsedToSuggestAccount=Data used to suggest account
AccountAccountingSuggest=Account suggested
MenuDefaultAccounts=Default accounts MenuDefaultAccounts=Default accounts
MenuBankAccounts=Bank accounts MenuBankAccounts=Bank accounts
MenuVatAccounts=Vat accounts MenuVatAccounts=Vat accounts
@ -405,7 +406,7 @@ SaleLocal=Local sale
SaleExport=Export sale SaleExport=Export sale
SaleEEC=Sale in EEC SaleEEC=Sale in EEC
SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account. SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account.
SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fallback on the product account for standard sales. You can fix the VAT ID of thirdparty or the product account if needed. SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the thirdparty, or change the product account suggested for binding if needed.
ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported. ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported.
ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated. ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated.
## Dictionary ## Dictionary
@ -476,5 +477,7 @@ FECFormatMulticurrencyCode=Multicurrency code (Idevise)
DateExport=Date export DateExport=Date export
WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate. WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate.
ExpenseReportJournal=Expense Report Journal ExpenseReportJournal=Expense Report Journal
DocsAlreadyExportedAreExcluded=Docs already exported are excluded
ClickToHideAlreadyExportedLines=Click to hide already exported lines
NAccounts=%s accounts NAccounts=%s accounts

View File

@ -24,6 +24,7 @@ BoxFicheInter=Latest interventions
BoxCurrentAccounts=Open accounts balance BoxCurrentAccounts=Open accounts balance
BoxTitleMemberNextBirthdays=Birthdays of this month (members) BoxTitleMemberNextBirthdays=Birthdays of this month (members)
BoxTitleMembersByType=Members by type and status BoxTitleMembersByType=Members by type and status
BoxTitleMembersByTags=Members by tags and status
BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year
BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastRssInfos=Latest %s news from %s
BoxTitleLastProducts=Products/Services: last %s modified BoxTitleLastProducts=Products/Services: last %s modified

View File

@ -916,8 +916,8 @@ ExportFilteredList=Export filtered list
ExportList=Export list ExportList=Export list
ExportOptions=Export Options ExportOptions=Export Options
IncludeDocsAlreadyExported=Include docs already exported IncludeDocsAlreadyExported=Include docs already exported
ExportOfPiecesAlreadyExportedIsEnable=Export of pieces already exported is enable ExportOfPiecesAlreadyExportedIsEnable=Documents already exported are visible and will be exported
ExportOfPiecesAlreadyExportedIsDisable=Export of pieces already exported is disable ExportOfPiecesAlreadyExportedIsDisable=Documents already exported are hidden and won't be exported
AllExportedMovementsWereRecordedAsExported=All exported movements were recorded as exported AllExportedMovementsWereRecordedAsExported=All exported movements were recorded as exported
NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements could be recorded as exported NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements could be recorded as exported
Miscellaneous=Miscellaneous Miscellaneous=Miscellaneous

View File

@ -26,6 +26,7 @@ Permission56002=Modify tickets
Permission56003=Delete tickets Permission56003=Delete tickets
Permission56004=Manage tickets Permission56004=Manage tickets
Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on)
Permission56006=Export tickets
Tickets=Tickets Tickets=Tickets
TicketDictType=Ticket - Types TicketDictType=Ticket - Types
@ -61,6 +62,8 @@ TypeContact_ticket_external_CONTRIBUTOR=External contributor
OriginEmail=Reporter Email OriginEmail=Reporter Email
Notify_TICKET_SENTBYMAIL=Send ticket message by email Notify_TICKET_SENTBYMAIL=Send ticket message by email
ExportDataset_ticket_1=Tickets
# Status # Status
Read=Read Read=Read
Assigned=Assigned Assigned=Assigned

View File

@ -66,6 +66,7 @@ $error = 0;
* Actions * Actions
*/ */
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -291,13 +292,13 @@ if ($action == 'create') {
// Date Start // Date Start
print "<tr>"; print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
print $form->selectDate($datestart ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', '', '', '', 'add', 1, 1);
print '</td></tr>'; print '</td></tr>';
// Date End // Date End
print "<tr>"; print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
print $form->selectDate($dateend ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', '', '', '', 'add', 1, 1);
print '</td></tr>'; print '</td></tr>';
// Number of terms // Number of terms

View File

@ -42,6 +42,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$massaction = GETPOST('massaction', 'alpha');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0; $page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
@ -148,6 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
$db->free($resql); $db->free($resql);
} }
$arrayfields = array();
// Complete request and execute it with limit // Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);

View File

@ -55,9 +55,6 @@ global $langs, $user;
// Libraries // Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/mymodule.lib.php'; require_once '../lib/mymodule.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
//require_once "../class/myclass.class.php"; //require_once "../class/myclass.class.php";
// Translations // Translations

View File

@ -1485,7 +1485,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
} }
if ($type == 1 && $conf->workstation->enabled) { if ($type == 1 && isModEnabled("workstation")) {
// Default workstation // Default workstation
print '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>'; print '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');

View File

@ -133,7 +133,7 @@ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$form = new Form($db); $form = new Form($db);
$htmlother = new FormOther($db); $htmlother = new FormOther($db);
if ($objp->stock_physique < 0) { print '<span class="warning">'; } if (!empty($objp->stock_physique) && $objp->stock_physique < 0) { print '<span class="warning">'; }
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql .= ' p.fk_product_type, p.tms as datem,'; $sql .= ' p.fk_product_type, p.tms as datem,';

View File

@ -229,9 +229,10 @@ if ($action == "view_ticketlist") {
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
$filter = array(); $filter = array();
$param = '&action=view_ticketlist'; $param = '&action=view_ticketlist';
if (!empty($entity) && isModEnabled('multicompany')) { if (!empty($entity) && isModEnabled('multicompany')) {
$param .= '&entity='.$entity; $param .= '&entity='.((int) $entity);
} }
// Definition of fields for list // Definition of fields for list
@ -407,7 +408,8 @@ if ($action == "view_ticketlist") {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
// Search bar // Search bar
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n"; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n";

View File

@ -72,7 +72,7 @@ if ($origin == 'reception') {
} else { } else {
if ($origin == 'supplierorder' || $origin == 'order_supplier') { if ($origin == 'supplierorder' || $origin == 'order_supplier') {
$result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande');
} elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { } elseif (!$user->hasRight($origin, "lire") && !$user->hasRight($origin, "read")) {
accessforbidden(); accessforbidden();
} }
} }

View File

@ -97,6 +97,7 @@ $search_chq_number = GETPOST('search_chq_number', 'int');
$filtre = GETPOST("filtre", 'restricthtml'); $filtre = GETPOST("filtre", 'restricthtml');
$search_type_id = '';
if (!GETPOST('search_type_id', 'int')) { if (!GETPOST('search_type_id', 'int')) {
$newfiltre = str_replace('filtre=', '', $filtre); $newfiltre = str_replace('filtre=', '', $filtre);
$filterarray = explode('-', $newfiltre); $filterarray = explode('-', $newfiltre);
@ -532,6 +533,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
$i = 0; $i = 0;
$total = 0; $total = 0;
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) { while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) { if (empty($obj)) {
@ -697,7 +699,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
} }
$totalarray['val']['totalttcfield'] += $obj->amount; if (!$i) {
$totalarray['val']['totalttcfield'] = $obj->amount;
} else {
$totalarray['val']['totalttcfield'] += $obj->amount;
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';

View File

@ -3803,7 +3803,7 @@ td.border, div.tagtable div div.border {
} }
.fichehalfright table.noborder { .fichehalfright table.noborder , .fichehalfleft table.noborder{
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) { table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) {

View File

@ -422,8 +422,18 @@ if (empty($reshook)) {
$object->civility_code = GETPOST("civility_code", 'aZ09'); $object->civility_code = GETPOST("civility_code", 'aZ09');
$object->lastname = GETPOST("lastname", 'alphanohtml'); $object->lastname = GETPOST("lastname", 'alphanohtml');
$object->firstname = GETPOST("firstname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml');
$object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); /*
$object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); * Protection against deletion of ref_employee while the field is not present in the user tab
*/
if (GETPOSTISSET("ref_employee")) {
$object->ref_employee = GETPOST("ref_employee", 'alphanohtml');
}
/*
* Protection against deletion of national_registration_number while the field is not present in the user tab
*/
if (GETPOSTISSET("national_registration_number")) {
$object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml');
}
$object->gender = GETPOST("gender", 'aZ09'); $object->gender = GETPOST("gender", 'aZ09');
$object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields
$object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key;