diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml index 99711e56f8f..90ba405e061 100644 --- a/.github/workflows/exakat.yml +++ b/.github/workflows/exakat.yml @@ -13,5 +13,5 @@ jobs: - name: Exakat uses: docker://exakat/exakat-ga with: - ignore_rules: 'Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis' + ignore_rules: 'Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis' ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 46779a760c5..9e0b301edde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,23 +5,23 @@ English Dolibarr ChangeLog ***** ChangeLog for 13.0.0 compared to 12.0.0 ***** For users: -NEW: Add module Credit transfer SEPA to manage payment of supplier using bank credit transfer SEPA files -NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable +NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files. +NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable. WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Properties ->contactid has been renamed into ->contact_id -* Rename property $paiementid in API api_supplier_invoices into $payment_mode_id -* The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you still use old syntax in +* Property $paiementid in API api_supplier_invoices has been renamed into into $payment_mode_id (english) +* The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you used the old syntax in your email templates. * The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom days of holiday. * Property num_paiement has been renamed num_payment everywhere for better code consistency. * If you build a class that implement CommonObject to use the incoterm properties or method (->fk_incoterm, ->label_incoterm, ->location_incoterm), you must now also include declaration of the Trait CommonIncoterm in your class. All incoterm functions were moved into this Trait. -* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alpahnohtml'); +* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alphanohtml'); ***** ChangeLog for 12.0.3 compared to 12.0.2 ***** diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index f37ff79a1fa..e5c104298bf 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -61,8 +61,6 @@ $list_binding = array( * Actions */ -$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE; - if ($action == 'update') { $error = 0; @@ -227,36 +225,6 @@ print '
'; print ''; print ''; -// Default mode for calculating turnover (parameter ACCOUNTING_MODE) -/* -print ''; - -print ''; -print ''; -print "\n"; -print ''; -print '\n"; -print ''; -print '\n"; - -print "
' . $langs->trans('OptionMode') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeTrue') . '' . nl2br($langs->trans('OptionModeTrueDesc')); -// Write info on way to count VAT -// if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) -// { -// // print "
\n"; -// // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); -// } -// else -// { -// // print "
\n"; -// // print nl2br($langs->trans('OptionModeTrueInfoExpert')); -// } -print "
' . $langs->trans('OptionModeVirtual') . '' . nl2br($langs->trans('OptionModeVirtualDesc')) . "
\n"; - - -print '
'; -*/ - // Params print ''; print ''; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 79bfef57d3a..3e3fb104e70 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -152,7 +152,7 @@ if ($action == 'update') { } if ($result <= 0) { // setEventMessages(null, $accounting->errors, 'errors'); - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$sql.'
'; $ko++; } else { $db->begin(); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 3c28cdaab84..a06d2f25d8c 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -142,7 +142,7 @@ if (empty($reshook)) if ($massaction == 'ventil') { $msg = ''; - //print '
' . $langs->trans("Processing") . '...
'; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; $msg .= '
'; @@ -157,7 +157,7 @@ if ($massaction == 'ventil') { if ($monCompte <= 0) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; + $msg .= '
'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NoAccountSelected").'
'; $ko++; } else { $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet"; @@ -165,14 +165,14 @@ if ($massaction == 'ventil') { $sql .= " WHERE rowid = ".((int) $monId); $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); + $accountventilated->fetch($monCompte, '', 1); dol_syslog("accountancy/customer/list.php sql=".$sql, LOG_DEBUG); if ($db->query($sql)) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; + $msg .= '
'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; } else { - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; $ko++; } } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 265e9488055..c2fb21a911b 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -43,7 +43,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -124,7 +124,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'ventil') { $msg = ''; - //print '
' . $langs->trans("Processing") . '...
'; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; $msg .= '
'; @@ -139,7 +139,7 @@ if ($massaction == 'ventil') { if ($monCompte <= 0) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; + $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; } else { $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det"; @@ -147,14 +147,14 @@ if ($massaction == 'ventil') { $sql .= " WHERE rowid = ".$monId; $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); + $accountventilated->fetch($monCompte, '', 1); dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG); if ($db->query($sql)) { - $msg .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; + $msg .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; } else { - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; $ko++; } } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 12fe8792401..4dd5df83152 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -93,12 +93,15 @@ $error = 0; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -// Period by default on transfer -$dates = getDefaultDatesForTransfer(); -$date_start = $dates['date_start']; -$date_end = $dates['date_end']; -$pastmonthyear = $dates['pastmonthyear']; -$pastmonth = $dates['pastmonth']; +if (empty($date_startmonth) || empty($date_endmonth)) +{ + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); + $date_start = $dates['date_start']; + $date_end = $dates['date_end']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form { diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index b24f8550e50..bf8275cee1c 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -73,12 +73,15 @@ $journal_label = $accountingjournalstatic->label; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -// Period by default on transfer -$dates = getDefaultDatesForTransfer(); -$date_start = $dates['date_start']; -$date_end = $dates['date_end']; -$pastmonthyear = $dates['pastmonthyear']; -$pastmonth = $dates['pastmonth']; +if (empty($date_startmonth) || empty($date_endmonth)) +{ + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); + $date_start = $dates['date_start']; + $date_end = $dates['date_end']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 779c04f68fa..8e409b497b5 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -78,12 +78,15 @@ $journal_label = $accountingjournalstatic->label; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -// Period by default on transfer -$dates = getDefaultDatesForTransfer(); -$date_start = $dates['date_start']; -$date_end = $dates['date_end']; -$pastmonthyear = $dates['pastmonthyear']; -$pastmonth = $dates['pastmonth']; +if (empty($date_startmonth) || empty($date_endmonth)) +{ + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); + $date_start = $dates['date_start']; + $date_end = $dates['date_end']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 998f34745ac..589bad72749 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -81,12 +81,15 @@ $journal_label = $accountingjournalstatic->label; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -// Period by default on transfer -$dates = getDefaultDatesForTransfer(); -$date_start = $dates['date_start']; -$date_end = $dates['date_end']; -$pastmonthyear = $dates['pastmonthyear']; -$pastmonth = $dates['pastmonth']; +if (empty($date_startmonth) || empty($date_endmonth)) +{ + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); + $date_start = $dates['date_start']; + $date_end = $dates['date_end']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form { diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 9e1668e1a35..96b36fa8fa3 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -146,7 +146,7 @@ if (empty($reshook)) if ($massaction == 'ventil') { $msg = ''; - //print '
' . $langs->trans("Processing") . '...
'; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; $msg .= '
'; @@ -161,7 +161,7 @@ if ($massaction == 'ventil') { if ($monCompte <= 0) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; + $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; } else { $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; @@ -169,14 +169,14 @@ if ($massaction == 'ventil') { $sql .= " WHERE rowid = ".$monId; $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); + $accountventilated->fetch($monCompte, '', 1); dol_syslog('accountancy/supplier/list.php:: sql='.$sql, LOG_DEBUG); if ($db->query($sql)) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; + $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; } else { - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; $ko++; } } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 75c9c731810..9396b02d518 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -44,8 +44,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mem // Security check $result = restrictedArea($user, 'adherent'); -$filter = GETPOST("filter", 'alpha'); -$statut = GETPOST("statut", 'intcomma'); $search = GETPOST("search", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha'); @@ -65,12 +63,19 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha'); $search_type = GETPOST("search_type", 'alpha'); $search_email = GETPOST("search_email", 'alpha'); $search_categ = GETPOST("search_categ", 'int'); +$search_filter = GETPOST("search_filter", 'alpha'); +$search_status = GETPOST("search_status", 'intcomma'); $catid = GETPOST("catid", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); +$filter = GETPOST("filter", 'alpha'); +if ($filter) $search_filter = $filter; // For backward compatibility +$statut = GETPOST("statut", 'alpha'); +if ($statut != '') $search_status = $statut; // For backward compatibility + $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); -if ($statut < -1) $statut = ''; +if ($search_status < -1) $search_status = ''; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -166,6 +171,9 @@ if (empty($reshook)) { // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $statut = ''; + $filter = ''; + $search = ""; $search_ref = ""; $search_lastname = ""; @@ -186,9 +194,10 @@ if (empty($reshook)) { $search_phone_mobile = ''; $search_morphy = ""; $search_categ = ""; + $search_filter = ""; + $search_status = ""; $catid = ""; $sall = ""; - $statut = ''; $toselect = ''; $search_array_options = array(); } @@ -273,7 +282,10 @@ if ($search_categ == -2) $sql .= " AND cm.fk_categorie IS NULL"; $sql .= " AND d.entity IN (".getEntity('adherent').")"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type); -if ($statut != '') $sql .= " AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules +if ($search_filter == 'withoutsubscription') $sql .= " AND (datefin IS NULL OR t.subscription = 0)"; +if ($search_filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)"; +if ($search_filter == 'outofdate') $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; +if ($search_status != '') $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($search_ref) { if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")"; else $sql .= " AND 1 = 2"; // Always wrong @@ -293,8 +305,6 @@ if ($search_phone) $sql .= natural_search("d.phone", $search_phone); if ($search_phone_perso) $sql .= natural_search("d.phone_perso", $search_phone_perso); if ($search_phone_mobile) $sql .= natural_search("d.phone_mobile", $search_phone_mobile); if ($search_country) $sql .= " AND d.country IN (".$search_country.')'; -if ($filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)"; -if ($filter == 'outofdate') $sql .= " AND ((datefin IS NULL OR datefin < '".$db->idate($now)."') AND t.subscription = 1)"; // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -341,13 +351,14 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); $titre = $langs->trans("MembersList"); -if (GETPOSTISSET("statut")) { - if ($statut == '-1,1') { $titre = $langs->trans("MembersListQualified"); } - if ($statut == '-1') { $titre = $langs->trans("MembersListToValid"); } - if ($statut == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); } - if ($statut == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); } - if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } - if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); } +if (GETPOSTISSET("search_status")) { + if ($search_status == '-1,1') { $titre = $langs->trans("MembersListQualified"); } + if ($search_status == '-1') { $titre = $langs->trans("MembersListToValid"); } + if ($search_status == '1' && $filter == '') { $titre = $langs->trans("MembersValidated"); } + if ($search_status == '1' && $filter == 'withoutsubscription') { $titre = $langs->trans("MembersWithSubscriptionToReceive"); } + if ($search_status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); } + if ($search_status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } + if ($search_status == '0') { $titre = $langs->trans("MembersListResiliated"); } } elseif ($action == 'search') { $titre = $langs->trans("MembersListQualified"); } @@ -362,7 +373,6 @@ $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall != "") $param .= "&sall=".urlencode($sall); -if ($statut != "") $param .= "&statut=".urlencode($statut); if ($search_ref) $param .= "&search_ref=".urlencode($search_ref); if ($search_civility) $param .= "&search_civility=".urlencode($search_civility); if ($search_firstname) $param .= "&search_firstname=".urlencode($search_firstname); @@ -380,7 +390,8 @@ if ($search_country != '') $param .= "&search_country=".urlencode($search_countr if ($search_phone != '') $param .= "&search_phone=".urlencode($search_phone); if ($search_phone_perso != '') $param .= "&search_phone_perso=".urlencode($search_phone_perso); if ($search_phone_mobile != '') $param .= "&search_phone_mobile=".urlencode($search_phone_mobile); -if ($filter) $param .= "&filter=".urlencode($filter); +if ($search_filter && $search_filter != '-1') $param .= "&search_filter=".urlencode($search_filter); +if ($search_status != "" && $search_status != '-1') $param .= "&search_status=".urlencode($search_status); if ($search_type > 0) $param .= "&search_type=".urlencode($search_type); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -549,6 +560,8 @@ if (!empty($arrayfields['d.email']['checked'])) { // End of subscription date if (!empty($arrayfields['d.datefin']['checked'])) { print '
'; } // Extra fields @@ -563,7 +576,7 @@ if (!empty($arrayfields['d.datec']['checked'])) { print ''; } -//Birthday +// Birthday if (!empty($arrayfields['d.birth']['checked'])) { print ''; @@ -581,7 +594,7 @@ if (!empty($arrayfields['d.statut']['checked'])) { '1'=>$langs->trans("Validated"), '0'=>$langs->trans("Resiliated") ); - print $form->selectarray('statut', $liststatus, $statut, -2); + print $form->selectarray('search_status', $liststatus, $search_status, -2); print ''; } // Action column diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index b06ee5f227e..364a7854fb7 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -33,10 +33,9 @@ $langs->loadLangs(array("members", "companies")); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$contextpage = GETPOST('contextpage', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'subscriptionlist'; // To manage different context of search $statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1); $search_ref = GETPOST('search_ref', 'alpha'); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 4f6dfff33a5..2dbcfe00015 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -175,10 +175,10 @@ if ($action == 'switch') $db->begin(); $objfrom = new ModeleBoxes($db); - $objfrom->fetch($_GET["switchfrom"]); + $objfrom->fetch(GETPOST("switchfrom", 'int')); $objto = new ModeleBoxes($db); - $objto->fetch($_GET["switchto"]); + $objto->fetch(GETPOST('switchto', 'int')); $resultupdatefrom = 0; $resultupdateto = 0; @@ -192,12 +192,12 @@ if ($action == 'switch') $newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond); $newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".$objfrom->rowid; + $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid); dol_syslog($sql); $resultupdatefrom = $db->query($sql); if (!$resultupdatefrom) { dol_print_error($db); } - $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newsecond)."' WHERE rowid=".$objto->rowid; + $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newsecond)."' WHERE rowid=".((int) $objto->rowid); dol_syslog($sql); $resultupdateto = $db->query($sql); if (!$resultupdateto) { dol_print_error($db); } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 8211fd1cadf..724a978996b 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -558,7 +558,7 @@ $langs->load("companies"); // Managing Director(s) print ''; +print ''; // GDPR contact print ''; +print ''; // Juridical Status print ''."\n"; +if ($mesg) print ''."\n"; print '
'; + $selectarray=array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate")); + print $form->selectarray('search_filter', $selectarray, $search_filter); print ''; print ''; print '
'; -print '
'; @@ -568,7 +568,7 @@ print ''; -print '
'; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index cb48336e72c..9d5dcbc32e3 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -45,7 +45,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'emailcollectorcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $operationid = GETPOST('operationid', 'int'); diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 2ed95ce91b9..d44f96e0877 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -31,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; dol_include_once('/emailcollector/class/emailcollector.class.php'); -if (!$user->admin) accessforbidden(); -if (empty($conf->emailcollector->enabled)) accessforbidden(); - -// Load traductions files required by page +// Load translation files required by page $langs->loadLangs(array("admin", "other")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... @@ -54,7 +51,7 @@ $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')) { $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 (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '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 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -86,11 +83,11 @@ if ($user->socid > 0) // Protection if external user //$result = restrictedArea($user, 'emailcollector', $id, ''); // Initialize array of search criterias -$search_all = GETPOST("search_all", 'alpha'); +$search_all = GETPOST("search_all", 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); } // List of fields to search into when doing a "search in all" @@ -100,25 +97,47 @@ foreach ($object->fields as $key => $val) if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; } -// Definition of fields for list +// Definition of array of fields for columns $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); + if (!empty($val['visible'])) { + $visible = dol_eval($val['visible'], 1); + $arrayfields['t.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'] + ); + } } // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]), + 'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key] + ); + } } } $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$permissiontoread = $user->rights->emailcollector->read; +$permissiontoadd = $user->rights->emailcollector->write; +$permissiontodelete = $user->rights->emailcollector->delete; + +if (!$user->admin) accessforbidden(); +if (empty($conf->emailcollector->enabled)) accessforbidden('Module not enabled'); + /* @@ -182,13 +201,14 @@ foreach ($object->fields as $key => $val) $sql .= 't.'.$key.', '; } // Add fields from extrafields -if (!empty($extrafields->attributes[$object->table_element]['label'])) +if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +} // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; -$sql = preg_replace('/, $/', '', $sql); +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; @@ -197,6 +217,10 @@ foreach ($search as $key => $val) { if ($key == 'status' && $search[$key] == -1) continue; $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if (strpos($object->fields[$key]['type'], 'integer:') === 0) { + if ($search[$key] == '-1') $search[$key] = ''; + $mode_search = 2; + } if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); @@ -208,7 +232,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec $sql .= $hookmanager->resPrint; /* If a group by is required -$sql.= " GROUP BY " +$sql.= " GROUP BY "; foreach ($object->fields as $key => $val) { $sql.='t.'.$key.', '; @@ -216,6 +240,7 @@ foreach ($object->fields as $key => $val) // Add fields from extrafields if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +} // Add where from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook @@ -238,11 +263,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } } // 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) +if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; } else { - $sql .= $db->plimit($limit + 1, $offset); + if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); if (!$resql) @@ -255,7 +280,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) } // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; @@ -291,7 +316,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&co if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); foreach ($search as $key => $val) { - $param .= '&search_'.$key.'='.urlencode($search[$key]); + if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); + else $param .= '&search_'.$key.'='.urlencode($search[$key]); } if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -302,7 +328,7 @@ $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); -if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); +if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -318,13 +344,9 @@ print ''; $linkback = ''.$langs->trans("BackToModuleList").''; -$newcardbutton = ''; -//if ($user->rights->emailcollector->creer) -//{ -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'])); -//} +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) /*$topicmail=""; @@ -355,7 +377,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''."\n"; +print '
'."\n"; // Fields title search @@ -363,11 +385,20 @@ print '
'; foreach ($object->fields as $key => $val) { - $cssforfield = ''; - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; - if (!empty($arrayfields['t.'.$key]['checked'])) print ''; + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -389,11 +420,12 @@ print ''."\n"; print ''; foreach ($object->fields as $key => $val) { - $cssforfield = ''; - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; - if (!empty($arrayfields['t.'.$key]['checked'])) + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + 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"; } @@ -404,6 +436,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; +// Action column print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print ''."\n"; @@ -423,52 +456,46 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co // -------------------------------------------------------------------- $i = 0; $totalarray = array(); -while ($i < min($num, $limit)) +while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); if (empty($obj)) break; // Should not happen // Store properties in $object - $object->id = $obj->rowid; - foreach ($object->fields as $key => $val) - { - if (property_exists($obj, $key)) $object->$key = $obj->$key; - } + $object->setVarsFromFetchObj($obj); // Show here line of result print ''; foreach ($object->fields as $key => $val) { - $cssforfield = ''; - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) $cssforfield .= ($cssforfield ? ' ' : '').'right'; + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - print $object->showOutputField($val, $key, $obj->$key, ''); - print ''; - if (!$i) $totalarray['nbfield']++; - if (!empty($val['isameasure'])) - { - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - $totalarray['val']['t.'.$key] += $obj->$key; - } + print ''; + if ($key == 'status') print $object->getLibStatut(5); + else print $object->showOutputField($val, $key, $object->$key, ''); + print ''; + if (!$i) $totalarray['nbfield']++; + if (!empty($val['isameasure'])) + { + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['val']['t.'.$key] += $object->$key; + } } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -476,13 +503,13 @@ while ($i < min($num, $limit)) 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($obj->rowid, $arrayofselected)) $selected = 1; - print ''; + if (in_array($object->id, $arrayofselected)) $selected = 1; + print ''; } print ''; if (!$i) $totalarray['nbfield']++; - print ''; + print ''."\n"; $i++; } @@ -524,8 +551,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->emailcollector->read; - $delallowed = $user->rights->emailcollector->create; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; print $formfile->showdocuments('massfilesarea_emailcollector', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 931cefb2992..37d1a795428 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -36,7 +36,7 @@ if (!$user->admin) { $langs->loadLangs(array("users", "admin", "other")); $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'auditeventslist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Load variable for pagination diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index d066197b580..ae7faafa937 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -95,7 +95,7 @@ print ''; print ''; print ''; -print '"; +print ''; print ''; print ''; diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 0a118dfe065..6b8fe0ab3b7 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -47,7 +47,12 @@ if ($action == 'set') $gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE"); - if (!$gimcdf && !file_exists($gimcdf)) + if (!$error && $gimcdf && ! preg_match('/\.(dat|mmdb)$/', $gimcdf)) { + setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors'); + $error++; + } + + if (!$error && $gimcdf && !file_exists($gimcdf)) { setEventMessages($langs->trans("ErrorFileNotFound", $gimcdf), null, 'errors'); $error++; @@ -126,7 +131,7 @@ if ($conf->global->GEOIP_VERSION == 'php') { print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb
'; } -print ''; +print ''; print ''; print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); + elseif (strpos($val['type'], 'integer:') === 0) { + print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + print '
'.$langs->trans("ExportCsvSeparator").''."global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\">
'; @@ -148,7 +153,7 @@ print $langs->trans("YouCanDownloadAdvancedDatFileTo", '
'; - print '
'.$langs->trans("TestGeoIPResult", $ip).':'; + print '
'.$langs->trans("TestGeoIPResult", $ip).':'; $ip = '24.24.24.24'; print '
'.$ip.' -> '; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 0662a571cc9..cd9d290b828 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -128,9 +128,10 @@ print ''; print ''; print ''; -print ''; print ''; +print ''; print ''; +if ($user->admin) print ''; print ''."\n"; //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; @@ -178,7 +179,6 @@ if ($result) $found = false; foreach ($modules[$obj->module]->rights as $key => $val) { - $rights_class = $objMod->rights_class; if ($val[4] == $obj->perms && (empty($val[5]) || $val[5] == $obj->subperms)) { $found = true; @@ -209,6 +209,8 @@ if ($result) print ''; print ''; print ''; + // Permission id + if ($user->admin) print ''; print ''."\n"; } @@ -223,15 +225,21 @@ if ($result) // Tick if ($obj->bydefault == 1) { - print ''; print ''; } else { - print ''; print ''; + // Permission id + if ($user->admin) print ''; + print ''."\n"; $i++; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index c7508e996ad..6983c228007 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -23,7 +23,7 @@ /** * \file htdocs/admin/stock.php * \ingroup stock - * \brief Page d'administration/configuration du module gestion de stock + * \brief Page to setup module stock */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 84fe534f473..32567f14074 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -226,6 +226,7 @@ if ($result) } print ''; + print ''; print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 8a6cb9b5e94..3434b03da99 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'assetcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); @@ -65,6 +65,9 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +// Security check +if (!empty($user->socid)) $socid = $user->socid; +$result = restrictedArea($user, 'asset', $id); $permissiontoread = $user->rights->asset->read; $permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 945d893dab7..2cc48489f7f 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -55,6 +55,10 @@ class Asset extends CommonObject public $picto = 'asset'; + const STATUS_DRAFT = 0; + const STATUS_VALIDATED = 1; + + /** * 'type' if the field format. * 'label' the translation key. @@ -390,31 +394,16 @@ class Asset extends CommonObject // phpcs:enable global $langs; - if ($mode == 0 || $mode == 1) - { - if ($status == 1) return $langs->trans('Enabled'); - elseif ($status == 0) return $langs->trans('Disabled'); - } elseif ($mode == 2) - { - if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } elseif ($mode == 3) - { - if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } elseif ($mode == 4) - { - if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } elseif ($mode == 5) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } elseif ($mode == 6) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } + $langs->load("contracts"); + $labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + + $statusType = 'status0'; + if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; + + return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index d2890ea5b19..b43ec8d40cf 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -68,6 +68,10 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +// Security check +if (!empty($user->socid)) $socid = $user->socid; +$result = restrictedArea($user, 'asset', $id); + //if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id); if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/packages/".dol_sanitizeFileName($object->ref); diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php index 2654ebc2d81..801a7c85b36 100644 --- a/htdocs/asset/info.php +++ b/htdocs/asset/info.php @@ -35,15 +35,17 @@ $action = GETPOST('action', 'aZ09'); // Security check if ($user->socid) $socid = $user->socid; -$result = restrictedArea($user, 'asset', $id, ''); +$result = restrictedArea($user, 'asset', $id); $object = new Asset($db); $object->fetch($id); + /* * Actions */ +// None /* diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 975551968b4..d9bfea71510 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -39,7 +39,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'assetslist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'assetlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -73,12 +73,15 @@ if (!$sortorder) $sortorder = "ASC"; // Security check $socid = 0; +if ($user->socid) $socid = $user->socid; if ($user->socid > 0) // Protection if external user { //$socid = $user->socid; accessforbidden(); } -//$result = restrictedArea($user, 'asset', $id,''); +// Security check +$result = restrictedArea($user, 'asset', $id); + // Initialize array of search criterias $search_all = GETPOST("search_all", 'alpha'); diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 8df2a7a5452..f19249ce1d2 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -54,6 +54,10 @@ $extrafields->fetch_name_optionals_label($object->table_element); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) $upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id; +// Security check +if (!empty($user->socid)) $socid = $user->socid; +$result = restrictedArea($user, 'asset', $id); + $permissionnote = 1; //$permissionnote=$user->rights->asset->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index f70e402b667..d0bee7c613c 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -311,6 +311,7 @@ if (GETPOST('withtab', 'alpha')) $param .= '&withtab='.urlencode(GETPOST('withta //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; print ''; +print ''; print '
'; print $langs->trans("RestrictYearToExport").': '; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index ca8e1d5c16a..3b01efdeea8 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -32,7 +32,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search // Security check if (!$user->rights->bookmark->lire) { diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 202a5770f06..616c97f3bb9 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -47,7 +47,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'categorylist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -317,7 +317,7 @@ print ''; $cats = $object->get_filles(); if ($cats < 0) { - dol_print_error($db, $cats->error, $cats->errors); + dol_print_error($db, $object->error, $object->errors); } elseif (count($cats) < 1) { print '
'; @@ -432,7 +432,7 @@ if ($type == Categorie::TYPE_PRODUCT) $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($prods < 0) { - dol_print_error($db, $prods->error, $prods->errors); + dol_print_error($db, $object->error, $object->errors); } else { // Form to add record into a category $showclassifyform = 1; @@ -511,7 +511,7 @@ if ($type == Categorie::TYPE_SUPPLIER) $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($socs < 0) { - dol_print_error($db, $socs->error, $socs->errors); + dol_print_error($db, $object->error, $object->errors); } else { print ''; print ''; @@ -568,7 +568,7 @@ if ($type == Categorie::TYPE_CUSTOMER) $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($socs < 0) { - dol_print_error($db, $socs->error, $socs->errors); + dol_print_error($db, $object->error, $object->errors); } else { print ''; print ''; @@ -627,7 +627,7 @@ if ($type == Categorie::TYPE_MEMBER) $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($prods < 0) { - dol_print_error($db, $prods->error, $prods->errors); + dol_print_error($db, $object->error, $object->errors); } else { print ''; print ''; @@ -686,7 +686,7 @@ if ($type == Categorie::TYPE_CONTACT) $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($contacts < 0) { - dol_print_error($db, $contacts->error, $contacts->errors); + dol_print_error($db, $object->error, $object->errors); } else { print ''; print ''; @@ -748,7 +748,7 @@ if ($type == Categorie::TYPE_ACCOUNT) $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($accounts < 0) { - dol_print_error($db, $accounts->error, $accounts->errors); + dol_print_error($db, $object->error, $object->errors); } else { print ''; print ''; @@ -877,12 +877,14 @@ if ($type == Categorie::TYPE_USER) print ''; print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $newcardbutton, '', $limit); + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($users); + + print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, '', '', $limit); print "
'.$langs->trans("Module").' '.$langs->trans("Default").' '.$langs->trans("Permissions").''.$langs->trans("ID").'
   
'; - print ''.img_edit_remove().''; + print ''; + print ''; + //print img_edit_remove(); + print img_picto('', 'switch_on'); + print ''; print ''; - print img_picto($langs->trans("Active"), 'tick'); + //print img_picto($langs->trans("Active"), 'tick'); print ''; - print ''.img_edit_add().''; + print ''; + print ''; + //print img_edit_add(); + print img_picto('', 'switch_off'); + print ''; print ''; print ' '; @@ -241,6 +249,9 @@ if ($result) // Permission and tick print ''.$perm_libelle.''.$obj->id.'
\n"; - print ''."\n"; + print ''."\n"; if (count($users) > 0) { @@ -916,7 +918,7 @@ if ($type == Categorie::TYPE_USER) } -// List of Project +// List of warehouses if ($type == Categorie::TYPE_WAREHOUSE) { $permission = $user->rights->stock->creer; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 94105c55303..f99cc3cbd16 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -110,8 +110,8 @@ if ($dateselect > 0) $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_h = GETPOST('begin_h', 'int') != '' ?GETPOST('begin_h', 'int') : ($tmparray[0] != '' ? $tmparray[0] : 9); -$end_h = GETPOST('end_h', 'int') ?GETPOST('end_h', 'int') : ($tmparray[1] != '' ? $tmparray[1] : 18); +$begin_h = GETPOST('begin_h', 'int') != '' ? GETPOST('begin_h', 'int') : ($tmparray[0] != '' ? $tmparray[0] : 9); +$end_h = GETPOST('end_h', 'int') ? GETPOST('end_h', 'int') : ($tmparray[1] != '' ? $tmparray[1] : 18); if ($begin_h < 0 || $begin_h > 23) $begin_h = 9; if ($end_h < 1 || $end_h > 24) $end_h = 18; if ($end_h <= $begin_h) $end_h = $begin_h + 1; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f42b82718e6..2c6b7a9dca6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -825,7 +825,7 @@ if (empty($reshook)) $error++; } - if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for proposal. + if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht === '' && $price_ht_devise === '') // Unit price can be 0 but not ''. Also price can be negative for proposal. { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; @@ -966,7 +966,7 @@ if (empty($reshook)) $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) { + if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } // On reevalue prix selon taux tva car taux tva transaction peut etre different diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b447a00c404..b3cb465d70d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -820,7 +820,7 @@ if (empty($reshook)) $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) { + if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 87a3a3c8be2..634a4a0e452 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2012,7 +2012,7 @@ if (empty($reshook)) $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) + if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c144b388093..bbcdd2ab895 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -837,8 +837,7 @@ if ($resql) print ''; print '
'; print $langs->trans('to').' ';*/ - print $langs->trans("Before").' '; - print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1); + print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before")); print '
'.$langs->trans("Alert"); print '
'; print ''; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 2f9182f1693..24650ea343f 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -333,7 +333,7 @@ if ($action == 'new') if ($action == 'reject_check') { $formquestion = array( - array('type' => 'hidden', 'name' => 'bankid', 'value' => GETPOST('lineid')), + array('type' => 'hidden', 'name' => 'bankid', 'value' => GETPOST('lineid', 'int')), array('type' => 'date', 'name' => 'rejectdate_', 'label' => $langs->trans("RejectCheckDate"), 'value' => dol_now()) ); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("RejectCheck"), $langs->trans("ConfirmRejectCheck"), 'confirm_reject_check', $formquestion, '', 1); diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 1370155cb1d..ad105c5e364 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -179,7 +179,7 @@ if ($id > 0 || $ref) }*/ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index c6c0f24497a..94c8c0639e1 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -40,7 +40,7 @@ $status = GETPOST('status', 'int'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 0b0c0eef6d4..4e3d191fdfa 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -86,7 +86,7 @@ if ($id > 0 || $ref) $head = prelevement_prepare_head($object); dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 6e601d82ecd..7783edd4673 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -80,7 +80,7 @@ if ($prev_id > 0 || $ref) $head = prelevement_prepare_head($object); dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 4ff81467d7c..df5118df0cf 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -79,7 +79,7 @@ if ($prev_id > 0 || $ref) $head = prelevement_prepare_head($object); dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 6f9685ece18..36aa4bb8e5c 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -38,7 +38,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlinelist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/orders_list.php similarity index 97% rename from htdocs/compta/prelevement/bons.php rename to htdocs/compta/prelevement/orders_list.php index 69d6412b235..d4f16eab7f6 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -19,9 +19,9 @@ */ /** - * \file htdocs/compta/prelevement/bons.php + * \file htdocs/compta/prelevement/orders_list.php * \ingroup prelevement - * \brief Page liste des bons de prelevements + * \brief Page to list direct debit orders or credit transfer orders */ require '../../main.inc.php'; @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'widthdrawals')); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search // Security check $socid = GETPOST('socid', 'int'); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 7ac512bd32f..23a6042fbf9 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -240,18 +240,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { - //$out.='trans("AddAnAction"),'filenew'); - //$out.=""; + if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : ''); + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&origin=contact&originid='.$object->id.'&percentage=-1&backtopage='.urlencode($_SERVER['PHP_SELF'].($objcon->id > 0 ? '?id='.$objcon->id : '')); + $out .= '&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')); } - - //print '
'; - //print '
'; - $newcardbutton = ''; if (!empty($conf->agenda->enabled)) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f94b19c30b9..e179bd50797 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1911,7 +1911,6 @@ class Contrat extends CommonObject } $statusType = 'status'.$status; - if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; if ($status == self::STATUS_VALIDATED) $statusType = 'status6'; if ($mode == 4 || $mode == 6 || $mode == 7) @@ -2257,7 +2256,7 @@ class Contrat extends CommonObject { while ($obj = $this->db->fetch_object($resql)) { - $this->nb["Contracts"] = $obj->nb; + $this->nb["contracts"] = $obj->nb; } $this->db->free($resql); return 1; diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 098ac586ce1..01cb85008bd 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -46,8 +46,8 @@ if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); require '../../main.inc.php'; -$time = (int) GETPOST('time', 'int'); // Use the time parameter that is always increased by time_update, even if call is late -//$time=dol_now(); +//$time = (int) GETPOST('time', 'int'); // Use the time parameter that is always increased by time_update, even if call is late +$time=dol_now(); $action = GETPOST('action', 'aZ09'); $listofreminderids = GETPOST('listofreminderids', 'aZ09'); @@ -58,19 +58,20 @@ $listofreminderids = GETPOST('listofreminderids', 'aZ09'); if ($action == 'stopreminder') { dol_syslog("Clear notification for listofreminderids=".$listofreminderids); - $listofreminderidsarray = explode('-', GETPOST('listofreminderids', 'aZ09')); + $listofreminderid = GETPOST('listofreminderids', 'intcomma'); // Set the reminder as done - foreach ($listofreminderidsarray as $listofreminderid) { - if (empty($listofreminderid)) continue; - //$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'action_reminder WHERE rowid = '.$listofreminderid.' AND fk_user = '.$user->id; - $sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm_reminder SET status = 1'; - $sql .= ' WHERE status = 0 AND rowid = '.$listofreminderid.' AND fk_user = '.$user->id.' AND entity = '.$conf->entity; - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - } + //foreach ($listofreminderidsarray as $listofreminderid) { + // if (empty($listofreminderid)) continue; + //$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'action_reminder WHERE rowid = '.$listofreminderid.' AND fk_user = '.$user->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm_reminder SET status = 1'; + $sql .= ' WHERE status = 0 AND rowid IN ('.$db->sanitize($db->escape($listofreminderid)).')'; + $sql .= ' AND fk_user = '.$user->id.' AND entity = '.$conf->entity; + $resql = $db->query($sql); + if (!$resql) { + dol_print_error($db); } + //} include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -90,7 +91,7 @@ if ($action == 'stopreminder') { * View */ -top_httphead('text/html'); // TODO Use a json mime type +top_httphead('application/json'); global $user, $db, $langs, $conf; @@ -102,9 +103,9 @@ $eventfound = array(); // TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when several tabs are opened. // This need to extend period to be sure to not miss and save in session what we notified to avoid duplicate. -if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow', 'int')) +if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow', 'int')) { - $time_update = (int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined + /*$time_update = (int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined if (!empty($_SESSION['auto_check_events_not_before'])) { // We start scan from the not before so if two tabs were opend at differents seconds and we close one (so the js timer), @@ -121,6 +122,7 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow } $_SESSION['auto_check_events_not_before'] = $time + $time_update; + */ // Force save of the session change we did. // WARNING: Any change in sessions after that will not be saved ! @@ -131,19 +133,19 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.$_SESSION['auto_check_events_not_before']); - $sql = 'SELECT a.id, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder'; + $sql = 'SELECT a.id as id_agenda, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder'; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; if (!empty($user->conf->MAIN_USER_WANT_ALL_EVENTS_NOTIFICATIONS)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; $sql .= ' WHERE a.code <> "AC_OTH_AUTO"'; $sql .= ' AND ('; $sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; - $sql .= " OR (a.datep BETWEEN '".$db->idate($starttime)."' AND '".$db->idate($time + $time_update - 1)."')"; $sql .= ' )'; } else { $sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; $sql .= " AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; } + $sql .= $db->order('datep', 'ASC'); $sql .= ' LIMIT 10'; // Avoid too many notification at once $resql = $db->query($sql); @@ -153,8 +155,8 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow // Message must be formated and translated to be used with javascript directly $event = array(); $event['type'] = 'agenda'; - $event['id'] = $obj->id; $event['id_reminder'] = $obj->id_reminder; + $event['id_agenda'] = $obj->id_agenda; $event['id_user'] = $obj->id_user_reminder; $event['code'] = $obj->code; $event['label'] = $obj->label; @@ -162,11 +164,11 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow $event['reminder_date_formated'] = dol_print_date($db->jdate($obj->dateremind), 'standard'); $event['event_date_start_formated'] = dol_print_date($db->jdate($obj->datep), 'standard'); - $eventfound[] = $event; + $eventfound[$obj->id_agenda] = $event; } } else { dol_syslog("Error sql = ".$db->lasterror(), LOG_ERR); } } -print json_encode($eventfound); +print json_encode(array('pastreminders'=>$eventfound, 'nextreminder'=>'')); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 51719ec6c15..80589e4c4f3 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -143,10 +143,10 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box global $conf; // Recupere liste des boites d'un user si ce dernier a sa propre liste - $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user"; + $sql = "SELECT b.rowid as id, b.box_id, b.position, b.box_order, b.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."boxes as b"; $sql .= " WHERE b.entity = ".$conf->entity; - $sql .= " AND b.rowid = ".$rowid; + $sql .= " AND b.rowid = ".((int) $rowid); dol_syslog(get_class($this)."::fetch rowid=".$rowid); $resql = $this->db->query($sql); @@ -155,7 +155,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box $obj = $this->db->fetch_object($resql); if ($obj) { - $this->rowid = $obj->rowid; + $this->id = $obj->id; + $this->rowid = $obj->id; // For backward compatibility $this->box_id = $obj->box_id; $this->position = $obj->position; $this->box_order = $obj->box_order; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 38596f2a265..384c778d602 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6639,7 +6639,7 @@ abstract class CommonObject // Show only the key field in params if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue; - // @todo Add test also on 'enabled' (different than 'list' that is 'visibility') + // Test on 'enabled' ('enabled' is different than 'list' = 'visibility') $enabled = 1; if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) { @@ -6684,13 +6684,17 @@ abstract class CommonObject switch ($mode) { case "view": - $value = $this->array_options["options_".$key.$keysuffix]; + $value = $this->array_options["options_".$key.$keysuffix]; // Value may be clean or formated later break; case "create": case "edit": - $check = 'restricthtml'; - // TODO Use check = 'alphahtml' or 'int' for some types - $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, $check); // GETPOST can get value from GET, POST or setup of default values. + // We get the value of property found with GETPOST so it takes into account: + // default values overwrite, restore back to list link, ... (but not 'default value in database' of field) + $check = 'alphanohtml'; + if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text'))) { + $check = 'restricthtml'; + } + $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, $check, 3); // GETPOST can get value from GET, POST or setup of default values overwrite. // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) { @@ -6755,18 +6759,18 @@ abstract class CommonObject { $datenotinstring = $this->db->jdate($datenotinstring); } - $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring; + $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring; } // Convert float submited string into real php numeric (value in memory must be a php numeric) if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double'))) { - $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix, 'alpha', 3)) : $this->array_options['options_'.$key]; + $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? price2num($value) : $this->array_options['options_'.$key]; } - // HTML, select, integer and text add default value - if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int'))) + + // HTML, text, select, integer and varchar: take into account default value in database if in create mode + if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int'))) { - if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'restricthtml', 3) : $extrafields->attributes[$this->table_element]['default'][$key]; - else $value = $this->array_options['options_'.$key]; + if ($action == 'create') $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : $extrafields->attributes[$this->table_element]['default'][$key]; } $labeltoshow = $langs->trans($label); @@ -6800,6 +6804,8 @@ abstract class CommonObject $out .= $extrafields->showOutputField($key, $value); break; case "create": + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); + break; case "edit": $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); break; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 678560b622e..e17bfbc55d4 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -132,6 +132,19 @@ class ExtraFields */ public $attribute_list; + /** + * @var array Array to store if field is summable + * @deprecated + */ + public $attribute_totalizable; + + /** + * @var array Array to store entity id of extrafield + * @deprecated + */ + public $attribute_entityid; + + /** * @var array New array to store extrafields definition */ diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 8614d4ee433..54406b1075b 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -202,7 +202,7 @@ class FormActions $newcardbutton = ''; if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { - $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); + $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&origin='.urlencode($typeelement).'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); } diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index 60bf6474031..06bc79804bf 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -120,7 +120,8 @@ class Menu $nb = 0; foreach ($this->liste as $val) { - if (!empty($val['enabled'])) $nb++; + //if (dol_eval($val['enabled'], 1)) $nb++; + if (!empty($val['enabled'])) $nb++; // $val['enabled'] is already evaluated to 0 or 1, no need for dol_eval() } return $nb; } diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 277bd5b4904..a95e3556405 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -74,10 +74,13 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP $.ajax("", { type: "post", // Usually post or get async: true, - data: { time_js_next_test: time_js_next_test }, + data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: 'notrequired' }, + dataType: "json", success: function (result) { - var arr = JSON.parse(result); - if (arr.length > 0) { + console.log(result); + var arrayofpastreminders = Object.values(result.pastreminders); + console.log("arrayofpastreminders.length"+arrayofpastreminders.length); + if (arrayofpastreminders && arrayofpastreminders.length > 0) { var audio = null; global->AGENDA_REMINDER_BROWSER_SOUND)) { @@ -85,48 +88,52 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP } ?> var listofreminderids = ''; + var noti = [] - $.each(arr, function (index, value) { + $.each(arrayofpastreminders, function (index, value) { + console.log(value); var url = "notdefined"; var title = "Not defined"; - var body = value['type'] + ': ' + value['label']; - if (value['type'] == 'agenda' && value['location'] != null && value['location'] != '') { - body += '\n' + value['location']; + var body = value.label; + if (value.type == 'agenda' && value.location != null && value.location != '') { + body += '\n' + value.location; } - if(value['type'] == 'agenda' && (value['event_date_start_formated'] != null || event_date_start_formated['event_date_start'] != '')) { - body += '\n' + value['event_date_start_formated']; + if (value.type == 'agenda' && (value.event_date_start_formated != null || value.event_date_start_formated['event_date_start'] != '')) { + body += '\n' + value.event_date_start_formated; } - if (value['type'] == 'agenda') + if (value.type == 'agenda') { - url = '' + value['id']; - title = 'trans('Agenda') ?>'; + url = '' + value.id_agenda; + title = 'trans('EventReminder') ?>'; } var extra = { icon: '', + //image: '', body: body, - tag: value['id'] + tag: value.id_agenda, + requireInteraction: true }; // We release the notify console.log("Send notification on browser"); - var noti = new Notification(title, extra); + noti[index] = new Notification(title, extra); if (index==0 && audio) { audio.play(); } - if (noti) { - noti.onclick = function (event) { + if (noti[index]) { + noti[index].onclick = function (event) { console.log("A click on notification on browser has been done"); event.preventDefault(); // prevent the browser from focusing the Notification's tab window.focus(); window.open(url, '_blank'); - noti.close(); + noti[index].close(); }; - listofreminderids = listofreminderids + '-' + value['id_reminder'] + listofreminderids = (listofreminderids == '' ? '' : listofreminderids + ',') + value.id_reminder } }); @@ -135,8 +142,10 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP $.ajax(""+listofreminderids, { type: "post", // Usually post or get async: true, - data: { time_js_next_test: time_js_next_test } - }); + data: { time_js_next_test: time_js_next_test, token: 'notrequired' } + }); + } else { + console.log("No past reminder found, next try at "+time_js_next_test); } } }); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e9375f91e30..f34f2997af2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -389,7 +389,6 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null if ($qualified) { - //var_dump($user->default_values[$relativepathstring][$defkey]['createform']); if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname])) { $out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname]; @@ -3896,20 +3895,21 @@ function dol_print_error($db = '', $error = '', $errors = null) $out = ''; $syslog = ''; - // Si erreur intervenue avant chargement langue + // If error occurs before the $lang object was loaded if (!$langs) { require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; $langs = new Translate('', $conf); $langs->load("main"); } - // Load translation files required by the page + + // Load translation files required by the error messages $langs->loadLangs(array('main', 'errors')); if ($_SERVER['DOCUMENT_ROOT']) // Mode web { $out .= $langs->trans("DolibarrHasDetectedError").".
\n"; - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $out .= "You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.
\n"; + if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $out .= "You use an experimental or develop level of features, so please do NOT report any bugs or vulnerability, except if problem is confirmed after moving option MAIN_FEATURES_LEVEL back to 0.
\n"; $out .= $langs->trans("InformationToHelpDiagnose").":
\n"; $out .= "".$langs->trans("Date").": ".dol_print_date(time(), 'dayhourlog')."
\n"; @@ -3919,7 +3919,7 @@ function dol_print_error($db = '', $error = '', $errors = null) { $out .= "".$langs->trans("PHP").": ".phpversion()."
\n"; } - $out .= "".$langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."
\n"; + $out .= "".$langs->trans("Server").": ".dol_htmlentities($_SERVER["SERVER_SOFTWARE"])."
\n"; if (function_exists("php_uname")) { $out .= "".$langs->trans("OS").": ".php_uname()."
\n"; @@ -3927,8 +3927,8 @@ function dol_print_error($db = '', $error = '', $errors = null) $out .= "".$langs->trans("UserAgent").": ".dol_htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_COMPAT, 'UTF-8')."
\n"; $out .= "
\n"; $out .= "".$langs->trans("RequestedUrl").": ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."
\n"; - $out .= "".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"]) ?dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."
\n"; - $out .= "".$langs->trans("MenuManager").": ".(isset($conf->standard_menu) ? $conf->standard_menu : '')."
\n"; + $out .= "".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."
\n"; + $out .= "".$langs->trans("MenuManager").": ".(isset($conf->standard_menu) ? dol_htmlentities($conf->standard_menu) : '')."
\n"; $out .= "
\n"; $syslog .= "url=".dol_escape_htmltag($_SERVER["REQUEST_URI"]); $syslog .= ", query_string=".dol_escape_htmltag($_SERVER["QUERY_STRING"]); @@ -3948,9 +3948,9 @@ function dol_print_error($db = '', $error = '', $errors = null) if ($_SERVER['DOCUMENT_ROOT']) // Mode web { $out .= "".$langs->trans("DatabaseTypeManager").": ".$db->type."
\n"; - $out .= "".$langs->trans("RequestLastAccessInError").": ".($db->lastqueryerror() ?dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError"))."
\n"; - $out .= "".$langs->trans("ReturnCodeLastAccessInError").": ".($db->lasterrno() ?dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError"))."
\n"; - $out .= "".$langs->trans("InformationLastAccessInError").": ".($db->lasterror() ?dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError"))."
\n"; + $out .= "".$langs->trans("RequestLastAccessInError").": ".($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError"))."
\n"; + $out .= "".$langs->trans("ReturnCodeLastAccessInError").": ".($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError"))."
\n"; + $out .= "".$langs->trans("InformationLastAccessInError").": ".($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError"))."
\n"; $out .= "
\n"; } else // Mode CLI { @@ -3997,8 +3997,14 @@ function dol_print_error($db = '', $error = '', $errors = null) $out .= "
\n"; } - if (empty($dolibarr_main_prod)) print $out; - else { + // Return a http error code if possible + if (! headers_sent()) { + http_response_code(500); + } + + if (empty($dolibarr_main_prod)) { + print $out; + } else { // This should not happen, except if there is a bug somewhere. Enabled and check log in such case. print 'This website or feature is currently temporarly not available or failed after a technical error.

This may be due to a maintenance operation. Current status of operation are on next line...

'."\n"; $langs->load("errors"); @@ -4006,7 +4012,7 @@ function dol_print_error($db = '', $error = '', $errors = null) print $langs->trans("YouCanSetOptionDolibarrMainProdToZero"); define("MAIN_CORE_ERROR", 1); } - //else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.'; + dol_syslog("Error ".$syslog, LOG_ERR); } @@ -6126,7 +6132,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $birthday = dol_print_date($object->birth, 'day'); - if (is_object($object) && $object->element == 'adherent' && $object->id > 0) + if (is_object($object) && ($object->element == 'adherent' || $object->element == 'member') && $object->id > 0) { $substitutionarray['__MEMBER_ID__'] = (isset($object->id) ? $object->id : ''); if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); @@ -7728,7 +7734,7 @@ function dol_getmypid() * If param $mode is 2, can contains a list of int id separated by comma like "1,3,4" * If param $mode is 3, can contains a list of string separated by comma like "a,b,c" * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4') - * 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '1,3,4') for search into a multiselect string ('1,2') + * 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4' * @param integer $nofirstand 1=Do not output the first 'AND' * @return string $res The statement to append to the SQL query */ @@ -7753,11 +7759,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $res = ''; if (!is_array($fields)) $fields = array($fields); - $nboffields = count($fields); - $end2 = count($crits); $j = 0; foreach ($crits as $crit) { + $crit = trim($crit); $i = 0; $i2 = 0; $newres = ''; foreach ($fields as $field) @@ -7765,10 +7770,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) if ($mode == 1) { $operator = '='; - $newcrit = preg_replace('/([<>=]+)/', '', trim($crit)); + $newcrit = preg_replace('/([<>=]+)/', '', $crit); $reg = array(); - preg_match('/([<>=]+)/', trim($crit), $reg); + preg_match('/([<>=]+)/', $crit, $reg); if ($reg[1]) { $operator = $reg[1]; @@ -7778,7 +7783,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $numnewcrit = price2num($newcrit); if (is_numeric($numnewcrit)) { - $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit; + $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$db->sanitize($numnewcrit); // should be a numeric } else { $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false } @@ -7786,41 +7791,45 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) } } elseif ($mode == 2 || $mode == -2) { - $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '')."IN (".$db->escape(trim($crit)).")"; + $crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer + $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : ''); + $newres .= $crit ? "IN (".$db->sanitize($db->escape($crit)).")" : "IN (0)"; if ($mode == -2) $newres .= ' OR '.$field.' IS NULL'; $i2++; // a criteria was added to string } elseif ($mode == 3 || $mode == -3) { - $tmparray = explode(',', trim($crit)); + $tmparray = explode(',', $crit); if (count($tmparray)) { $listofcodes = ''; foreach ($tmparray as $val) { + $val = trim($val); if ($val) { $listofcodes .= ($listofcodes ? ',' : ''); - $listofcodes .= "'".$db->escape(trim($val))."'"; + $listofcodes .= "'".$db->escape($val)."'"; } } - $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$listofcodes.")"; + $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes).")"; $i2++; // a criteria was added to string } if ($mode == -3) $newres .= ' OR '.$field.' IS NULL'; } elseif ($mode == 4) { - $tmparray = explode(',', trim($crit)); + $tmparray = explode(',', $crit); if (count($tmparray)) { $listofcodes = ''; foreach ($tmparray as $val) { + $val = trim($val); if ($val) { - $newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape(trim($val)).',%\''; - $newres .= ' OR '.$field.' = \''.$db->escape(trim($val)).'\''; - $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).'\''; - $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).',%\''; + $newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape($val).',%\''; + $newres .= ' OR '.$field.' = \''.$db->escape($val).'\''; + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape($val).'\''; + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape($val).',%\''; $newres .= ')'; $i2++; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 7b0042cf55a..b5a51032bdd 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1182,6 +1182,7 @@ function check_value($mask, $value) $hasglobalcounter = false; // Extract value for mask counter, mask raz and mask offset + $reg = array(); if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) { $masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : ''); @@ -1192,12 +1193,12 @@ function check_value($mask, $value) $masktri = '00000'; $maskcounter = '00000'; } - $maskraz = -1; $maskoffset = 0; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter + $regClientRef = array(); if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) { $maskrefclient = $regClientRef[1].$regClientRef[2]; diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index bdd5f622838..e4dfa3a0830 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -245,9 +245,16 @@ function dol_json_decode($json, $assoc = false) $out = _unval($out); + $array = array(); + // Return an array - if ($out != '') eval('$array = '.$out.';'); - else $array = array(); + if ($out != '') { + try { + eval('$array = '.$out.';'); + } catch (Exception $e) { + $array = array(); + } + } // Return an object if (!$assoc) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 66729369af1..826e2d6bc98 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -431,6 +431,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no //TODO Add limit in nb of results $sql .= $db->order($sortfield_new, $sortorder); + dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -529,6 +530,8 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no $out .= '
'; $out .= ''; + $out .= ''; + if ($objcon && get_class($objcon) == 'Contact' && (is_null($filterobj) || get_class($filterobj) == 'Societe')) { diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index b5f96655ed7..b1b5c708249 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -322,13 +322,20 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->rights->banque->lire', '', 2, 1, __ENTITY__); --- Withdrawal -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=withdraw', 'StandingOrders', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__); +-- PaymentByDirectDebit +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=withdraw', 'PaymentByDirectDebit', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2502__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/create.php?mainmenu=bank&leftmenu=withdraw', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2503__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/bons.php?mainmenu=bank&leftmenu=withdraw', 'WithdrawalsReceipts', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2503__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/orders_list.php?mainmenu=bank&leftmenu=withdraw', 'WithdrawalsReceipts', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/list.php?mainmenu=bank&leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?mainmenu=bank&leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?mainmenu=bank&leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); +-- PaymentByCreditTransfer +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2510__+MAX_llx_menu__, 'accountancy', 'banktransfer', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'PaymentByBankTransfer', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2512__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/create.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2513__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/orders_list.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'WithdrawalsReceipts', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2514__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/list.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2516__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/rejets.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2517__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/stats.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); -- Bank insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?mainmenu=bank&action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); @@ -382,8 +389,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4202__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/list.php', 'List', 1, 'members', '$user->rights->adherent->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4203__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=-1', 'MenuMembersToValidate', 2, 'members', '$user->rights->adherent->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4204__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=1', 'MenuMembersValidated', 2, 'members', '$user->rights->adherent->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=1&filter=outofdate', 'MenuMembersNotUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=1&filter=uptodate', 'MenuMembersUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4204__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=1&filter=withoutsubscription', 'WithoutSubscription', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4204__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=1&filter=outofdate', 'UpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4204__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=1&filter=uptodate', 'OutOfDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4207__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&leftmenu=members&statut=0', 'MenuMembersResiliated', 2, 'members', '$user->rights->adherent->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4208__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/stats/geo.php?mainmenu=members&leftmenu=members&mode=memberbycountry', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled', __HANDLER__, 'left', 4502__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/htpasswd.php?mainmenu=members&leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 2, 9, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index a9d05fe4b5c..5b7aa913350 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -68,14 +68,14 @@ class MenuManager global $conf, $user, $langs; // On sauve en session le menu principal choisi - if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"] = $_GET["mainmenu"]; - if (isset($_GET["idmenu"])) $_SESSION["idmenu"] = $_GET["idmenu"]; + if (GETPOSTISSET("mainmenu")) $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09'); + if (GETPOSTISSET("idmenu")) $_SESSION["idmenu"] = GETPOST("idmenu", 'int'); // Read mainmenu and leftmenu that define which menu to show - if (isset($_GET["mainmenu"])) + if (GETPOSTISSET("mainmenu")) { // On sauve en session le menu principal choisi - $mainmenu = $_GET["mainmenu"]; + $mainmenu = GETPOST("mainmenu", 'aZ09'); $_SESSION["mainmenu"] = $mainmenu; $_SESSION["leftmenuopened"] = ""; } else { @@ -84,10 +84,10 @@ class MenuManager } if (!empty($forcemainmenu)) $mainmenu = $forcemainmenu; - if (isset($_GET["leftmenu"])) + if (GETPOSTISSET("leftmenu")) { // On sauve en session le menu principal choisi - $leftmenu = $_GET["leftmenu"]; + $leftmenu = GETPOST("leftmenu", 'aZ09'); $_SESSION["leftmenu"] = $leftmenu; if ($_SESSION["leftmenuopened"] == $leftmenu) // To collapse diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2c3549cdea9..7e808102bdd 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -447,6 +447,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Show personalized menus $menuArbo = new Menubase($db, 'eldy'); + $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'eldy', $tabMenu); // Return tabMenu with only top entries $num = count($newTabMenu); @@ -455,34 +456,39 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = //var_dump($type_user.' '.$newTabMenu[$i]['url'].' '.$showmode.' '.$newTabMenu[$i]['perms']); $idsel = (empty($newTabMenu[$i]['mainmenu']) ? 'none' : $newTabMenu[$i]['mainmenu']); + $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); + + // url = url from host, shorturl = relative path into dolibarr sources + $url = $shorturl = $newTabMenu[$i]['url']; + if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) // Do not change url content for external links + { + $tmp = explode('?', $newTabMenu[$i]['url'], 2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1]) ? $tmp[1] : ''); + + if (!preg_match('/mainmenu/i', $param) || !preg_match('/leftmenu/i', $param)) $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad + $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); + //$shorturl = $shorturl.($param?'?'.$param:''); + $shorturl = $url; + if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/', '', $shorturl); + } + $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal); if ($showmode == 1) { - $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); - - // url = url from host, shorturl = relative path into dolibarr sources - $url = $shorturl = $newTabMenu[$i]['url']; - if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) // Do not change url content for external links - { - $tmp = explode('?', $newTabMenu[$i]['url'], 2); - $url = $shorturl = $tmp[0]; - $param = (isset($tmp[1]) ? $tmp[1] : ''); - - if (!preg_match('/mainmenu/i', $param) || !preg_match('/leftmenu/i', $param)) $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; - //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad - $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); - //$shorturl = $shorturl.($param?'?'.$param:''); - $shorturl = $url; - if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/', '', $shorturl); - } - // Define the class (top menu selected or not) if (!empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname = 'class="tmenusel"'; elseif (!empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname = 'class="tmenusel"'; else $classname = 'class="tmenu"'; - } elseif ($showmode == 2) $classname = 'class="tmenu"'; + } elseif ($showmode == 2) { + $classname = 'class="tmenu"'; + } - $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target'] ? $newTabMenu[$i]['target'] : $atarget), ($newTabMenu[$i]['mainmenu'] ? $newTabMenu[$i]['mainmenu'] : $newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu'] ? $newTabMenu[$i]['leftmenu'] : ''), $newTabMenu[$i]['position'], $id, $idsel, $classname); + $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target'] ? $newTabMenu[$i]['target'] : $atarget), + ($newTabMenu[$i]['mainmenu'] ? $newTabMenu[$i]['mainmenu'] : $newTabMenu[$i]['rowid']), + ($newTabMenu[$i]['leftmenu'] ? $newTabMenu[$i]['leftmenu'] : ''), + $newTabMenu[$i]['position'], $id, $idsel, $classname); } // Sort on position @@ -517,7 +523,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = print "\n".''."\n"; print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo nohover"', 1); - print ''."\n"; print_end_menu_entry(4); @@ -1482,7 +1487,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); - $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire); $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire); $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire); @@ -1497,7 +1502,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); - $newmenu->add("/compta/prelevement/bons.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); @@ -1874,8 +1879,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("MenuMembersUpToDate"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("MenuMembersNotUpToDate"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire); $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 5a33d0b323b..c3e6a0bce05 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -66,15 +66,15 @@ class MenuManager { global $conf, $user, $langs; - // On sauve en session le menu principal choisi - if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"] = $_GET["mainmenu"]; - if (isset($_GET["idmenu"])) $_SESSION["idmenu"] = $_GET["idmenu"]; + // We save into session the main menu selected + if (GETPOSTISSET("mainmenu")) $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09'); + if (GETPOSTISSET("idmenu")) $_SESSION["idmenu"] = GETPOST("idmenu", 'int'); - // Read mainmenu and leftmenu that define which menu to show - if (isset($_GET["mainmenu"])) + // Read now mainmenu and leftmenu that define which menu to show + if (GETPOSTISSET("mainmenu")) { // On sauve en session le menu principal choisi - $mainmenu = $_GET["mainmenu"]; + $mainmenu = GETPOST("mainmenu", 'aZ09'); $_SESSION["mainmenu"] = $mainmenu; $_SESSION["leftmenuopened"] = ""; } else { @@ -83,10 +83,10 @@ class MenuManager } if (!empty($forcemainmenu)) $mainmenu = $forcemainmenu; - if (isset($_GET["leftmenu"])) + if (GETPOSTISSET("leftmenu")) { // On sauve en session le menu principal choisi - $leftmenu = $_GET["leftmenu"]; + $leftmenu = GETPOST("leftmenu", 'aZ09'); $_SESSION["leftmenu"] = $leftmenu; if ($_SESSION["leftmenuopened"] == $leftmenu) // To collapse @@ -147,7 +147,6 @@ class MenuManager if ($mode == 'top') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); if ($mode == 'left') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); } - if ($mode == 'topnb') { print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // no output diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 973e7ae536a..f4691ceb611 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -329,7 +329,6 @@ class ExportCsv extends ModeleExports global $conf; $addquote = 0; - // Rule Dolibarr: No HTML //print $charset.' '.$newvalue."\n"; //$newvalue=dol_string_nohtmltag($newvalue,0,$charset); diff --git a/htdocs/core/modules/livraison/doc/pdf_storm.modules.php b/htdocs/core/modules/livraison/doc/pdf_storm.modules.php new file mode 100644 index 00000000000..2019de478eb --- /dev/null +++ b/htdocs/core/modules/livraison/doc/pdf_storm.modules.php @@ -0,0 +1,1078 @@ + + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2008 Chiptronik + * Copyright (C) 2011-2019 Philippe Grand + * Copyright (C) 2015 Marcos García + * Copyright (C) 2020 John BOTELLA + + * 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 . + * or see https://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/livraison/doc/pdf_storm.modules.php + * \ingroup livraison + * \brief File of class to manage receving receipts with template Storm + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; +require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + + +/** + * Class to build Delivery Order documents with storm model + */ +class pdf_storm extends ModelePDFDeliveryOrder +{ + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.5 = array(5, 5) + */ + public $phpmin = array(5, 5); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + /** + * @var int page_largeur + */ + public $page_largeur; + + /** + * @var int page_hauteur + */ + public $page_hauteur; + + /** + * @var array format + */ + public $format; + + /** + * @var int marge_gauche + */ + public $marge_gauche; + + /** + * @var int marge_droite + */ + public $marge_droite; + + /** + * @var int marge_haute + */ + public $marge_haute; + + /** + * @var int marge_basse + */ + public $marge_basse; + + /** + * Issuer + * @var Societe Object that emits + */ + public $emetteur; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc; + + // Translations + $langs->loadLangs(array("main", "bills", "sendings", "companies")); + + $this->db = $db; + $this->name = "Storm"; + $this->description = $langs->trans("DocumentModelStorm"); + + // Page size for A4 format + $this->type = 'pdf'; + $formatarray = pdf_getFormat(); + $this->page_largeur = $formatarray['width']; + $this->page_hauteur = $formatarray['height']; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + + $this->option_logo = 1; // Display logo FAC_PDF_LOGO + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; // Display product-service code + + // Get source company + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined + + $this->tva = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; + } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Livraison $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO + */ + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { + // phpcs:enable + global $user, $langs, $conf, $mysoc, $hookmanager; + + if (!is_object($outputlangs)) $outputlangs = $langs; + // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; + + // Load translation files required by the page + $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries")); + + if ($conf->expedition->dir_output) + { + $object->fetch_thirdparty(); + + // Definition of $dir and $file + if ($object->specimen) + { + $dir = $conf->expedition->dir_output."/receipt"; + $file = $dir."/SPECIMEN.pdf"; + } + else { + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->expedition->dir_output."/receipt/".$objectref; + $file = $dir."/".$objectref.".pdf"; + } + + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return 0; + } + } + + if (file_exists($dir)) + { + // Add pdfgeneration hook + if (!is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('pdfgeneration')); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + global $action; + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + + $nblines = count($object->lines); + + + // Loop on each lines to detect if there is at least one image to show + $realpatharray=array(); + $this->atleastonephoto = false; + if (! empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE)) + { + $objphoto = new Product($this->db); + + for ($i = 0 ; $i < $nblines ; $i++) + { + if (empty($object->lines[$i]->fk_product)) continue; + + $objphoto->fetch($object->lines[$i]->fk_product); + + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + } + else { + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; // alternative + } + + $arephoto = false; + foreach ($pdir as $midir) + { + if (! $arephoto) + { + $dir = $conf->product->dir_output.'/'.$midir; + + foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) + { + if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo + { + if ($obj['photo_vignette']) + { + $filename= $obj['photo_vignette']; + } + else { + $filename=$obj['photo']; + } + } + else { + $filename=$obj['photo']; + } + + $realpath = $dir.$filename; + $arephoto = true; + $this->atleastonephoto = true; + } + } + } + + if ($realpath && $arephoto) $realpatharray[$i]=$realpath; + } + } + + if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol; + + + + // Create pdf instance + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 30; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + $pdf->SetAutoPageBreak(1, 0); + + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + // Set path to the background PDF File + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + { + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $tplidx = $pdf->importPage(1); + } + + // We get the shipment that is the origin of delivery receipt + $expedition = new Expedition($this->db); + $result = $expedition->fetch($object->origin_id); + // Now we get the order that is origin of shipment + $commande = new Commande($this->db); + if ($expedition->origin == 'commande') + { + $commande->fetch($expedition->origin_id); + } + $object->commande = $commande; // We set order of shipment onto delivery. + $object->commande->loadExpeditions(); + + + $pdf->Open(); + $pagenb = 0; + $pdf->SetDrawColor(128, 128, 128); + + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); + $pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + + + // New page + $pdf->AddPage(); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; + $this->_pagehead($pdf, $object, 1, $outputlangs); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0, 0, 0); + + $tab_top = 90; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); + $tab_height = 130; + $tab_height_newpage = 150; + + $this->posxdesc = $this->marge_gauche + 1; + + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms = $nexY - $tab_top; + + // Rect takes a length in 3rd parameter + $pdf->SetDrawColor(192, 192, 192); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); + + $tab_top = $nexY + 6; + $height_incoterms += 4; + } + } + + // display note + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + + // Extrafields in note + $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); + if (!empty($extranote)) + { + $notetoshow = dol_concatdesc($notetoshow, $extranote); + } + + if (!empty($notetoshow)) + { + $tab_top = 88 + $height_incoterms; + + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $nexY = $pdf->GetY(); + $height_note = $nexY - $tab_top; + + // Rect takes a length in 3rd parameter + $pdf->SetDrawColor(192, 192, 192); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); + + $tab_height = $tab_height - $height_note; + $tab_top = $nexY + 6; + } + else { + $height_note = 0; + } + + // Use new auto column system + $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); + + // Table simulation to know the height of the title line + $pdf->startTransaction(); + $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, 0); + $pdf->rollbackTransaction(true); + + $iniY = $tab_top + $this->tabTitleHeight + 2; + $curY = $tab_top + $this->tabTitleHeight + 2; + $nexY = $tab_top + $this->tabTitleHeight + 2; + + // Loop on each lines + for ($i = 0; $i < $nblines; $i++) + { + // Fetch optionals + if (empty($object->lines[$i]->array_options)){ + $object->lines[$i]->fetch_optionals(); + } + + $curY = $nexY; + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0, 0, 0); + + // Define size of image if we need it + $imglinesize=array(); + if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + + + $pdf->setTopMargin($tab_top_newpage); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); + + // Description of product line + $curX = $this->posxdesc - 1; + + $showpricebeforepagebreak = 1; + + $posYAfterImage=0; + $posYAfterDescription=0; + if ($this->getColumnStatus('photo')) + { + // We start with Photo of product line + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + { + $pdf->AddPage('', '', true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposbefore+1); + + $curY = $tab_top_newpage; + + // Allows data in the first page if description is long enough to break in multiples pages + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + $showpricebeforepagebreak = 1; + else $showpricebeforepagebreak = 0; + } + + + if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) + { + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + // $pdf->Image does not increase value return by getY, so we save it manually + $posYAfterImage=$curY+$imglinesize['height']; + } + } + + + // Description of product line + if ($this->getColumnStatus('desc')) { + $pdf->startTransaction(); + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter = $pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 4, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('', '', true); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposafter + 1); + } + } else { + // We found a page break + // Allows data in the first page if description is long enough to break in multiples pages + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + $showpricebeforepagebreak = 1; + else $showpricebeforepagebreak = 0; + } + } else // No pagebreak + { + $pdf->commitTransaction(); + } + + $posYAfterDescription=$pdf->GetY(); + } + + $nexY = $pdf->GetY(); + $pageposafter = $pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } + + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + + + // Quantity + if ($this->getColumnStatus('qty_shipped')) { + $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); + $nexY = max($pdf->GetY(), $nexY); + } + + // Remaining to ship + if ($this->getColumnStatus('qty_remaining')) { + $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; + $this->printStdColumnContent($pdf, $curY, 'qty_remaining', $qtyRemaining); + $nexY = max($pdf->GetY(), $nexY); + } + + $nexY = max($nexY, $posYAfterImage); + + // Extrafields + if (!empty($object->lines[$i]->array_options)) { + foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { + if ($this->getColumnStatus($extrafieldColKey)) + { + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); + $nexY = max($pdf->GetY(), $nexY); + } + } + } + + // Add line + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + { + $pdf->setPage($pageposafter); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); + //$pdf->SetDrawColor(190,190,200); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); + $pdf->SetLineStyle(array('dash'=>0)); + } + + $nexY += 2; // Add space between lines + + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) + { + $pdf->setPage($pagenb); + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf, $object, $outputlangs, 1); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf, $object, $outputlangs, 1); + // New page + $pdf->AddPage(); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } + } + + // Show square + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + + // Affiche zone infos + $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + + // Pied de page + $this->_pagefoot($pdf, $object, $outputlangs); + + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); + + $pdf->Close(); + + $pdf->Output($file, 'F'); + + // Add pdfgeneration hook + if (!is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('pdfgeneration')); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + global $action; + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) + { + $this->error = $hookmanager->error; + $this->errors = $hookmanager->errors; + } + + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $this->result = array('fullpath'=>$file); + + return 1; // No error + } + else { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return 0; + } + } + + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); + return 0; + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Show miscellaneous information (payment mode, payment term, ...) + * + * @param TCPDF $pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void + */ + protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) + { + // phpcs:enable + global $conf, $mysoc; + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $pdf->SetFont('', '', $default_font_size); + $pdf->SetXY($this->marge_gauche, $posy); + + $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3; + $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25); + $pdf->SetXY($this->marge_gauche + 2, $posy + 2); + $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L'); + + $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25); + $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2); + $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L'); + } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Show table for lines + * + * @param TCPDF $pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y (not used) + * @param Translate $outputlangs Langs object + * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title + * @param int $hidebottom Hide bottom bar of array + * @return void + */ + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + { + global $conf; + + // Force to disable hidetop and hidebottom + $hidebottom = 0; + if ($hidetop) $hidetop = -1; + + $currency = !empty($currency) ? $currency : $conf->currency; + $default_font_size = pdf_getPDFFontSize($outputlangs); + + // Amount in (at tab_top - 1) + $pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', '', $default_font_size - 2); + + if (empty($hidetop)) + { + //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + } + + $pdf->SetDrawColor(128, 128, 128); + $pdf->SetFont('', '', $default_font_size - 1); + + // Output Rect + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + + + $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); + + if (empty($hidetop)){ + $pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Show top header of page. + * + * @param TCPDF $pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void + */ + protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + { + global $conf, $langs, $hookmanager; + + $default_font_size = pdf_getPDFFontSize($outputlangs); + + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); + + // Show Draft Watermark + if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) + { + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK); + } + + $pdf->SetTextColor(0, 0, 60); + $pdf->SetFont('', 'B', $default_font_size + 3); + + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; + + $pdf->SetXY($this->marge_gauche, $posy); + + // Logo + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + if ($this->emetteur->logo) + { + if (is_readable($logo)) + { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } + else { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + } + } + else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L'); + + $pdf->SetFont('', 'B', $default_font_size + 2); + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); + + $pdf->SetFont('', '', $default_font_size + 2); + + $posy += 5; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + if ($object->date_valid) + { + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R'); + } + else { + $pdf->SetTextColor(255, 0, 0); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R'); + $pdf->SetTextColor(0, 0, 60); + } + + if ($object->thirdparty->code_client) + { + $posy += 5; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + } + + $pdf->SetTextColor(0, 0, 60); + + $posy += 2; + + // Show list of linked objects + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + + if ($showaddress) + { + // Sender properties + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + + // Show sender + $posy = 42; + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; + $hautcadre = 40; + + // Show sender frame + $pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posx, $posy - 5); + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); + $pdf->SetXY($posx, $posy); + $pdf->SetFillColor(230, 230, 230); + $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); + $pdf->SetTextColor(0, 0, 60); + + // Show sender name + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy = $pdf->getY(); + + // Show sender information + $pdf->SetXY($posx + 2, $posy); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + + // Client destinataire + $posy = 42; + $posx = 102; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; + $pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posx, $posy - 5); + $pdf->MultiCell(80, 5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L'); + + // If SHIPPING contact defined on order, we use it + $usecontact = false; + $arrayidcontact = $object->commande->getIdContact('external', 'SHIPPING'); + if (count($arrayidcontact) > 0) + { + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); + } + + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->thirdparty; + } + + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object); + + // Show recipient + $widthrecbox = 100; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = 42; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; + + // Show recipient frame + $pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posx + 2, $posy - 5); + //$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L'); + $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); + + // Show recipient name + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + + $posy = $pdf->getY(); + + // Show recipient information + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetXY($posx + 2, $posy); + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); + } + + $pdf->SetTextColor(0, 0, 60); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Show footer of page. Need this->emetteur object + * + * @param TCPDF $pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text + */ + protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + { + global $conf; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + } + + + + /** + * Define Array Column Field + * + * @param object $object common object + * @param Translate $outputlangs langs + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return null + */ + public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { + global $conf, $hookmanager; + + // Default field style for content + $this->defaultContentsFieldsStyle = array( + 'align' => 'R', // R,C,L + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ); + + // Default field style for content + $this->defaultTitlesFieldsStyle = array( + 'align' => 'C', // R,C,L + 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ); + + /* + * For exemple + $this->cols['theColKey'] = array( + 'rank' => $rank, // int : use for ordering columns + 'width' => 20, // the column width in mm + 'title' => array( + 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + 'label' => ' ', // the final label : used fore final generated text + 'align' => 'L', // text alignement : R,C,L + 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'L', // text alignement : R,C,L + 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + */ + + $rank = 0; // do not use negative rank + $this->cols['desc'] = array( + 'rank' => $rank, + 'width' => false, // only for desc + 'status' => true, + 'title' => array( + 'textkey' => 'Designation', // use lang key is usefull in somme case with module + 'align' => 'L', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'L', + ), + ); + + $rank = $rank + 10; + $this->cols['photo'] = array( + 'rank' => $rank, + 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm + 'status' => false, + 'title' => array( + 'textkey' => 'Photo', + 'label' => ' ' + ), + 'content' => array( + 'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'border-left' => false, // remove left line separator + ); + + if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE) && !empty($this->atleastonephoto)) + { + $this->cols['photo']['status'] = true; + } + + + $rank = $rank + 10; + $this->cols['Comments'] = array( + 'rank' => $rank, + 'width' => 50, // in mm + 'status' => true, + 'title' => array( + 'textkey' => 'Comments' + ), + 'border-left' => true, // add left line separator + ); + + // $rank = $rank + 10; + // $this->cols['weight'] = array( + // 'rank' => $rank, + // 'width' => 30, // in mm + // 'status' => false, + // 'title' => array( + // 'textkey' => 'WeightVolShort' + // ), + // 'border-left' => true, // add left line separator + // ); + + $rank = $rank + 10; + $this->cols['qty_shipped'] = array( + 'rank' => $rank, + 'width' => 20, // in mm + 'status' => true, + 'title' => array( + 'textkey' => 'QtyShippedShort' + ), + 'border-left' => true, // add left line separator + ); + + $rank = $rank + 10; + $this->cols['qty_remaining'] = array( + 'rank' => $rank, + 'width' => 20, // in mm + 'status' => 1, + 'title' => array( + 'textkey' => 'KeepToShipShort' + ), + 'border-left' => true, // add left line separator + ); + + + // Add extrafields cols + if (!empty($object->lines)) { + $line = reset($object->lines); + $this->defineColumnExtrafield($line, $outputlangs, $hidedetails); + } + + $parameters = array( + 'object' => $object, + 'outputlangs' => $outputlangs, + 'hidedetails' => $hidedetails, + 'hidedesc' => $hidedesc, + 'hideref' => $hideref + ); + + $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook + if ($reshook < 0) + { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + elseif (empty($reshook)) + { + $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys + } + else { + $this->cols = $hookmanager->resArray; + } + } +} diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 747cae06573..e769441288f 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -258,8 +258,8 @@ class modAccounting extends DolibarrModules $this->export_label[$r] = 'Chartofaccounts'; $this->export_icon[$r] = 'accounting'; $this->export_permission[$r] = array(array("accounting", "chartofaccount")); - $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'Id', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); - $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); + $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); + $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 822ebd81e03..11912cf778a 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -71,7 +71,7 @@ class modBanque extends DolibarrModules $this->depends = array(); $this->requiredby = array("modComptabilite", "modAccounting", "modPrelevement"); $this->conflictwith = array(); - $this->langfiles = array("banks", "compta", "bills", "companies"); + $this->langfiles = array("banks", "compta", "bills", "companies", "accounting"); // Constants $this->const = array(); @@ -202,6 +202,42 @@ class modBanque extends DolibarrModules $this->export_sql_end[$r] .= ' AND p.fk_paiement = 7'; $this->export_sql_end[$r] .= ' AND ba.entity IN ('.getEntity('bank_account').')'; $this->export_sql_order[$r] = ' ORDER BY b.datev, b.num_releve'; + + // Various Payment + $r++; + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = 'VariousPayment'; + $this->export_permission[$r] = array(array("banque", "export")); + $this->export_fields_array[$r] = array( + 'v.rowid'=>'VariousPaymentId', 'v.label'=>'VariousPaymentLabel', 'v.datev'=>'DateValue', 'v.datep'=>'DateOperation', + 'v.num_payment'=>'ChequeOrTransferNumber', 'v.amount'=>'Amount', 'v.sens'=>'Sens', + 'cp.id'=>"PaymentMode", + 'v.accountancy_code'=>'AccountAccounting', 'v.subledger_account'=>'SubledgerAccount', + 'v.note'=>'Note', 'v.datec'=>'DateCreation', + 'p.ref'=>'ProjectRef', 'p.title'=>'ProjectLabel' + ); + $this->export_TypeFields_array[$r] = array( + 'v.rowid'=>'Text', 'v.label'=>'Text', 'v.datep'=>'Date', 'v.datev'=>'Date', + 'v.num_payment'=>'Text', 'v.amount'=>'Numeric', 'v.sens'=>'Numeric', + 'cp.id'=>'List:c_paiement:code:id:code', + "v.accountancy_code"=>"Text", "v.subledger_account"=>"Text", + "v.note"=>"Text", 'v.datec'=>"Date", + "p.ref"=>"Text", "p.title"=>"Text" + ); + $this->export_entities_array[$r] = array( + 'v.rowid'=>'payment', 'v.label'=>'payment', 'v.datev'=>'payment', 'v.datep'=>'payment', + 'v.num_payment'=>'payment', 'v.amount'=>'payment', 'v.sens'=>'payment', + 'cp.id'=>'payment', + 'v.accountancy_code'=>'payment', 'v.subledger_account'=>"payment", + 'v.note'=>"payment", 'v.datec'=>"payment", + "p.ref"=>"project", "p.title"=>"project" + ); + $this->export_sql_start[$r] = 'SELECT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'payment_various as v'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet as p ON v.fk_projet = p.rowid"; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_paiement as cp ON v.fk_typepayment = cp.id"; + $this->export_sql_end[$r] .= ' WHERE v.entity IN ('.getEntity('payment_various').')'; + $this->export_sql_order[$r] = ' ORDER BY v.datep'; } diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index d34b2da6b29..dcf8e712709 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -39,6 +39,8 @@ if (!empty($conf->commande->enabled)) { $langs->load("orders"); print ''; + print ''; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': '; print ''; print ''; @@ -62,6 +64,8 @@ if (!empty($conf->facture->enabled)) { $langs->load("bills"); print ''; + print ''; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': '; print ''; print ''; @@ -85,6 +89,8 @@ if (!empty($conf->contrat->enabled)) { $langs->load("contracts"); print ''; + print ''; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': '; print ''; print ''; @@ -108,6 +114,8 @@ if (!empty($conf->adherent->enabled)) { $langs->load("members"); print ''; + print ''; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': '; print ''; print ''; @@ -131,6 +139,8 @@ if (!empty($conf->don->enabled)) { $langs->load("members"); print ''; + print ''; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': '; print ''; print ''; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 4b84a97fde0..b070b69b4c9 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1672,8 +1672,10 @@ class EmailCollector extends CommonObject $description = dol_concatdesc($description, $messagetext); $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); + if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); + } // Insert record of emails sent $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) @@ -1760,8 +1762,10 @@ class EmailCollector extends CommonObject $description = dol_concatdesc($description, $messagetext); $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); + if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); + } $id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid'); $percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); @@ -1874,8 +1878,10 @@ class EmailCollector extends CommonObject $description = dol_concatdesc($description, $messagetext); $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); + if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); + } $tickettocreate->subject = $subject; $tickettocreate->message = $description; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 4d4b3626f75..c7d7f4eea89 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -539,6 +539,7 @@ class Export if (empty($this->array_export_fields) || !is_array($this->array_export_fields)) { $this->error = "ErrorBadParameter"; + dol_syslog($this->error, LOG_ERR); return -1; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 7a6f0563dec..4034abad733 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -173,7 +173,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg = '
'.$object->error.'
'; + $mesg = $object->error; } } elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) { @@ -198,7 +198,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg = '
'.$object->error.'
'; + $mesg = $object->error; } } elseif ($action == 'add' && $user->rights->ficheinter->creer) { @@ -372,11 +372,11 @@ if (empty($reshook)) } } } else { - $mesg = $srcobject->error; + $mesg = $srcobject->error; $error++; } } else { - $mesg = $object->error; + $mesg = $object->error; $error++; } } else { @@ -406,7 +406,7 @@ if (empty($reshook)) } } } else { - $mesg = '
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")).'
'; + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")); $action = 'create'; } } elseif ($action == 'update' && $user->rights->ficheinter->creer) @@ -456,17 +456,17 @@ if (empty($reshook)) { if (!GETPOST('np_desc', 'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { - $mesg = '
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")).'
'; + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")); $error++; } if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) { - $mesg = '
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration")).'
'; + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration")); $error++; } if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && GETPOST('durationhour', 'int') >= 24 && GETPOST('durationmin', 'int') > 0) { - $mesg = '
'.$langs->trans("ErrorValueTooHigh").'
'; + $mesg = $langs->trans("ErrorValueTooHigh"); $error++; } if (!$error) @@ -538,7 +538,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg = '
'.$object->error.'
'; + $mesg = $object->error; } } @@ -555,6 +555,20 @@ if (empty($reshook)) } } + // Reopen + elseif ($action == 'confirm_reopen' && $user->rights->ficheinter->creer) + { + $result = $object->setStatut(Fichinter::STATUS_VALIDATED); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else { + $mesg = $object->error; + } + } + /* * Mise a jour d'une ligne d'intervention */ @@ -735,9 +749,9 @@ if (empty($reshook)) if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); } else { - $mesg = '
'.$object->error.'
'; + $mesg = $object->error; } } } @@ -784,7 +798,11 @@ if ($action == 'create') print load_fiche_titre($langs->trans("AddIntervention"), '', 'intervention'); - dol_htmloutput_mesg($mesg); + if ($error > 0) { + dol_htmloutput_errors($mesg); + } else { + dol_htmloutput_mesg($mesg); + } if ($socid) $res = $soc->fetch($socid); @@ -1058,7 +1076,11 @@ if ($action == 'create') $soc = new Societe($db); $soc->fetch($object->socid); - dol_htmloutput_mesg($mesg); + if ($error > 0) { + dol_htmloutput_errors($mesg); + } else { + dol_htmloutput_mesg($mesg); + } $head = fichinter_prepare_head($object); @@ -1099,6 +1121,12 @@ if ($action == 'create') $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify', '', 0, 1); } + // Confirm back to open + if ($action == 'reopen') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Reopen'), $langs->trans('ConfirmReopenIntervention', $object->ref), 'confirm_reopen', '', 0, 1); + } + // Confirm deletion of line if ($action == 'ask_deleteline') { @@ -1331,8 +1359,13 @@ if ($action == 'create') { print '
'; print '
'.$langs->trans("Users").' '.count($users).'
'.$langs->trans("Users").' '.$num.'
'; - print ''; + + // No. + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''; print ''; print ''; @@ -1344,11 +1377,16 @@ if ($action == 'create') { $objp = $db->fetch_object($resql); - // Ligne en mode visu if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) { print ''; + + // No. + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''; + + // No. + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''."\n"; @@ -256,9 +257,9 @@ if ($source == 'proposal') -if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters"); +if (!$found && !$mesg) $mesg = $langs->transonentitiesnoconv("ErrorBadParameters"); -if ($mesg) print ''."\n"; +if ($mesg) print ''."\n"; print '
'.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'
'.($i + 1).''; print ''; // ancre pour retourner sur la ligne print dol_htmlentitiesbr($objp->description); @@ -1409,6 +1447,12 @@ if ($action == 'create') if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id', 'int') == $objp->rowid) { print '
'.($i + 1).''; print ''; // ancre pour retourner sur la ligne @@ -1461,9 +1505,15 @@ if ($action == 'create') { if (!$num) { - print '
'; + print '
'; + print '
'; + print ''; + + // No. + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } - print ''; print ''; @@ -1474,6 +1524,12 @@ if ($action == 'create') } print ''."\n"; + + // No. + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''; if ($objp->public) { - print "\n"; + print "\n"; } else { - print "\n"; + print "\n"; } print "\n"; print ''; @@ -97,7 +97,7 @@ if ($resql) } print "
'; print ''; // ancre print $langs->trans('Description').'
'.($i + 1).''; // editeur wysiwyg if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { @@ -1568,6 +1624,15 @@ if ($action == 'create') print ''; } + // Reopen + if ($object->statut > Fichinter::STATUS_CLOSED) + { + if ($user->rights->ficheinter->creer) + { + print ''; + } else print ''; + } + // Send if (empty($user->socid)) { if ($object->statut > Fichinter::STATUS_DRAFT) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f893b0e2e72..66e94d461a4 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -166,11 +166,11 @@ $arrayfields = array( 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), - 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), - 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), - 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1"), - 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1"), - 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), + 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1, 'position'=>105), + 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0, 'position'=>110), + 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1", 'position'=>95), + 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1", 'position'=>100), + 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0, 'position'=>115), 'u.login'=>array('label'=>"Author", 'checked'=>1), 'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0), 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), @@ -318,6 +318,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count if (!$search_all) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; if ($search_all || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn'; if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -326,7 +327,6 @@ if ($search_user > 0) $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')'; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 066b83c66a7..ea266a644e0 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -32,14 +32,6 @@ if (!$user->admin) $error = 0; -// List of statut -static $tmpstatus2label = array( - '0'=>'OpenEtablishment', - '1'=>'CloseEtablishment' -); -$status2label = array(''); -foreach ($tmpstatus2label as $key => $val) $status2label[$key] = $langs->trans($val); - /* * Actions diff --git a/htdocs/hrm/admin/admin_hrm.php b/htdocs/hrm/admin/admin_hrm.php index c00d266d2fc..79bf11f7ec9 100644 --- a/htdocs/hrm/admin/admin_hrm.php +++ b/htdocs/hrm/admin/admin_hrm.php @@ -58,9 +58,11 @@ if ($action == 'update') { } } + /* * View */ + llxHeader('', $langs->trans('Parameters')); $form = new Form($db); diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index b23a88ab412..d2b53337abe 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -148,10 +148,9 @@ class Establishment extends CommonObject $now = dol_now(); // Clean parameters - $this->address = ($this->address > 0 ? $this->address : $this->address); - $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); - $this->town = ($this->town > 0 ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + $this->address = trim($this->address); + $this->zip = trim($this->zip); + $this->town = trim($this->town); if (empty($this->ref)) $this->ref = '(PROV)'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 93d3139ca90..9fdc5330103 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -77,8 +77,8 @@ $importmodelid = GETPOST('importmodelid'); $excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 1); $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); $updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array()); -$separator = (GETPOST('separator') ? GETPOST('separator') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ',')); -$enclosure = (GETPOST('enclosure') ? GETPOST('enclosure') : '"'); +$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ',')); +$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); $objimport = new Import($db); $objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport)); diff --git a/htdocs/install/doctemplates/websites/website_template-corporate.zip b/htdocs/install/doctemplates/websites/website_template-corporate.zip index 80f16714c78..9186b95fdb6 100644 Binary files a/htdocs/install/doctemplates/websites/website_template-corporate.zip and b/htdocs/install/doctemplates/websites/website_template-corporate.zip differ diff --git a/htdocs/install/doctemplates/websites/website_template-stellar.zip b/htdocs/install/doctemplates/websites/website_template-stellar.zip index 5cf573d21d2..399a32e579d 100644 Binary files a/htdocs/install/doctemplates/websites/website_template-stellar.zip and b/htdocs/install/doctemplates/websites/website_template-stellar.zip differ diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index c80b1d4ebda..e76948808bb 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -28,7 +28,7 @@ -- Note: fields with type BLOB/TEXT can't have default value. --- Missing in v12 +-- Missing in v12 or lower ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order'; @@ -328,3 +328,5 @@ ALTER TABLE llx_paiement ADD COLUMN ref_ext varchar(255) AFTER ref; ALTER TABLE llx_bank ADD COLUMN origin_id integer; ALTER TABLE llx_bank ADD COLUMN origin_type varchar(64) NULL; ALTER TABLE llx_bank ADD COLUMN import_key varchar(14); + +ALTER TABLE llx_menu MODIFY COLUMN enabled text; diff --git a/htdocs/install/mysql/tables/llx_menu.sql b/htdocs/install/mysql/tables/llx_menu.sql index cb279cb5c56..4408cb69627 100644 --- a/htdocs/install/mysql/tables/llx_menu.sql +++ b/htdocs/install/mysql/tables/llx_menu.sql @@ -39,7 +39,7 @@ CREATE TABLE llx_menu langs varchar(100), -- Lang file to load for translation level smallint, -- Deprecated. Not used. perms text, -- Condition to show enabled or disabled - enabled varchar(255) NULL default '1', -- Condition to show or hide + enabled text NULL default '1', -- Condition to show or hide usertype integer NOT NULL DEFAULT 0, -- 0 if menu for all users, 1 for external only, 2 for internal only tms timestamp diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 464823810b2..adb87bcb8ca 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -18,7 +18,7 @@ DefaultForService=Default for service DefaultForProduct=Default for product CantSuggest=Can't suggest AccountancySetupDoneFromAccountancyMenu=Most setup of the accountancy is done from the menu %s -ConfigAccountingExpert=Configuration of the module accounting expert +ConfigAccountingExpert=Configuration of the module accounting (double entry) Journalization=Journalization Journaux=Journals JournalFinancial=Financial journals diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index adb53e56edf..1498639d731 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -896,7 +896,7 @@ Permission1185=Approve purchase orders Permission1186=Order purchase orders Permission1187=Acknowledge receipt of purchase orders Permission1188=Delete purchase orders -Permission1189=Check/Uncheck a supplier order reception +Permission1189=Check/Uncheck a purchase order reception Permission1190=Approve (second approval) purchase orders Permission1191=Export supplier orders and their attributes Permission1201=Get result of an export diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 75f9549dca5..3cfa7ad2538 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -166,6 +166,8 @@ VariousPayment=Miscellaneous payment VariousPayments=Miscellaneous payments ShowVariousPayment=Show miscellaneous payment AddVariousPayment=Add miscellaneous payment +VariousPaymentId=Miscellaneous payment ID +VariousPaymentLabel=Miscellaneous payment label SEPAMandate=SEPA mandate YourSEPAMandate=Your SEPA mandate FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Return it signed (scan of the signed document) or send it by mail to diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index e5936f8246e..51079fca278 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -64,3 +64,5 @@ InterLineDuration=Line duration intervention InterLineDesc=Line description intervention RepeatableIntervention=Template of intervention ToCreateAPredefinedIntervention=To create a predefined or recurring intervention, create a common intervention and convert it into intervention template +Reopen=Reopen +ConfirmReopenIntervention=Are you sure you want to open back the intervention %s? diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index d259d073cb8..7e34db3d8b8 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -126,7 +126,7 @@ NoEmailSentBadSenderOrRecipientEmail=No email sent. Bad sender or recipient emai # Module Notifications Notifications=Notifications NotificationsAuto=Notifications Auto. -NoNotificationsWillBeSent=No automtic email notifications are planned for this event type and company +NoNotificationsWillBeSent=No automatic email notifications are planned for this event type and company ANotificationsWillBeSent=1 automatic notification will be sent by email SomeNotificationsWillBeSent=%s automatic notifications will be sent by email AddNewNotification=Activate a new automatic email notification target/event diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 31f0e536558..0289b381b23 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1092,4 +1092,6 @@ APPROVEDInDolibarr=Record %s approved DefaultMailModel=Default Mail Model PublicVendorName=Public name of vendor DateOfBirth=Date of birth -SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry=Security token has expired, so action has been canceled. Please try again. \ No newline at end of file +SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry=Security token has expired, so action has been canceled. Please try again. +UpToDate=Up-to-date +OutOfDate=Out-of-date \ No newline at end of file diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 85b2051658b..1a1419aa6da 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -19,14 +19,12 @@ MembersCards=Members business cards MembersList=List of members MembersListToValid=List of draft members (to be validated) MembersListValid=List of valid members -MembersListUpToDate=List of valid members with up to date subscription -MembersListNotUpToDate=List of valid members with subscription out of date +MembersListUpToDate=List of valid members with up-to-date subscription +MembersListNotUpToDate=List of valid members with out-of-date subscription MembersListResiliated=List of terminated members MembersListQualified=List of qualified members MenuMembersToValidate=Draft members MenuMembersValidated=Validated members -MenuMembersUpToDate=Up to date members -MenuMembersNotUpToDate=Out of date members MenuMembersResiliated=Terminated members MembersWithSubscriptionToReceive=Members with subscription to receive MembersWithSubscriptionToReceiveShort=Subscription to receive @@ -34,6 +32,7 @@ DateSubscription=Subscription date DateEndSubscription=Subscription end date EndSubscription=End subscription SubscriptionId=Subscription id +WithoutSubscription=Without subscription MemberId=Member id NewMember=New member MemberType=Member type diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 5ce3b7f67e9..e1cb168500a 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -65,6 +65,7 @@ ValidateOrderFirstBeforeShipment=You must first validate the order before being # Sending methods # ModelDocument DocumentModelTyphon=More complete document model for delivery receipts (logo...) +DocumentModelStorm=More complete document model for delivery receipts and extrafields compatibility (logo...) Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constant EXPEDITION_ADDON_NUMBER not defined SumOfProductVolumes=Sum of product volumes SumOfProductWeights=Sum of product weights diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 82ef8ed9407..79e38dbdeb1 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -55,7 +55,7 @@ $search_ref = GETPOST('search_ref', 'int'); $search_label = GETPOST('search_label', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ce0af2bfd67..6cdf59a078a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -75,6 +75,7 @@ function testSqlAndScriptInject($val, $type) $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database + $inj += preg_match('/global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set { - // Check all cases that need a token (all POST and some GET) - if ($_SERVER['REQUEST_METHOD'] == 'POST' || (GETPOSTISSET('action') && defined('CSRFCHECK_WITH_TOKEN')) || in_array(GETPOST('action', 'aZ09'), array('add', 'update', 'install'))) + // Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions) + if ($_SERVER['REQUEST_METHOD'] == 'POST' || ((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof'))) { if (!GETPOSTISSET('token')) { dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." refused by CSRFCHECK_WITH_TOKEN protection. Token not provided."); - print "Access by POST method (or to a page with CSRFCHECK_WITH_TOKEN on) is refused by CSRF protection in main.inc.php. Token not provided.\n"; + print "Access to this page this way (POST method or page with CSRFCHECK_WITH_TOKEN on or having a sensible value for action parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n"; print "If you access your server behind a proxy using url rewriting, you might check that all HTTP header is propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0 into setup).\n"; die; } @@ -384,10 +391,12 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl //if ($conf->global->MAIN_FEATURES_LEVEL >= 1) setEventMessages('Unset POST and GET params by CSRF protection in main.inc.php (Token provided was not generated by the previous page).'."
\n".'$_SERVER[REQUEST_URI] = '.$_SERVER['REQUEST_URI'].' $_SERVER[REQUEST_METHOD] = '.$_SERVER['REQUEST_METHOD'].' GETPOST(token) = '.GETPOST('token', 'alpha').' $_SESSION[token] = '.$_SESSION['token'], null, 'warnings'); $savid = ((int) $_POST['id']); unset($_POST); - //unset($_POST['action']); - //unset($_POST['confirm']); + //unset($_POST['action']); unset($_POST['massaction']); + //unset($_POST['confirm']); unset($_POST['confirmmassaction']); unset($_GET['confirm']); unset($_GET['action']); + unset($_GET['confirmmassaction']); + unset($_GET['massaction']); $_POST['id'] = ((int) $savid); } } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 50307c91161..3fc5032bced 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -134,7 +134,8 @@ foreach ($object->fields as $key => $val) 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), - 'position'=>$val['position'] + 'position'=>$val['position'], + 'help'=>$val['help'] ); } } @@ -149,7 +150,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]), - 'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key] + 'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key], + 'help'=>$extrafields->attributes[$object->table_element]['help'][$key] ); } } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index f17a4615eef..77e7feed460 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -36,7 +36,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'opensurveylist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 68d55558c9f..a1ceb3e4810 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -110,7 +110,7 @@ $head[$h][1] = $langs->trans("PayBox"); $head[$h][2] = 'payboxaccount'; $h++; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 1f347353b81..fb1be576ad5 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -883,10 +883,8 @@ SCRIPT; foreach ($extralabels as $key => $value) { // Show field if not hidden if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); - if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); - else $extratitle = $langs->trans($value); - $arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position']+1)); + $extratitle = $langs->trans($value); + $arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position']+1), 'langfile'=>$extrafields->attributes["product_fournisseur_price"]['langfile'][$key], 'help'=>$extrafields->attributes["product_fournisseur_price"]['help'][$key]); } } } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 357251fe512..3053cc45d71 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 9b871da7a8b..504f8419685 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $fk_warehouse = GETPOST('fk_warehouse', 'int'); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 33d49c0c5e5..8a02f3a2b41 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -39,7 +39,7 @@ $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productlotlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); $search_entity = GETPOST('search_entity', 'int'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 515c3163b50..4ded7e9d197 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -44,7 +44,7 @@ $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choi $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'timespentlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 49114b89f46..294167bb574 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -86,9 +86,9 @@ if ($resql) print '
".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."Anonyme Anonyme".$langs->trans("Anonymous")."".dol_print_date($db->jdate($objp->datedon))."'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).'
"; } else { - print "Aucun don publique"; + print $langs->trans("Donation"); } } else { dol_print_error($db); diff --git a/htdocs/public/donations/index.php b/htdocs/public/donations/index.php index ceb6bb6031e..cd23e8058b6 100644 --- a/htdocs/public/donations/index.php +++ b/htdocs/public/donations/index.php @@ -24,3 +24,4 @@ require '../../master.inc.php'; header("Location: ".DOL_URL_ROOT.'/public/error-404.php'); +exit; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 8c248734175..4408438ceaf 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -194,6 +194,7 @@ $text = ''; if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) { $langs->load("members"); + $reg = array(); if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."
\n"; else $text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."
\n"; $text = '

'.$text.'

'.$mesg.'

'.dol_escape_htmltag($mesg).'
'."\n"; print "\n"; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index d880025259b..3d197296df7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1629,7 +1629,7 @@ if ($source == 'donation') if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters"); -if ($mesg) print '

'.$mesg.'

'.dol_escape_htmltag($mesg).'
'."\n"; print "\n"; @@ -1655,7 +1655,7 @@ if ($action != 'dopayment') { $langs->load("members"); print '
'.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'
'; - print ''.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
'; + print '
'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
'; } // Buttons for all payments registration methods diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 46b9b1c03c6..94f85f911aa 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -241,14 +241,13 @@ print '
'; print '
'.$langs->trans("ThisIsInformationOnJobPosition").' :
'."\n"; $error = 0; -$var = false; $found = true; print '
'; // Label print $langs->trans("Label").' : '; -print ''.$object->label.'
'; +print ''.dol_escape_htmltag($object->label).'
'; // Date print $langs->trans("DateExpected").' : '; @@ -263,7 +262,7 @@ print '
'; // Remuneration print $langs->trans("Remuneration").' : '; print ''; -print $object->remuneration_suggested; +print dol_escape_htmltag($object->remuneration_suggested); print '
'; // Contact diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 800141244f0..f8cab9c9b9a 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -162,6 +162,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a $url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha'); header("Location: ".$url); + exit; } else { $action = ''; setEventMessages($object->error, $object->errors, 'errors'); @@ -238,17 +239,17 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Ref print ''.$langs->trans("Ref").''; - print $object->dao->ref; + print dol_escape_htmltag($object->dao->ref); print ''; // Tracking ID print ''.$langs->trans("TicketTrackId").''; - print $object->dao->track_id; + print dol_escape_htmltag($object->dao->track_id); print ''; // Subject print ''.$langs->trans("Subject").''; - print $object->dao->subject; + print dol_escape_htmltag($object->dao->subject); print ''; // Statut @@ -258,17 +259,17 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Type print ''.$langs->trans("Type").''; - print $object->dao->type_label; + print dol_escape_htmltag($object->dao->type_label); print ''; // Category print ''.$langs->trans("Category").''; - print $object->dao->category_label; + print dol_escape_htmltag($object->dao->category_label); print ''; // Severity print ''.$langs->trans("Severity").''; - print $object->dao->severity_label; + print dol_escape_htmltag($object->dao->severity_label); print ''; // Creation date @@ -314,7 +315,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Progression print ''.$langs->trans("Progression").''; - print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%'; + print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%'; print ''; print ''; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 61d473f5c43..77953f73d7c 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -139,19 +139,11 @@ if ($socid > 0) $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { - //$out.='trans("AddAnAction"),'filenew'); - //$out.=""; + if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&percentage=-1'; + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); } - - //print '
'; - //print '
'; - - $newcardbutton = ''; if (!empty($conf->agenda->enabled)) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 42de4d74b39..8104d40d201 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1302,7 +1302,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Country print ''.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country((GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -1456,13 +1456,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Capital print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).''; - print ' '; + print ' '; print ''.$langs->trans("Currency".$conf->currency).''; if (!empty($conf->global->MAIN_MULTILANGS)) { print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; - print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print $formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); print ''; print ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f28c6953d82..a8b2caa59c1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -777,7 +777,7 @@ class Societe extends CommonObject * $this->code_client = -1 and $this->code_fournisseur = -1 means automatic assignement. * * @param User $user Object of user that ask creation - * @return int >= 0 if OK, < 0 if KO + * @return int >=0 if OK, <0 if KO */ public function create(User $user) { @@ -969,7 +969,10 @@ class Societe extends CommonObject } elseif ($rescode == -4) { $this->errors[] = 'ErrorPrefixRequired'; + } else { + $this->errors[] = 'ErrorUnknownOnCustomerCodeCheck'; } + $result = -3; } } @@ -988,9 +991,11 @@ class Societe extends CommonObject } elseif ($rescode == -3) { $this->errors[] = 'ErrorSupplierCodeAlreadyUsed'; - } elseif ($rescode == -5) + } elseif ($rescode == -4) { $this->errors[] = 'ErrorPrefixRequired'; + } else { + $this->errors[] = 'ErrorUnknownOnSupplierCodeCheck'; } $result = -3; } @@ -2989,6 +2994,10 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::check_codeclient code_client=".$this->code_client." module=".$module); $result = $mod->verif($this->db, $this->code_client, $this, 0); + if ($result) { // If error + $this->error = $mod->error; + $this->errors = $mod->errors; + } return $result; } else { return 0; @@ -3024,6 +3033,10 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$module); $result = $mod->verif($this->db, $this->code_fournisseur, $this, 1); + if ($result) { // If error + $this->error = $mod->error; + $this->errors = $mod->errors; + } return $result; } else { return 0; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 5347cbe32e3..883908e8d5d 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -39,7 +39,7 @@ $langs->loadLangs(array("companies", "website")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $show_files = GETPOST('show_files', 'int'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 46f59039c36..efcef759da4 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -157,7 +157,7 @@ print load_fiche_titre($langs->trans("ModuleSetup").' Stripe', $linkback); $head = stripeadmin_prepare_head(); -print ''; +print ''; print ''; print ''; diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 5672176168a..8544417b2e4 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -79,195 +79,207 @@ $stripeacc = $stripe->getStripeAccount($service); if (!$rowid) { $option = array('limit' => $limit + 1); + $num = 0; + if (GETPOSTISSET('starting_after_'.$page)) $option['starting_after'] = GETPOST('starting_after_'.$page, 'alphanohtml'); - if ($stripeacc) - { - $list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc)); - } else { - $list = \Stripe\Charge::all($option); - } - $num = count($list->data); - $totalnboflines = ''; - - $param = ''; - //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - $param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id; - //$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id; - - $moreforfilter = ''; - - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $title = $langs->trans("StripeChargeList"); - $title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'); - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', 'hidepaginationprevious', $limit); - - print '
'; - print ''."\n"; - - print ''; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("StripeCustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); - print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); - print "\n"; - - //print $list; - $i = 0; - foreach ($list->data as $charge) - { - if ($i >= $limit) { - break; - } - - if ($charge->refunded == '1') { - $status = img_picto($langs->trans("refunded"), 'statut6'); - } elseif ($charge->paid == '1') { - $status = img_picto($langs->trans((string) $charge->status), 'statut4'); - } else { - $label = $langs->trans("Message").": ".$charge->failure_message."
"; - $label .= $langs->trans("Network").": ".$charge->outcome->network_status."
"; - $label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message); - $status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1); - } - - if ($charge->payment_method_details->type == 'card') { - $type = $langs->trans("card"); - } elseif ($charge->source->type == 'card') { - $type = $langs->trans("card"); - } elseif ($charge->payment_method_details->type == 'three_d_secure') { - $type = $langs->trans("card3DS"); - } elseif ($charge->payment_method_details->type == 'sepa_debit') { - $type = $langs->trans("sepadebit"); - } elseif ($charge->payment_method_details->type == 'ideal') { - $type = $langs->trans("iDEAL"); - } - - // Why this ? - /*if (! empty($charge->payment_intent)) { - if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); - } else { - $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc)); - } - }*/ - - // The metadata FULLTAG is defined by the online payment page - $FULLTAG = $charge->metadata->FULLTAG; - - // Save into $tmparray all metadata - $tmparray = dolExplodeIntoArray($FULLTAG, '.', '='); - // Load origin object according to metadata - if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) + try { + if ($stripeacc) { - $societestatic->fetch($tmparray['CUS']); - } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) - { - $societestatic->fetch($charge->metadata->dol_thirdparty_id); + $list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc)); } else { - $societestatic->id = 0; - } - if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) - { - $memberstatic->fetch($tmparray['MEM']); - } else { - $memberstatic->id = 0; + $list = \Stripe\Charge::all($option); } - print ''; + $num = count($list->data); - if (!empty($stripeacc)) $connect = $stripeacc.'/'; + $totalnboflines = ''; - // Ref - $url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; - if ($servicestatus) - { - $url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; - } - print "\n"; + $param = ''; + //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + $param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id; + //$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id; - // Stripe customer - print "\n"; + $moreforfilter = ''; - // Link - print "\n"; + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - // Origin - print "\n"; + $title = $langs->trans("StripeChargeList"); + $title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'); - // Date payment - print '\n"; - // Type - print ''; - // Amount - print '"; - // Status - print '\n"; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', 'hidepaginationprevious', $limit); + print '
'; + print '
"; - print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id.""; - if ($charge->payment_intent) print '
'.$charge->payment_intent.''; - print "
"; - if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.'/'; - $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer; - if ($servicestatus) - { - $url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; - } - if (!empty($charge->customer)) - { - print ''.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.''; - } - print ""; - if ($societestatic->id > 0) - { - print $societestatic->getNomUrl(1); - } elseif ($memberstatic->id > 0) - { - print $memberstatic->getNomUrl(1); - } - print ""; - if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") { - $object = new Commande($db); - $object->fetch($charge->metadata->dol_id); - if ($object->id > 0) { - print "".img_picto('', 'object_order')." ".$object->ref.""; - } else { - print $FULLTAG; - } - } elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") { - print $charge->metadata->dol_type.' '.$charge->metadata->dol_id.' - '; - $object = new Facture($db); - $object->fetch($charge->metadata->dol_id); - if ($object->id > 0) { - print "".img_picto('', 'object_invoice')." ".$object->ref.""; - } else { - print $FULLTAG; - } - } else { - print $FULLTAG; - } - print "'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."'; - print $type; - print ''.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'; - print $status; - print "
'."\n"; + + print ''; + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("StripeCustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print "\n"; - $i++; + //print $list; + $i = 0; + foreach ($list->data as $charge) + { + if ($i >= $limit) { + break; + } + + if ($charge->refunded == '1') { + $status = img_picto($langs->trans("refunded"), 'statut6'); + } elseif ($charge->paid == '1') { + $status = img_picto($langs->trans((string) $charge->status), 'statut4'); + } else { + $label = $langs->trans("Message").": ".$charge->failure_message."
"; + $label .= $langs->trans("Network").": ".$charge->outcome->network_status."
"; + $label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message); + $status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1); + } + + if ($charge->payment_method_details->type == 'card') { + $type = $langs->trans("card"); + } elseif ($charge->source->type == 'card') { + $type = $langs->trans("card"); + } elseif ($charge->payment_method_details->type == 'three_d_secure') { + $type = $langs->trans("card3DS"); + } elseif ($charge->payment_method_details->type == 'sepa_debit') { + $type = $langs->trans("sepadebit"); + } elseif ($charge->payment_method_details->type == 'ideal') { + $type = $langs->trans("iDEAL"); + } + + // Why this ? + /*if (! empty($charge->payment_intent)) { + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); + } else { + $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc)); + } + }*/ + + // The metadata FULLTAG is defined by the online payment page + $FULLTAG = $charge->metadata->FULLTAG; + + // Save into $tmparray all metadata + $tmparray = dolExplodeIntoArray($FULLTAG, '.', '='); + // Load origin object according to metadata + if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) + { + $societestatic->fetch($tmparray['CUS']); + } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) + { + $societestatic->fetch($charge->metadata->dol_thirdparty_id); + } else { + $societestatic->id = 0; + } + if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) + { + $memberstatic->fetch($tmparray['MEM']); + } else { + $memberstatic->id = 0; + } + + print ''; + + if (!empty($stripeacc)) $connect = $stripeacc.'/'; + + // Ref + $url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; + if ($servicestatus) + { + $url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; + } + print "\n"; + + // Stripe customer + print "\n"; + + // Link + print "\n"; + + // Origin + print "\n"; + + // Date payment + print '\n"; + // Type + print ''; + // Amount + print '"; + // Status + print '\n"; + + print "\n"; + + $i++; + } + + print '
"; + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id.""; + if ($charge->payment_intent) print '
'.$charge->payment_intent.''; + print "
"; + if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.'/'; + $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer; + if ($servicestatus) + { + $url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; + } + if (!empty($charge->customer)) + { + print ''.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.''; + } + print ""; + if ($societestatic->id > 0) + { + print $societestatic->getNomUrl(1); + } elseif ($memberstatic->id > 0) + { + print $memberstatic->getNomUrl(1); + } + print ""; + if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") { + $object = new Commande($db); + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_order')." ".$object->ref.""; + } else { + print $FULLTAG; + } + } elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") { + print $charge->metadata->dol_type.' '.$charge->metadata->dol_id.' - '; + $object = new Facture($db); + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_invoice')." ".$object->ref.""; + } else { + print $FULLTAG; + } + } else { + print $FULLTAG; + } + print "'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."'; + print $type; + print ''.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'; + print $status; + print "
'; + print '
'; + print ''; + } catch (Exception $e) { + print $e->getMessage(); } } diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 6823c32c0b7..6cc093417ad 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -109,111 +109,115 @@ if (!$rowid) { print "\n"; - if ($stripeacc) - { - $payout = \Stripe\Payout::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); - } else { - $payout = \Stripe\Payout::all(array("limit" => $limit)); - } - - foreach ($payout->data as $payout) - { - //$charge = $payout; - //var_dump($payout); - - // The metadata FULLTAG is defined by the online payment page - /*$FULLTAG=$charge->metadata->FULLTAG; - - // Save into $tmparray all metadata - $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); - // Load origin object according to metadata - if (! empty($tmparray['CUS'])) + try { + if ($stripeacc) { - $societestatic->fetch($tmparray['CUS']); - } - else - { - $societestatic->id = 0; - } - if (! empty($tmparray['MEM'])) - { - $memberstatic->fetch($tmparray['MEM']); - } - else - { - $memberstatic->id = 0; - }*/ - - $societestatic->fetch($charge->metadata->idcustomer); - $societestatic->id = $charge->metadata->idcustomer; - $societestatic->lastname = $obj->lastname; - $societestatic->firstname = $obj->firstname; - $societestatic->admin = $obj->admin; - $societestatic->login = $obj->login; - $societestatic->email = $obj->email; - $societestatic->socid = $obj->fk_soc; - - print ''; - - // Ref - if (!empty($stripeacc)) $connect = $stripeacc.'/'; - - $url = 'https://dashboard.stripe.com/'.$connect.'test/payouts/'.$payout->id; - if ($servicestatus) { - $url = 'https://dashboard.stripe.com/'.$connect.'payouts/'.$payout->id; + $payout = \Stripe\Payout::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); + } else { + $payout = \Stripe\Payout::all(array("limit" => $limit)); } - print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$payout->id."\n"; + foreach ($payout->data as $payout) + { + //$charge = $payout; + //var_dump($payout); + + // The metadata FULLTAG is defined by the online payment page + /*$FULLTAG=$charge->metadata->FULLTAG; + + // Save into $tmparray all metadata + $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); + // Load origin object according to metadata + if (! empty($tmparray['CUS'])) + { + $societestatic->fetch($tmparray['CUS']); + } + else + { + $societestatic->id = 0; + } + if (! empty($tmparray['MEM'])) + { + $memberstatic->fetch($tmparray['MEM']); + } + else + { + $memberstatic->id = 0; + }*/ + + $societestatic->fetch($charge->metadata->idcustomer); + $societestatic->id = $charge->metadata->idcustomer; + $societestatic->lastname = $obj->lastname; + $societestatic->firstname = $obj->firstname; + $societestatic->admin = $obj->admin; + $societestatic->login = $obj->login; + $societestatic->email = $obj->email; + $societestatic->socid = $obj->fk_soc; + + print ''; + + // Ref + if (!empty($stripeacc)) $connect = $stripeacc.'/'; + + $url = 'https://dashboard.stripe.com/'.$connect.'test/payouts/'.$payout->id; + if ($servicestatus) { + $url = 'https://dashboard.stripe.com/'.$connect.'payouts/'.$payout->id; + } + + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$payout->id."\n"; - // Stripe customer - //print "".$charge->customer."\n"; - // Link - /*print ""; - if ($societestatic->id > 0) - { - print $societestatic->getNomUrl(1); + // Stripe customer + //print "".$charge->customer."\n"; + // Link + /*print ""; + if ($societestatic->id > 0) + { + print $societestatic->getNomUrl(1); + } + if ($memberstatic->id > 0) + { + print $memberstatic->getNomUrl(1); + } + print "\n";*/ + // Origine + //print ""; + ////if ($charge->metadata->dol_type=="order"){ + // $object = new Commande($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_order')." ".$object->ref.""; + //} elseif ($charge->metadata->dol_type=="invoice"){ + // $object = new Facture($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_invoice')." ".$object->ref.""; + //} + //print "\n"; + // Date payment + print ''.dol_print_date($payout->created, '%d/%m/%Y %H:%M')."\n"; + // Date payment + print ''.dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M')."\n"; + // Type + print ''.$payout->description.''; + // Amount + print ''.price(($payout->amount) / 100, 0, '', 1, -1, -1, strtoupper($payout->currency)).""; + // Status + print ""; + if ($payout->status == 'paid') { + print img_picto($langs->trans("".$payout->status.""), 'statut4'); + } elseif ($payout->status == 'pending') { + print img_picto($langs->trans("".$payout->status.""), 'statut7'); + } elseif ($payout->status == 'in_transit') { + print img_picto($langs->trans("".$payout->status.""), 'statut7'); + } elseif ($payout->status == 'failed') { + print img_picto($langs->trans("".$payout->status.""), 'statut7'); + } elseif ($payout->status == 'canceled') { + print img_picto($langs->trans("".$payout->status.""), 'statut8'); + } + print ''; + print "\n"; } - if ($memberstatic->id > 0) - { - print $memberstatic->getNomUrl(1); - } - print "\n";*/ - // Origine - //print ""; - ////if ($charge->metadata->dol_type=="order"){ - // $object = new Commande($db); - // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_order')." ".$object->ref.""; - //} elseif ($charge->metadata->dol_type=="invoice"){ - // $object = new Facture($db); - // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_invoice')." ".$object->ref.""; - //} - //print "\n"; - // Date payment - print ''.dol_print_date($payout->created, '%d/%m/%Y %H:%M')."\n"; - // Date payment - print ''.dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M')."\n"; - // Type - print ''.$payout->description.''; - // Amount - print ''.price(($payout->amount) / 100, 0, '', 1, -1, -1, strtoupper($payout->currency)).""; - // Status - print ""; - if ($payout->status == 'paid') { - print img_picto($langs->trans("".$payout->status.""), 'statut4'); - } elseif ($payout->status == 'pending') { - print img_picto($langs->trans("".$payout->status.""), 'statut7'); - } elseif ($payout->status == 'in_transit') { - print img_picto($langs->trans("".$payout->status.""), 'statut7'); - } elseif ($payout->status == 'failed') { - print img_picto($langs->trans("".$payout->status.""), 'statut7'); - } elseif ($payout->status == 'canceled') { - print img_picto($langs->trans("".$payout->status.""), 'statut8'); - } - print ''; - print "\n"; + } catch (Exception $e) { + print ''.$e->getMessage().''; } print ""; print '
'; diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 6f74d1a48c0..cd75fec476c 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -108,117 +108,121 @@ if (!$rowid) { print "\n"; - if ($stripeacc) - { - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); - } else { - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); - } - - foreach ($txn->data as $txn) - { - //$charge = $txn; - //var_dump($txn); - - // The metadata FULLTAG is defined by the online payment page - /*$FULLTAG=$charge->metadata->FULLTAG; - - // Save into $tmparray all metadata - $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); - // Load origin object according to metadata - if (! empty($tmparray['CUS'])) + try { + if ($stripeacc) { - $societestatic->fetch($tmparray['CUS']); + $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); + } else { + $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } - else + + foreach ($txn->data as $txn) { - $societestatic->id = 0; + //$charge = $txn; + //var_dump($txn); + + // The metadata FULLTAG is defined by the online payment page + /*$FULLTAG=$charge->metadata->FULLTAG; + + // Save into $tmparray all metadata + $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); + // Load origin object according to metadata + if (! empty($tmparray['CUS'])) + { + $societestatic->fetch($tmparray['CUS']); + } + else + { + $societestatic->id = 0; + } + if (! empty($tmparray['MEM'])) + { + $memberstatic->fetch($tmparray['MEM']); + } + else + { + $memberstatic->id = 0; + }*/ + + $societestatic->fetch($charge->metadata->idcustomer); + $societestatic->id = $charge->metadata->idcustomer; + $societestatic->lastname = $obj->lastname; + $societestatic->firstname = $obj->firstname; + $societestatic->admin = $obj->admin; + $societestatic->login = $obj->login; + $societestatic->email = $obj->email; + $societestatic->societe_id = $obj->fk_soc; + + print ''; + + // Ref + if (!empty($stripeacc)) $connect = $stripeacc.'/'; + + // Ref + if (preg_match('/po_/i', $txn->source)) { + $origin = "payouts"; + } elseif (preg_match('/fee_/i', $txn->source)) { + $origin = "connect/application_fees"; + } else { + $origin = "payments"; + } + + $url = 'https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; + if ($servicestatus) { + $url = 'https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + } + if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { + print "".$txn->type.""; + } else { + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$txn->source."\n"; + } + + // Stripe customer + //print "".$charge->customer."\n"; + // Link + /*print ""; + if ($societestatic->id > 0) + { + print $societestatic->getNomUrl(1); + } + if ($memberstatic->id > 0) + { + print $memberstatic->getNomUrl(1); + } + print "\n";*/ + // Origine + //print ""; + ////if ($charge->metadata->dol_type=="order"){ + // $object = new Commande($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_order')." ".$object->ref.""; + //} elseif ($charge->metadata->dol_type=="invoice"){ + // $object = new Facture($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_invoice')." ".$object->ref.""; + //} + //print "\n"; + // Date payment + print ''.dol_print_date($txn->created, '%d/%m/%Y %H:%M')."\n"; + // Type + print ''.$txn->type.''; + // Amount + print ''.price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)).""; + print ''.price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)).""; + // Status + print ""; + if ($txn->status == 'available') { + print img_picto($langs->trans("".$txn->status.""), 'statut4'); + } elseif ($txn->status == 'pending') { + print img_picto($langs->trans("".$txn->status.""), 'statut7'); + } elseif ($txn->status == 'failed') { + print img_picto($langs->trans("".$txn->status.""), 'statut8'); + } + print ''; + print "\n"; } - if (! empty($tmparray['MEM'])) - { - $memberstatic->fetch($tmparray['MEM']); - } - else - { - $memberstatic->id = 0; - }*/ - - $societestatic->fetch($charge->metadata->idcustomer); - $societestatic->id = $charge->metadata->idcustomer; - $societestatic->lastname = $obj->lastname; - $societestatic->firstname = $obj->firstname; - $societestatic->admin = $obj->admin; - $societestatic->login = $obj->login; - $societestatic->email = $obj->email; - $societestatic->societe_id = $obj->fk_soc; - - print ''; - - // Ref - if (!empty($stripeacc)) $connect = $stripeacc.'/'; - - // Ref - if (preg_match('/po_/i', $txn->source)) { - $origin = "payouts"; - } elseif (preg_match('/fee_/i', $txn->source)) { - $origin = "connect/application_fees"; - } else { - $origin = "payments"; - } - - $url = 'https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; - if ($servicestatus) { - $url = 'https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; - } - if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { - print "".$txn->type.""; - } else { - print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$txn->source."\n"; - } - - // Stripe customer - //print "".$charge->customer."\n"; - // Link - /*print ""; - if ($societestatic->id > 0) - { - print $societestatic->getNomUrl(1); - } - if ($memberstatic->id > 0) - { - print $memberstatic->getNomUrl(1); - } - print "\n";*/ - // Origine - //print ""; - ////if ($charge->metadata->dol_type=="order"){ - // $object = new Commande($db); - // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_order')." ".$object->ref.""; - //} elseif ($charge->metadata->dol_type=="invoice"){ - // $object = new Facture($db); - // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_invoice')." ".$object->ref.""; - //} - //print "\n"; - // Date payment - print ''.dol_print_date($txn->created, '%d/%m/%Y %H:%M')."\n"; - // Type - print ''.$txn->type.''; - // Amount - print ''.price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)).""; - print ''.price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)).""; - // Status - print ""; - if ($txn->status == 'available') { - print img_picto($langs->trans("".$txn->status.""), 'statut4'); - } elseif ($txn->status == 'pending') { - print img_picto($langs->trans("".$txn->status.""), 'statut7'); - } elseif ($txn->status == 'failed') { - print img_picto($langs->trans("".$txn->status.""), 'statut8'); - } - print ''; - print "\n"; + } catch (Exception $e) { + print ''.$e->getMessage().''; } print ""; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b9f630872ae..59aaf0ecc2c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -31,8 +31,8 @@ if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); -if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content +if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login. +//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We load menu manager class (note that object loaded may have wrong content because NOLOGIN is set and some values depends on login) if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); @@ -55,6 +55,10 @@ if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('', $_SESSION['dol_login'], '', 1); $user->getrights(); + + // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. + $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1); + $menumanager->loadMenu(); } @@ -190,6 +194,7 @@ $colortext = join(',', colorStringToArray($colortext)); $colortextlink = join(',', colorStringToArray($colortextlink)); $nbtopmenuentries = $menumanager->showmenu('topnb'); + if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d468eccf87d..dcfbc402927 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -56,6 +56,10 @@ if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('', $_SESSION['dol_login'], '', 1); $user->getrights(); + + // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. + $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1); + $menumanager->loadMenu(); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index f7813066a4c..2264fb3d9ee 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -482,7 +482,7 @@ class Ticket extends CommonObject global $langs; // Check parameters - if (!$id && !$track_id && !$ref) { + if (!$id && !$track_id && !$ref && !$email_msgid) { $this->error = 'ErrorWrongParameters'; dol_print_error(get_class($this)."::fetch ".$this->error); return -1; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 12dd4c37058..91d84270a30 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -659,11 +659,15 @@ foreach ($object->fields as $key => $val) if ($search[$key]) $selectedarray = array_values($search[$key]); print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', ''); print ''; - } elseif ($key == "fk_soc") - { + } elseif ($key == "fk_soc") { print ''; } else { - print ''; + print ''; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); + elseif (strpos($val['type'], 'integer:') === 0) { + print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + print ''; } } } diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index af81542d99a..82e268a6300 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -302,8 +302,8 @@ if ($object->id > 0) } print ' '; - // Module id - if ($user->admin) print ''.$objMod->numero.''; + // Permission id + if ($user->admin) print ''; print ''; } @@ -323,7 +323,10 @@ if ($object->id > 0) // Own permission by group if ($caneditperms) { - print 'id.'">'.img_edit_remove($langs->trans("Remove")).''; + print 'id.'">'; + //print img_edit_remove($langs->trans("Remove")); + print img_picto($langs->trans("Remove"), 'switch_on'); + print ''; } print ''; print img_picto($langs->trans("Active"), 'tick'); @@ -332,7 +335,10 @@ if ($object->id > 0) // Do not own permission if ($caneditperms) { - print 'id.'">'.img_edit_add($langs->trans("Add")).''; + print 'id.'">'; + //print img_edit_add($langs->trans("Add")); + print img_picto($langs->trans("Add"), 'switch_off'); + print ''; } print ' '; } @@ -340,7 +346,10 @@ if ($object->id > 0) // Do not own permission if ($caneditperms) { - print 'id.'">'.img_edit_add($langs->trans("Add")).''; + print 'id.'">'; + //print img_edit_add($langs->trans("Add")); + print img_picto($langs->trans("Add"), 'switch_off'); + print ''; } print ' '; } @@ -349,7 +358,7 @@ if ($object->id > 0) print ''.$permlabel.''; // Permission id - if ($user->admin) print ''.$obj->id.''; + if ($user->admin) print ''.$obj->id.''; print ''."\n"; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 97cf6007327..7672a3d8dbb 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -366,8 +366,8 @@ if ($result) } print ' '; - // Module Id - print ''; + // Permission id + if ($user->admin) print ''; print ''."\n"; } @@ -394,7 +394,10 @@ if ($result) { if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'.img_edit_remove($langs->trans("Remove")).''; + print 'id.'&confirm=yes&token='.newToken().'">'; + //print img_edit_remove($langs->trans("Remove")); + print img_picto($langs->trans("Remove"), 'switch_on'); + print ''; } print ''; print img_picto($langs->trans("Active"), 'tick'); @@ -416,7 +419,10 @@ if ($result) // Do not own permission if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'.img_edit_add($langs->trans("Add")).''; + print 'id.'&confirm=yes&token='.newToken().'">'; + //print img_edit_add($langs->trans("Add")); + print img_picto($langs->trans("Add"), 'switch_off'); + print ''; } print ' '; } @@ -424,7 +430,10 @@ if ($result) // Do not own permission if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'.img_edit_add($langs->trans("Add")).''; + print 'id.'&confirm=yes&token='.newToken().'">'; + //print img_edit_add($langs->trans("Add")); + print img_picto($langs->trans("Add"), 'switch_off'); + print ''; } print ' '; } @@ -434,7 +443,7 @@ if ($result) print ''.$permlabel.''; // Permission id - if ($user->admin) print ''.$obj->id.''; + if ($user->admin) print ''.$obj->id.''; print ''."\n"; diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php index 86342664c35..d97211d46bf 100644 --- a/htdocs/variants/admin/admin.php +++ b/htdocs/variants/admin/admin.php @@ -50,7 +50,9 @@ print load_fiche_titre($title, $linkback, 'title_setup'); dol_fiche_head(array(), 'general', $tab, 0, 'product'); -print '
'; +print ''; +print ''; + print ''; print ''; print '
'.$langs->trans("Parameters").''."\n"; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e62887407d6..ce3f41676a0 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -59,7 +59,7 @@ $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choi $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index 9d33a9801b0..efb02395e7b 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -38,7 +38,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'zapiercard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php index ac90713f13c..d36d909b399 100644 --- a/htdocs/zapier/hook_list.php +++ b/htdocs/zapier/hook_list.php @@ -41,7 +41,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'hooklist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'zapierlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index cf1cafe74b1..2a3cb079baf 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -141,6 +141,9 @@ class ExportTest extends PHPUnit\Framework\TestCase $model='csv'; + $conf->global->EXPORT_CSV_SEPARATOR_TO_USE = ','; + print 'EXPORT_CSV_SEPARATOR_TO_USE = '.$conf->global->EXPORT_CSV_SEPARATOR_TO_USE; + // Creation of class to export using model ExportXXX $dir = DOL_DOCUMENT_ROOT . "/core/modules/export/"; $file = "export_".$model.".modules.php"; @@ -161,7 +164,7 @@ class ExportTest extends PHPUnit\Framework\TestCase print __METHOD__." valtotest=".$valtotest."\n"; $result = $objmodel->csvClean($valtotest, $langs->charset_output); print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, '"A string with , and ; inside"'); + $this->assertEquals($result, '"A string with , and ; inside"', 'Error in csvClean for '.$file); $valtotest='A string with " inside'; print __METHOD__." valtotest=".$valtotest."\n"; @@ -182,7 +185,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $this->assertEquals($result, '"A string with html
content
inside"'); // Same tests with strict mode - $conf->global->USE_STRICT_CSV_RULES=1; + $conf->global->USE_STRICT_CSV_RULES = 1; $valtotest='A simple string'; print __METHOD__." valtotest=".$valtotest."\n"; @@ -245,7 +248,7 @@ class ExportTest extends PHPUnit\Framework\TestCase // Build export file print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); - $expectedresult=1; + $expectedresult = 1; $this->assertEquals($expectedresult, $result, 'Error in CSV export'); $model='tsv'; @@ -360,7 +363,7 @@ class ExportTest extends PHPUnit\Framework\TestCase // Build export file $sql = ""; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); - $expectedresult=1; + $expectedresult = 1; $this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed'); $result=dol_is_file($exportfile); $this->assertTrue($result, 'File '.$exportfile.' not found'); diff --git a/test/sqlmap/README b/test/sqlmap/README index da3a1ae6daf..c07730a48b6 100644 --- a/test/sqlmap/README +++ b/test/sqlmap/README @@ -43,7 +43,9 @@ Add, into file ~/git/sqlmap/data/xml/payloads/boolean_blind.xml, the custom rule Introduce a vulnerability by changing the GETPOST on parameter search_status into GETPOST('search_status', 'none') and removing $db->sanitize when parameter is used; -./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/comm/propal/list.php?search_status=*" --dbms=mysql --os=linux --technique=B --batch --skip-waf \ +./sqlmap.py --fresh-queries -u "http://localhostdev/comm/propal/list.php?search_status=*" + +./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/comm/propal/list.php?search_status=*" --dbms=mysql --os=linux --technique=B --batch --skip-waf \ --cookie="DOLSESSID_xxxxxx=yyyyyyyy;" --prefix='1' -v 4 > sqlmap.txt Check vulnerability is found into sqlmap.txt. Scanner is working.