From 4fecd01ddd0b24a9b91af67f816bdf5b89db1c0c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 10 Jun 2022 04:47:15 +0200 Subject: [PATCH 001/370] NEW Accountancy - Manage customer retained warranty --- htdocs/accountancy/admin/defaultaccounts.php | 3 + htdocs/accountancy/journal/sellsjournal.php | 115 ++++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 1 + 3 files changed, 116 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 583b12368dc..da590e80562 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -84,6 +84,9 @@ $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT'; if (!empty($conf->banque->enabled)) { $list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH'; } +if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { + $list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'; +} if (!empty($conf->don->enabled)) { $list_account[] = 'DONATION_ACCOUNTINGACCOUNT'; } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 426bc6d7795..a36f67f55f0 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud @@ -105,7 +105,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); } -$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,"; +$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { @@ -167,6 +167,7 @@ if ($result) { $tabht = array(); $tabtva = array(); $def_tva = array(); + $tabwarranty = array(); $tabttc = array(); $tablocaltax1 = array(); $tablocaltax2 = array(); @@ -247,7 +248,13 @@ if ($result) { $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; } - $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio; + $total_ttc = $obj->total_ttc * $situation_ratio; + if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) { + $retained_warranty = (double)price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); + $tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty; + $total_ttc -= $retained_warranty; + } + $tabttc[$obj->rowid][$compta_soc] += $total_ttc; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio; if (empty($line->tva_npr)) { $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR @@ -299,6 +306,10 @@ if ($action == 'writebookkeeping') { $accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + $accountingaccountcustomerwarranty = new AccountingAccount($db); + + $accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true); + foreach ($tabfac as $key => $val) { // Loop on each invoice $errorforline = 0; @@ -345,6 +356,55 @@ if ($action == 'writebookkeeping') { setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors'); } + // Warranty + if (!$errorforline) { + foreach ($tabwarranty[$key] as $k => $mt) { + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->date_lim_reglement = $val["datereg"]; + $bookkeeping->doc_ref = $val["ref"]; + $bookkeeping->date_creation = $now; + $bookkeeping->doc_type = 'customer_invoice'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add + $bookkeeping->thirdparty_code = $companystatic->code_client; + + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY; + $bookkeeping->label_compte = $accountingaccountcustomerwarranty->label; + + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty"); + $bookkeeping->montant = $mt; + $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; + $bookkeeping->debit = ($mt >= 0) ? $mt : 0; + $bookkeeping->credit = ($mt < 0) ? -$mt : 0; + $bookkeeping->code_journal = $journal; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); + $bookkeeping->fk_user_author = $user->id; + $bookkeeping->entity = $conf->entity; + + $totaldebit += $bookkeeping->debit; + $totalcredit += $bookkeeping->credit; + + $result = $bookkeeping->create($user); + if ($result < 0) { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists + $error++; + $errorforline++; + $errorforinvoice[$key] = 'alreadyjournalized'; + //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); + } else { + $error++; + $errorforline++; + $errorforinvoice[$key] = 'other'; + setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + } + } + } + } + // Thirdparty if (!$errorforline) { foreach ($tabttc[$key] as $k => $mt) { @@ -627,6 +687,25 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! continue; } + // Warranty + foreach ($tabwarranty[$key] as $k => $mt) { + //if ($mt) { + print '"'.$key.'"'.$sep; + print '"'.$date.'"'.$sep; + print '"'.$val["ref"].'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; + print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY).'"'.$sep; + print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.$langs->trans("Thirdparty").'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep; + print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; + print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; + print '"'.$journal.'"'; + print "\n"; + //} + } + // Third party foreach ($tabttc[$key] as $k => $mt) { //if ($mt) { @@ -852,6 +931,36 @@ if (empty($action) || $action == 'view') { print ""; } + // Warranty + foreach ($tabwarranty[$key] as $k => $mt) { + print ''; + print ""; + print "".$date.""; + print "".$invoicestatic->getNomUrl(1).""; + // Account + print ""; + $accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY); + if (($accountoshow == "") || $accountoshow == 'NotDefined') { + print ''.$langs->trans("MainAccountForCustomersNotDefined").''; + } else { + print $accountoshow; + } + print ''; + // Subledger account + print ""; + $accountoshow = length_accounta($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } else { + print $accountoshow; + } + print ''; + print "".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").""; + print ''.($mt >= 0 ? price($mt) : '').""; + print ''.($mt < 0 ? price(-$mt) : '').""; + print ""; + } + // Third party foreach ($tabttc[$key] as $k => $mt) { print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 0f85c4b1c33..8a6824f9eda 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -183,6 +183,7 @@ ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscript ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Accounting account by default to register customer deposit UseAuxiliaryAccountOnCustomerDeposit=Use sub-accounts on customer deposit lines +ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY=Accounting account by default to register customer retained warranty ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for the bought products (used if not defined in the product sheet) ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Accounting account by default for the bought products in EEC (used if not defined in the product sheet) From a1cec27540f190f2a1522a3392f8037d5f7bc554 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Jun 2022 02:53:13 +0000 Subject: [PATCH 002/370] Fixing style errors. --- htdocs/accountancy/journal/sellsjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index a36f67f55f0..cfa1f1d351f 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -250,7 +250,7 @@ if ($result) { $total_ttc = $obj->total_ttc * $situation_ratio; if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) { - $retained_warranty = (double)price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); + $retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); $tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty; $total_ttc -= $retained_warranty; } From 7a8006c0a0f02941a286301ac4129c54f0e90ac2 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 27 Jul 2022 14:40:45 +0200 Subject: [PATCH 003/370] init --- htdocs/commande/list.php | 179 ++++++++++++++++++++++++++++++++- htdocs/langs/en_US/orders.lang | 1 + 2 files changed, 179 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 264613ac597..00470b13afc 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -71,6 +71,15 @@ $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_end_mon $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_start_month', 'int'), GETPOST('search_datedelivery_start_day', 'int'), GETPOST('search_datedelivery_start_year', 'int')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_end_month', 'int'), GETPOST('search_datedelivery_end_day', 'int'), GETPOST('search_datedelivery_end_year', 'int')); $search_product_category = GETPOST('search_product_category', 'int'); +/* +// Détail commande +*/ +$search_refProduct = GETPOST('search_refProduct', 'alpha'); +$search_descProduct = GETPOST('search_descProduct', 'alpha'); +$check_orderdetail = GETPOST('check_orderdetail', 'alpha'); +/* +// Détail commande fin +*/ $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); @@ -204,6 +213,17 @@ $arrayfields = array( 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); +/* + // Détail commande fin + */ +if (!empty($check_orderdetail)) { + $arrayfields['cdet.qty'] = array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1); + $arrayfields['pr.desc'] = array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1); + $arrayfields['pr.ref'] = array('label'=>'ProductRef', 'checked'=>1, 'position'=>1); +} + /* + // Détail commande fin + */ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -789,6 +809,16 @@ $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label, $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_input_reason, c.import_key'; +/* +// Détail commande +*/ +if (!empty($check_orderdetail)) { + $sql .= ', cdet.description, cdet.qty, '; + $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; +} +/* +// Détail commande fin +*/ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; } @@ -809,7 +839,19 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } -$sql .= ', '.MAIN_DB_PREFIX.'commande as c'; +/* +// Détail commande +*/ +if (!empty($check_orderdetail)) { + $sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; +} else { + $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; +} +/* +// Détail commande fin +*/ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; } @@ -1310,6 +1352,13 @@ if ($resql) { print ''; print '
'; } + /* + // Détail commande + */ + print '
 
'; + /* + // Détail commande fin + */ if ($sall) { foreach ($fieldstosearchall as $key => $val) { @@ -1391,6 +1440,27 @@ if ($resql) { print ''."\n"; print ''; + /* + // Détail commande + */ + if (!empty($arrayfields['pr.ref']['checked'])) { + print ''; + } + // Product Description + if (!empty($arrayfields['pr.desc']['checked'])) { + print ''; + } + // Product QtyOrdered + if (!empty($arrayfields['cdet.qty']['checked'])) { + print ''; + } + /* + // Détail commande fin + */ // Ref if (!empty($arrayfields['c.ref']['checked'])) { print ''; + + /* + // Détail commande + */ + if (!empty($arrayfields['pr.ref']['checked'])) { + print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['pr.desc']['checked'])) { + print_liste_field_titre($arrayfields['pr.desc']['label'], $_SERVER["PHP_SELF"], 'pr.desc', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['cdet.qty']['checked'])) { + print_liste_field_titre($arrayfields['cdet.qty']['label'], $_SERVER["PHP_SELF"], 'cdet.qty', '', $param, '', $sortfield, $sortorder); + } + /* + // Détail commande fin + */ if (!empty($arrayfields['c.ref']['checked'])) { print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder); } @@ -1820,6 +1906,14 @@ if ($resql) { } $total_ht = 0; $total_margin = 0; + /* + // Détail commande + */ + $totalqty = 0; + /* + // Détail commande fin + */ + $imaxinloop = ($limit ? min($num, $limit) : $num); $last_num = min($num, $limit); @@ -1872,9 +1966,92 @@ if ($resql) { $total_ht += $obj->total_ht; $total_margin += $marginInfo['total_margin']; } + /* + // Détail commande + *//* + if (isset($refpre) && $obj->product_ref != $refpre) { + print ''; + $i = 0; + // var_dump($totalarray); + while ($i < $totalarray['nbfield']) { + $i++; + if (!empty($totalarray['pos'][$i]) && $totalarray['pos'][$i] == 'cdet.qty') { + print ''; + } elseif ($i == 1) { + print ''; + } else { + print ''; + } + } + print ''; + $totalqty = $obj->qty; + //include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + + } else { + $totalqty = $totalqty + $obj->qty; + } + $refpre = isset($obj->product_ref) ? $obj->product_ref : ''; + /* + // Détail commande fin + */ print ''; + /* + // Détail commande + */ + // Product Ref + if (!empty($arrayfields['pr.ref']['checked'])) { + if (!empty($obj->product_rowid)) { + $generic_product->id = $obj->product_rowid; + $generic_product->ref = $obj->product_ref; + $generic_product->label = $obj->product_label; + $generic_product->status = $obj->product_status; + $generic_product->status_buy = $obj->product_status_buy; + $generic_product->status_batch = $obj->product_batch; + $generic_product->barcode = $obj->product_barcode; + print ''; + } else { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Product Description + if (!empty($arrayfields['pr.desc']['checked'])) { + // print ''; + !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description; + print ''; + + if (!$i) { + $totalarray['nbfield']++; + } + } + // Product QtyOrdered + if (!empty($arrayfields['cdet.qty']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; + } + if (isset($totalarray['val']['cdet.qty'])) { + $totalarray['val']['cdet.qty'] += $obj->qty; + } else { + $totalarray['val']['cdet.qty'] = $obj->qty; + } + } + /* + // Détail commande fin + */ // Ref if (!empty($arrayfields['c.ref']['checked'])) { print ''; - /* - // Détail commande - */ +// Détail commande if (!empty($arrayfields['pr.ref']['checked'])) { print ''; } - /* - // Détail commande fin - */ // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { @@ -1737,9 +1717,7 @@ if ($resql) { // Fields title print ''; - /* // Détail commande - */ if (!empty($arrayfields['pr.ref']['checked'])) { print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); } @@ -1749,9 +1727,6 @@ if ($resql) { if (!empty($arrayfields['cdet.qty']['checked'])) { print_liste_field_titre($arrayfields['cdet.qty']['label'], $_SERVER["PHP_SELF"], 'cdet.qty', '', $param, '', $sortfield, $sortorder); } - /* - // Détail commande fin - */ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); @@ -1927,14 +1902,9 @@ if ($resql) { } $total_ht = 0; $total_margin = 0; - /* + // Détail commande - */ $totalqty = 0; - /* - // Détail commande fin - */ - $imaxinloop = ($limit ? min($num, $limit) : $num); $last_num = min($num, $limit); @@ -1987,46 +1957,10 @@ if ($resql) { $total_ht += $obj->total_ht; $total_margin += $marginInfo['total_margin']; } - /* - // Détail commande - *//* - if (isset($refpre) && $obj->product_ref != $refpre) { - print ''; - $i = 0; - // var_dump($totalarray); - while ($i < $totalarray['nbfield']) { - $i++; - if (!empty($totalarray['pos'][$i]) && $totalarray['pos'][$i] == 'cdet.qty') { - print ''; - } elseif ($i == 1) { - print ''; - } else { - print ''; - } - } - print ''; - $totalqty = $obj->qty; - //include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; - - } else { - $totalqty = $totalqty + $obj->qty; - } - $refpre = isset($obj->product_ref) ? $obj->product_ref : ''; - /* - // Détail commande fin - */ print ''; - /* // Détail commande - */ // Product Ref if (!empty($arrayfields['pr.ref']['checked'])) { if (!empty($obj->product_rowid)) { @@ -2070,9 +2004,6 @@ if ($resql) { $totalarray['val']['cdet.qty'] = $obj->qty; } } - /* - // Détail commande fin - */ // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { From 887d30e1b46b72c54972d84f205ea76716a51021 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 16:01:45 +0200 Subject: [PATCH 005/370] Add option ORDER_ADD_OPTION_SHOW_DETAIL_LIST --- htdocs/commande/list.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 00e87be1411..02ac878ecee 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1345,8 +1345,9 @@ if ($resql) { } // Détail commande - print '
 
'; - + if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)){ + print '
 
'; + } if ($sall) { foreach ($fieldstosearchall as $key => $val) { @@ -1429,7 +1430,7 @@ if ($resql) { print '
'; -// Détail commande + // Détail commande if (!empty($arrayfields['pr.ref']['checked'])) { print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + // Détail commande if (!empty($arrayfields['pr.ref']['checked'])) { print ''; } - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - } - // Ref if (!empty($arrayfields['c.ref']['checked'])) { print ''; + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); + } + // Détail commande if (!empty($arrayfields['pr.ref']['checked'])) { + var_dump($_SERVER["PHP_SELF"]); print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['pr.desc']['checked'])) { @@ -1738,10 +1743,6 @@ if ($resql) { print_liste_field_titre($arrayfields['cdet.qty']['label'], $_SERVER["PHP_SELF"], 'cdet.qty', '', $param, '', $sortfield, $sortorder); } - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - if (!empty($arrayfields['c.ref']['checked'])) { print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder); } @@ -1970,6 +1971,18 @@ if ($resql) { print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; } - // Détail commande - if (!empty($arrayfields['pr.ref']['checked'])) { - print ''; - } + // Product Description if (!empty($arrayfields['pr.desc']['checked'])) { print ''; - } else { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Product Description - if (!empty($arrayfields['pr.desc']['checked'])) { - // print ''; - !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description; - print ''; - - if (!$i) { - $totalarray['nbfield']++; - } - } - // Product QtyOrdered - if (!empty($arrayfields['cdet.qty']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; - } - if (isset($totalarray['val']['cdet.qty'])) { - $totalarray['val']['cdet.qty'] += $obj->qty; - } else { - $totalarray['val']['cdet.qty'] = $obj->qty; - } - } - // Ref if (!empty($arrayfields['c.ref']['checked'])) { print ''; print ''; print '
'; + print ''; + print ''; + print ''; + print ''; @@ -1652,6 +1722,22 @@ if ($resql) { // Fields title print '
'.$totalqty.''; + if (is_object($form)) { + print $form->textwithpicto($langs->trans("Total"), $langs->transnoentitiesnoconv("Totalforthispage")); + } else { + print $langs->trans("Totalforthispage"); + } + print '
'.$generic_product->getNomUrl(1).'Ligne libre'.$obj->description.''.dol_escape_htmltag($labelproduct).''.$obj->qty.''; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index a4261f8e62c..acb880fa4f3 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -130,6 +130,7 @@ SupplierOrderClassifiedBilled=Purchase Order %s set billed OtherOrders=Other orders SupplierOrderValidatedAndApproved=Supplier order is validated and approved : %s SupplierOrderValidated=Supplier order is validated : %s +OrderShowDetail=Show order detail ##### Types de contacts ##### TypeContact_commande_internal_SALESREPFOLL=Representative following-up sales order TypeContact_commande_internal_SHIPPING=Representative following-up shipping From 0e796a2a02a3a4ff21ac30db67cdaf1c45d016f9 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 15:35:35 +0200 Subject: [PATCH 004/370] Clean --- htdocs/commande/list.php | 97 ++++++---------------------------------- 1 file changed, 14 insertions(+), 83 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index c58cc12a21c..00e87be1411 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2021 Anthony Berton + * Copyright (C) 2021-2022 Anthony Berton * * 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 @@ -71,15 +71,12 @@ $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_end_mon $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_start_month', 'int'), GETPOST('search_datedelivery_start_day', 'int'), GETPOST('search_datedelivery_start_year', 'int')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_end_month', 'int'), GETPOST('search_datedelivery_end_day', 'int'), GETPOST('search_datedelivery_end_year', 'int')); $search_product_category = GETPOST('search_product_category', 'int'); -/* + // Détail commande -*/ $search_refProduct = GETPOST('search_refProduct', 'alpha'); $search_descProduct = GETPOST('search_descProduct', 'alpha'); $check_orderdetail = GETPOST('check_orderdetail', 'alpha'); -/* -// Détail commande fin -*/ + $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); @@ -213,17 +210,14 @@ $arrayfields = array( 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); -/* - // Détail commande fin - */ + +// Détail commande if (!empty($check_orderdetail)) { $arrayfields['cdet.qty'] = array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1); $arrayfields['pr.desc'] = array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1); $arrayfields['pr.ref'] = array('label'=>'ProductRef', 'checked'=>1, 'position'=>1); } - /* - // Détail commande fin - */ + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -812,16 +806,13 @@ $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label, $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_input_reason, c.import_key'; -/* + // Détail commande -*/ if (!empty($check_orderdetail)) { $sql .= ', cdet.description, cdet.qty, '; $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; } -/* -// Détail commande fin -*/ + if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; } @@ -842,9 +833,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } -/* + // Détail commande -*/ if (!empty($check_orderdetail)) { $sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; @@ -852,9 +842,7 @@ if (!empty($check_orderdetail)) { } else { $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; } -/* -// Détail commande fin -*/ + if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; } @@ -1355,13 +1343,10 @@ if ($resql) { print ''; print '
'; } - /* + // Détail commande - */ print '
 
'; - /* - // Détail commande fin - */ + if ($sall) { foreach ($fieldstosearchall as $key => $val) { @@ -1444,9 +1429,7 @@ if ($resql) { print '
'; print ''; @@ -1462,9 +1445,6 @@ if ($resql) { if (!empty($arrayfields['cdet.qty']['checked'])) { print '
'.$totalqty.''; - if (is_object($form)) { - print $form->textwithpicto($langs->trans("Total"), $langs->transnoentitiesnoconv("Totalforthispage")); - } else { - print $langs->trans("Totalforthispage"); - } - print '
'; print ''; From 7df1f876f51aca06b1e747abb0bf05c2b8ed2095 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 16:02:27 +0200 Subject: [PATCH 006/370] Add removefilter --- htdocs/commande/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 02ac878ecee..b6490def16a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -253,6 +253,8 @@ if (empty($reshook)) { $search_user = ''; $search_sale = ''; $search_product_category = ''; + $search_refProduct = ''; + $search_descProduct = ''; $search_ref = ''; $search_ref_customer = ''; $search_company = ''; From 5f3dc1b01fd1a4526b6b04f5588a3643d1d95f30 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 16:11:16 +0200 Subject: [PATCH 007/370] Add search in sql --- htdocs/commande/list.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b6490def16a..882c56ca033 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -882,6 +882,13 @@ if ($socid > 0) { if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } +if ($search_refProduct) { + $sql .= natural_search('pr.ref', $search_refProduct); +} +if ($search_descProduct) { + $sql .= natural_search('pr.label', $search_descProduct); + $sql .= natural_search('cdet.description', $search_descProduct); +} if ($search_ref) { $sql .= natural_search('c.ref', $search_ref); } From 7740c81f3b55fff507b733c6daa32cc71962f1be Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 27 Jul 2022 14:38:59 +0000 Subject: [PATCH 008/370] Fixing style errors. --- htdocs/commande/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 882c56ca033..1c5499e6e8c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1352,9 +1352,9 @@ if ($resql) { print ''; print '
'; } - + // Détail commande - if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)){ + if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)) { print '
 
'; } @@ -1912,7 +1912,7 @@ if ($resql) { } $total_ht = 0; $total_margin = 0; - + // Détail commande $totalqty = 0; From 716adb103fc7a67a1ad18f7b5b883b09215eb4ab Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 16:52:48 +0200 Subject: [PATCH 009/370] FIX - Error with MAIN_CHECKBOX_LEFT_COLUMN --- htdocs/commande/list.php | 49 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 882c56ca033..a8d96597cc7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1439,6 +1439,14 @@ if ($resql) { print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; @@ -1456,14 +1464,6 @@ if ($resql) { print ''; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; @@ -1727,8 +1727,13 @@ if ($resql) { // Fields title print '
'; + 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 ''; + } + } + // Détail commande // Product Ref if (!empty($arrayfields['pr.ref']['checked'])) { @@ -2015,18 +2028,6 @@ if ($resql) { } } - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - 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 ''; - } - } - // Ref if (!empty($arrayfields['c.ref']['checked'])) { print ''; From 8dfb4288ecb950004147bc2c47f12f42bbcd262f Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 17:27:05 +0200 Subject: [PATCH 010/370] Clean --- htdocs/commande/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 47d139c696a..ac1885b03af 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1733,7 +1733,6 @@ if ($resql) { // Détail commande if (!empty($arrayfields['pr.ref']['checked'])) { - var_dump($_SERVER["PHP_SELF"]); print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['pr.desc']['checked'])) { From 1769530cfd5837fb4b163197d742ba8ce15bbe99 Mon Sep 17 00:00:00 2001 From: Antonio Date: Sat, 30 Jul 2022 12:12:19 -0500 Subject: [PATCH 011/370] agregar un mensaje de error traducido al espanol --- htdocs/public/error-401.php | 5 +++++ htdocs/public/error-404.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/htdocs/public/error-401.php b/htdocs/public/error-401.php index 3d453cd30e5..a160535ff10 100644 --- a/htdocs/public/error-401.php +++ b/htdocs/public/error-401.php @@ -20,6 +20,11 @@
Sorry. You are not allowed to access this resource. +
+
+ + No esta autorizado para acceder a este recurso. +
diff --git a/htdocs/public/error-404.php b/htdocs/public/error-404.php index c964e49cd85..84832100026 100644 --- a/htdocs/public/error-404.php +++ b/htdocs/public/error-404.php @@ -20,6 +20,10 @@
You requested a website or a page that does not exists. +
+
+ la pagina o el recurso solicitado no existe. +
From dac8613c396edb0f815ee9794469300c96d92abe Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 10:46:09 +0200 Subject: [PATCH 012/370] Add new file --- htdocs/commande/list.php | 96 +- htdocs/commande/list_line.php | 2660 +++++++++++++++++++++++++++++++++ 2 files changed, 2671 insertions(+), 85 deletions(-) create mode 100644 htdocs/commande/list_line.php diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ac1885b03af..1b74238db1c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2021 Anthony Berton * * 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 @@ -72,10 +72,7 @@ $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_st $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_end_month', 'int'), GETPOST('search_datedelivery_end_day', 'int'), GETPOST('search_datedelivery_end_year', 'int')); $search_product_category = GETPOST('search_product_category', 'int'); -// Détail commande -$search_refProduct = GETPOST('search_refProduct', 'alpha'); -$search_descProduct = GETPOST('search_descProduct', 'alpha'); -$check_orderdetail = GETPOST('check_orderdetail', 'alpha'); + $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); @@ -211,12 +208,7 @@ $arrayfields = array( 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); -// Détail commande -if (!empty($check_orderdetail)) { - $arrayfields['cdet.qty'] = array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1); - $arrayfields['pr.desc'] = array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1); - $arrayfields['pr.ref'] = array('label'=>'ProductRef', 'checked'=>1, 'position'=>1); -} + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -809,11 +801,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as u $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_input_reason, c.import_key'; -// Détail commande -if (!empty($check_orderdetail)) { - $sql .= ', cdet.description, cdet.qty, '; - $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; -} + if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; @@ -836,14 +824,9 @@ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } -// Détail commande -if (!empty($check_orderdetail)) { - $sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; -} else { - $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; -} + +$sql .= ', '.MAIN_DB_PREFIX.'commande as c'; + if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; @@ -1353,10 +1336,7 @@ if ($resql) { print '
'; } - // Détail commande - if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)) { - print '
 
'; - } + if ($sall) { foreach ($fieldstosearchall as $key => $val) { @@ -1447,12 +1427,7 @@ if ($resql) { print '
'; - print ''; - print ''; @@ -1731,10 +1706,7 @@ if ($resql) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); } - // Détail commande - if (!empty($arrayfields['pr.ref']['checked'])) { - print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); - } + if (!empty($arrayfields['pr.desc']['checked'])) { print_liste_field_titre($arrayfields['pr.desc']['label'], $_SERVER["PHP_SELF"], 'pr.desc', '', $param, '', $sortfield, $sortorder); } @@ -1913,8 +1885,7 @@ if ($resql) { $total_ht = 0; $total_margin = 0; - // Détail commande - $totalqty = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); $last_num = min($num, $limit); @@ -1982,51 +1953,6 @@ if ($resql) { } } - // Détail commande - // Product Ref - if (!empty($arrayfields['pr.ref']['checked'])) { - if (!empty($obj->product_rowid)) { - $generic_product->id = $obj->product_rowid; - $generic_product->ref = $obj->product_ref; - $generic_product->label = $obj->product_label; - $generic_product->status = $obj->product_status; - $generic_product->status_buy = $obj->product_status_buy; - $generic_product->status_batch = $obj->product_batch; - $generic_product->barcode = $obj->product_barcode; - print ''.$generic_product->getNomUrl(1).'Ligne libre'.$obj->description.''.dol_escape_htmltag($labelproduct).''.$obj->qty.''; diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php new file mode 100644 index 00000000000..ac1885b03af --- /dev/null +++ b/htdocs/commande/list_line.php @@ -0,0 +1,2660 @@ + + * Copyright (C) 2004-2019 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015-2018 Frédéric France + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016-2021 Ferran Marcet + * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2021-2022 Anthony Berton + * + * 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 . + */ + +/** + * \file htdocs/commande/list.php + * \ingroup commande + * \brief Page to list orders + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +if (!empty($conf->margin->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; +} +require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); + +$action = GETPOST('action', 'aZ09'); +$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') : 'orderlist'; + +$search_datecloture_start = GETPOST('search_datecloture_start', 'int'); +if (empty($search_datecloture_start)) { + $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); +} +$search_datecloture_end = GETPOST('search_datecloture_end', 'int'); +if (empty($search_datecloture_end)) { + $search_datecloture_end = dol_mktime(23, 59, 59, GETPOST('search_datecloture_endmonth', 'int'), GETPOST('search_datecloture_endday', 'int'), GETPOST('search_datecloture_endyear', 'int')); +} +$search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_start_month', 'int'), GETPOST('search_dateorder_start_day', 'int'), GETPOST('search_dateorder_start_year', 'int')); +$search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_end_month', 'int'), GETPOST('search_dateorder_end_day', 'int'), GETPOST('search_dateorder_end_year', 'int')); +$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_start_month', 'int'), GETPOST('search_datedelivery_start_day', 'int'), GETPOST('search_datedelivery_start_year', 'int')); +$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_end_month', 'int'), GETPOST('search_datedelivery_end_day', 'int'), GETPOST('search_datedelivery_end_year', 'int')); +$search_product_category = GETPOST('search_product_category', 'int'); + +// Détail commande +$search_refProduct = GETPOST('search_refProduct', 'alpha'); +$search_descProduct = GETPOST('search_descProduct', 'alpha'); +$check_orderdetail = GETPOST('check_orderdetail', 'alpha'); + +$search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); +$search_ref_customer = GETPOST('search_ref_customer', 'alpha'); +$search_company = GETPOST('search_company', 'alpha'); +$search_company_alias = GETPOST('search_company_alias', 'alpha'); +$search_town = GETPOST('search_town', 'alpha'); +$search_zip = GETPOST('search_zip', 'alpha'); +$search_state = GETPOST("search_state", 'alpha'); +$search_country = GETPOST("search_country", 'int'); +$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); +$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$socid = GETPOST('socid', 'int'); +$search_user = GETPOST('search_user', 'int'); +$search_sale = GETPOST('search_sale', 'int'); +$search_total_ht = GETPOST('search_total_ht', 'alpha'); +$search_total_vat = GETPOST('search_total_vat', 'alpha'); +$search_total_ttc = GETPOST('search_total_ttc', 'alpha'); +$search_warehouse = GETPOST('search_warehouse', 'int'); +$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha'); +$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha'); +$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha'); +$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha'); +$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha'); +$search_login = GETPOST('search_login', 'alpha'); +$search_categ_cus = GETPOST("search_categ_cus", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); +$search_billed = GETPOSTISSET('search_billed') ? GETPOST('search_billed', 'int') : GETPOST('billed', 'int'); +$search_status = GETPOST('search_status', 'int'); +$search_btn = GETPOST('button_search', 'alpha'); +$search_remove_btn = GETPOST('button_removefilter', 'alpha'); +$search_project_ref = GETPOST('search_project_ref', 'alpha'); +$search_project = GETPOST('search_project', 'alpha'); +$search_shippable = GETPOST('search_shippable', 'aZ09'); +$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); +$search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int'); +$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int'); +$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int'); + +// Security check +$id = (GETPOST('orderid') ?GETPOST('orderid', 'int') : GETPOST('id', 'int')); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'commande', $id, ''); + +$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; + +// Load variable for pagination +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $page = 0; +} // If $page is not defined, or '' or -1 or if we click on clear filters +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = 'c.ref'; +} +if (!$sortorder) { + $sortorder = 'DESC'; +} + +$show_shippable_command = GETPOST('show_shippable_command', 'aZ09'); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new Commande($db); +$hookmanager->initHooks(array('orderlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'c.ref'=>'Ref', + 'c.ref_client'=>'RefCustomerOrder', + 'pd.description'=>'Description', + 's.nom'=>"ThirdParty", + 's.name_alias'=>"AliasNameShort", + 's.zip'=>"Zip", + 's.town'=>"Town", + 'c.note_public'=>'NotePublic', +); +if (empty($user->socid)) { + $fieldstosearchall["c.note_private"] = "NotePrivate"; +} + +$checkedtypetiers = 0; +$arrayfields = array( + 'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), + 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>20), + 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>25), + 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), + 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31), + 's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35), + 's.zip'=>array('label'=>"Zip", 'checked'=>-1, 'position'=>40), + 'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>45), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0, 'position'=>50), + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>55), + 'c.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1, 'position'=>60), + 'c.date_delivery'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE), 'position'=>65), + 'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>-1, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)), + 'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>-1, 'position'=>67), + 'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>-1, 'position'=>68), + 'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>-1, 'position'=>69), + 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), + 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80), + 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), + 'c.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>90), + 'c.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>95), + 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100), + 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), + 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), + 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), + 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), + 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), + 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), + 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), + 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), + 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), + 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), + 'c.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>135), + 'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140), + 'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990), + 'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995), + 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), + 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) +); + +// Détail commande +if (!empty($check_orderdetail)) { + $arrayfields['cdet.qty'] = array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1); + $arrayfields['pr.desc'] = array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1); + $arrayfields['pr.ref'] = array('label'=>'ProductRef', 'checked'=>1, 'position'=>1); +} + +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); + + + +/* + * Actions + */ + +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { + $massaction = ''; +} + +$parameters = array('socid'=>$socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // 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 + $search_categ = ''; + $search_user = ''; + $search_sale = ''; + $search_product_category = ''; + $search_refProduct = ''; + $search_descProduct = ''; + $search_ref = ''; + $search_ref_customer = ''; + $search_company = ''; + $search_company_alias = ''; + $search_town = ''; + $search_zip = ""; + $search_state = ""; + $search_type = ''; + $search_country = ''; + $search_type_thirdparty = ''; + $search_total_ht = ''; + $search_total_vat = ''; + $search_total_ttc = ''; + $search_warehouse = ''; + $search_multicurrency_code = ''; + $search_multicurrency_tx = ''; + $search_multicurrency_montant_ht = ''; + $search_multicurrency_montant_vat = ''; + $search_multicurrency_montant_ttc = ''; + $search_login = ''; + $search_dateorder_start = ''; + $search_dateorder_end = ''; + $search_datedelivery_start = ''; + $search_datedelivery_end = ''; + $search_project_ref = ''; + $search_project = ''; + $search_status = ''; + $search_billed = ''; + $toselect = array(); + $search_array_options = array(); + $search_categ_cus = 0; + $search_datecloture_start = ''; + $search_datecloture_end = ''; + $search_fk_cond_reglement = ''; + $search_fk_shipping_method = ''; + $search_fk_mode_reglement = ''; + $search_fk_input_reason = ''; + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + $objectclass = 'Commande'; + $objectlabel = 'Orders'; + $permissiontoread = $user->rights->commande->lire; + $permissiontoadd = $user->rights->commande->creer; + $permissiontodelete = $user->rights->commande->supprimer; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $permissiontovalidate = $user->rights->commande->order_advance->validate; + $permissiontoclose = $user->rights->commande->order_advance->close; + $permissiontocancel = $user->rights->commande->order_advance->annuler; + $permissiontosendbymail = $user->rights->commande->order_advance->send; + } else { + $permissiontovalidate = $user->rights->commande->creer; + $permissiontoclose = $user->rights->commande->creer; + $permissiontocancel = $user->rights->commande->creer; + $permissiontosendbymail = $user->rights->commande->creer; + } + $uploaddir = $conf->commande->multidir_output[$conf->entity]; + $triggersendname = 'ORDER_SENTBYMAIL'; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + + if ($massaction == 'confirm_createbills') { // Create bills from orders. + $orders = GETPOST('toselect', 'array'); + $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); + $validate_invoices = GETPOST('validate_invoices', 'int'); + + $errors = array(); + + $TFact = array(); + $TFactThird = array(); + $TFactThirdNbLines = array(); + + $nb_bills_created = 0; + $lastid= 0; + $lastref = ''; + + $db->begin(); + + $nbOrders = is_array($orders) ? count($orders) : 1; + + foreach ($orders as $id_order) { + $cmd = new Commande($db); + if ($cmd->fetch($id_order) <= 0) { + continue; + } + $cmd->fetch_thirdparty(); + + $objecttmp = new Facture($db); + if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) { + // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it. + $objecttmp = $TFactThird[$cmd->socid]; + } else { + // If we want one invoice per order or if there is no first invoice yet for this thirdparty. + $objecttmp->socid = $cmd->socid; + $objecttmp->thirdparty = $cmd->thirdparty; + + $objecttmp->type = $objecttmp::TYPE_STANDARD; + $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id; + $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id; + + $objecttmp->fk_project = $cmd->fk_project; + $objecttmp->multicurrency_code = $cmd->multicurrency_code; + if (empty($createbills_onebythird)) { + $objecttmp->ref_client = $cmd->ref_client; + } + + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + if (empty($datefacture)) { + $datefacture = dol_now(); + } + + $objecttmp->date = $datefacture; + $objecttmp->origin = 'commande'; + $objecttmp->origin_id = $id_order; + + $objecttmp->array_options = $cmd->array_options; // Copy extrafields + + $res = $objecttmp->create($user); + + if ($res > 0) { + $nb_bills_created++; + $lastref = $objecttmp->ref; + $lastid = $objecttmp->id; + + $TFactThird[$cmd->socid] = $objecttmp; + $TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang + } else { + $langs->load("errors"); + $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]); + $error++; + } + } + + if ($objecttmp->id > 0) { + $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order); + + if ($res == 0) { + $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]); + $error++; + } + + if (!$error) { + $lines = $cmd->lines; + if (empty($lines) && method_exists($cmd, 'fetch_lines')) { + $cmd->fetch_lines(); + $lines = $cmd->lines; + } + + $fk_parent_line = 0; + $num = count($lines); + + for ($i = 0; $i < $num; $i++) { + $desc = ($lines[$i]->desc ? $lines[$i]->desc : ''); + // If we build one invoice for several orders, we must put the ref of order on the invoice line + if (!empty($createbills_onebythird)) { + $desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day')); + } + + if ($lines[$i]->subprice < 0) { + // Negative line, we create a discount line + $discount = new DiscountAbsolute($db); + $discount->fk_soc = $objecttmp->socid; + $discount->amount_ht = abs($lines[$i]->total_ht); + $discount->amount_tva = abs($lines[$i]->total_tva); + $discount->amount_ttc = abs($lines[$i]->total_ttc); + $discount->tva_tx = $lines[$i]->tva_tx; + $discount->fk_user = $user->id; + $discount->description = $desc; + $discountid = $discount->create($user); + if ($discountid > 0) { + $result = $objecttmp->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } else { + setEventMessages($discount->error, $discount->errors, 'errors'); + $error++; + break; + } + } else { + // Positive line + $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); + // Date start + $date_start = false; + if ($lines[$i]->date_debut_prevue) { + $date_start = $lines[$i]->date_debut_prevue; + } + if ($lines[$i]->date_debut_reel) { + $date_start = $lines[$i]->date_debut_reel; + } + if ($lines[$i]->date_start) { + $date_start = $lines[$i]->date_start; + } + //Date end + $date_end = false; + if ($lines[$i]->date_fin_prevue) { + $date_end = $lines[$i]->date_fin_prevue; + } + if ($lines[$i]->date_fin_reel) { + $date_end = $lines[$i]->date_fin_reel; + } + if ($lines[$i]->date_end) { + $date_end = $lines[$i]->date_end; + } + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { + $fk_parent_line = 0; + } + + // Extrafields + if (method_exists($lines[$i], 'fetch_optionals')) { + $lines[$i]->fetch_optionals(); + $array_options = $lines[$i]->array_options; + } + + $objecttmp->context['createfromclone']; + + $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang; + //there may already be rows from previous orders + if (!empty($createbills_onebythird)) { + $rang = $TFactThirdNbLines[$cmd->socid]; + } + + $result = $objecttmp->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $rang, + $lines[$i]->special_code, + $objecttmp->origin, + $lines[$i]->rowid, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht, + $lines[$i]->label, + $array_options, + 100, + 0, + $lines[$i]->fk_unit + ); + if ($result > 0) { + $lineid = $result; + if (!empty($createbills_onebythird)) //increment rang to keep order + $TFactThirdNbLines[$rcp->socid]++; + } else { + $lineid = 0; + $error++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) { + $fk_parent_line = $result; + } + } + } + } + } + + //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. + + if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) { + $TFactThird[$cmd->socid] = $objecttmp; + } else { + $TFact[$objecttmp->id] = $objecttmp; + } + } + + // Build doc with all invoices + $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; + $toselect = array(); + + if (!$error && $validate_invoices) { + $massaction = $action = 'builddoc'; + + foreach ($TAllFact as &$objecttmp) { + $result = $objecttmp->validate($user); + if ($result <= 0) { + $error++; + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + break; + } + + $id = $objecttmp->id; // For builddoc action + + // Builddoc + $donotredirect = 1; + $upload_dir = $conf->facture->dir_output; + $permissiontoadd = $user->rights->facture->creer; + + // Call action to build doc + $savobject = $object; + $object = $objecttmp; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $object = $savobject; + } + + $massaction = $action = 'confirm_createbills'; + } + + if (!$error) { + $db->commit(); + + if ($nb_bills_created == 1) { + $texttoshow = $langs->trans('BillXCreated', '{s1}'); + $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); + setEventMessages($texttoshow, null, 'mesgs'); + } else { + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); + } + + // Make a redirect to avoid to bill twice if we make a refresh or back + $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 ($socid > 0) { + $param .= '&socid='.urlencode($socid); + } + if ($search_status != '') { + $param .= '&search_status='.urlencode($search_status); + } + if ($search_orderday) { + $param .= '&search_orderday='.urlencode($search_orderday); + } + if ($search_ordermonth) { + $param .= '&search_ordermonth='.urlencode($search_ordermonth); + } + if ($search_orderyear) { + $param .= '&search_orderyear='.urlencode($search_orderyear); + } + if ($search_deliveryday) { + $param .= '&search_deliveryday='.urlencode($search_deliveryday); + } + if ($search_deliverymonth) { + $param .= '&search_deliverymonth='.urlencode($search_deliverymonth); + } + if ($search_deliveryyear) { + $param .= '&search_deliveryyear='.urlencode($search_deliveryyear); + } + if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); + } + if ($search_company) { + $param .= '&search_company='.urlencode($search_company); + } + if ($search_ref_customer) { + $param .= '&search_ref_customer='.urlencode($search_ref_customer); + } + if ($search_user > 0) { + $param .= '&search_user='.urlencode($search_user); + } + if ($search_sale > 0) { + $param .= '&search_sale='.urlencode($search_sale); + } + if ($search_total_ht != '') { + $param .= '&search_total_ht='.urlencode($search_total_ht); + } + if ($search_total_vat != '') { + $param .= '&search_total_vat='.urlencode($search_total_vat); + } + if ($search_total_ttc != '') { + $param .= '&search_total_ttc='.urlencode($search_total_ttc); + } + if ($search_project_ref >= 0) { + $param .= "&search_project_ref=".urlencode($search_project_ref); + } + if ($show_files) { + $param .= '&show_files='.urlencode($show_files); + } + if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); + } + if ($billed != '') { + $param .= '&billed='.urlencode($billed); + } + + header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); + exit; + } else { + $db->rollback(); + + $action = 'create'; + $_GET["origin"] = $_POST["origin"]; + $_GET["originid"] = $_POST["originid"]; + if (!empty($errors)) { + setEventMessages(null, $errors, 'errors'); + } else { + setEventMessages("Error", null, 'errors'); + } + $error++; + } + } +} +if ($action == 'validate' && $permissiontoadd) { + if (GETPOST('confirm') == 'yes') { + $objecttmp = new $objectclass($db); + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($objecttmp->fetch($checked)) { + if ($objecttmp->statut == 0) { + if (!empty($objecttmp->fk_warehouse)) { + $idwarehouse = $objecttmp->fk_warehouse; + } else { + $idwarehouse = 0; + } + if ($objecttmp->valid($user, $idwarehouse)) { + setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs'); + } else { + setEventMessage($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + } + } else { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors'); + $error++; + } + } else { + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} +if ($action == 'shipped' && $permissiontoadd) { + if (GETPOST('confirm') == 'yes') { + $objecttmp = new $objectclass($db); + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($objecttmp->fetch($checked)) { + if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { + if ($objecttmp->cloture($user)) { + setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs'); + } else { + setEventMessage($langs->trans('CantBeClosed'), 'errors'); + $error++; + } + } else { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors'); + $error++; + } + } else { + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} +// Closed records +if (!$error && $massaction === 'setbilled' && $permissiontoclose) { + $db->begin(); + + $objecttmp = new $objectclass($db); + $nbok = 0; + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $result = $objecttmp->classifyBilled($user, 0); + if ($result <= 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else { + $nbok++; + } + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error) { + if ($nbok > 1) { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + } else { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + } + $db->commit(); + } else { + $db->rollback(); + } +} + +/* + * View + */ + +$now = dol_now(); + +$form = new Form($db); +$formother = new FormOther($db); +$formfile = new FormFile($db); +$formmargin = null; +if (!empty($conf->margin->enabled)) { + $formmargin = new FormMargin($db); +} +$companystatic = new Societe($db); +$formcompany = new FormCompany($db); +$projectstatic = new Project($db); + +$title = $langs->trans("Orders"); +$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; +// llxHeader('',$title,$help_url); + +$sql = 'SELECT'; +if ($sall || $search_product_category > 0 || $search_user > 0) { + $sql = 'SELECT DISTINCT'; +} +$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; +$sql .= " typent.code as typent_code,"; +$sql .= " state.code_departement as state_code, state.nom as state_name,"; +$sql .= " country.code as country_code,"; +$sql .= ' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; +$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; +$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; +$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; +$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; +$sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; +$sql .= ' c.fk_input_reason, c.import_key'; + +// Détail commande +if (!empty($check_orderdetail)) { + $sql .= ', cdet.description, cdet.qty, '; + $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; +} + +if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { + $sql .= ", cc.fk_categorie, cc.fk_soc"; +} +// 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." as options_".$key : ''); + } +} +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; +if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ +} + +// Détail commande +if (!empty($check_orderdetail)) { + $sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; +} else { + $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; +} + +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; +} +if ($sall || $search_product_category > 0) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande'; +} +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."projet as p ON p.rowid = c.fk_projet"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; + +// We'll need this table joined to the select in order to filter by sale +if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +} +if ($search_user > 0) { + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; +} + +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + +$sql .= ' WHERE c.fk_soc = s.rowid'; +$sql .= ' AND c.entity IN ('.getEntity('commande').')'; +if ($search_product_category > 0) { + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); +} +if ($socid > 0) { + $sql .= ' AND s.rowid = '.((int) $socid); +} +if (empty($user->rights->societe->client->voir) && !$socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); +} +if ($search_refProduct) { + $sql .= natural_search('pr.ref', $search_refProduct); +} +if ($search_descProduct) { + $sql .= natural_search('pr.label', $search_descProduct); + $sql .= natural_search('cdet.description', $search_descProduct); +} +if ($search_ref) { + $sql .= natural_search('c.ref', $search_ref); +} +if ($search_ref_customer) { + $sql .= natural_search('c.ref_client', $search_ref_customer); +} +if ($sall) { + $sql .= natural_search(array_keys($fieldstosearchall), $sall); +} +if ($search_billed != '' && $search_billed >= 0) { + $sql .= ' AND c.facture = '.((int) $search_billed); +} +if ($search_status <> '') { + if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination) + if ($search_status == 1 && empty($conf->expedition->enabled)) { + $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated' + } else { + $sql .= ' AND c.fk_statut = '.((int) $search_status); // brouillon, validee, en cours, annulee + } + } + if ($search_status == -2) { // To process + //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; + $sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected + } + if ($search_status == -3) { // To bill + //$sql.= ' AND c.fk_statut in (1,2,3)'; + //$sql.= ' AND c.facture = 0'; // invoice not created + $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed + } + if ($search_status == -4) { // "validate and in progress" + $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process + } +} + +if ($search_datecloture_start) { + $sql .= " AND c.date_cloture >= '".$db->idate($search_datecloture_start)."'"; +} +if ($search_datecloture_end) { + $sql .= " AND c.date_cloture <= '".$db->idate($search_datecloture_end)."'"; +} +if ($search_dateorder_start) { + $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'"; +} +if ($search_dateorder_end) { + $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'"; +} +if ($search_datedelivery_start) { + $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'"; +} +if ($search_datedelivery_end) { + $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'"; +} +if ($search_town) { + $sql .= natural_search('s.town', $search_town); +} +if ($search_zip) { + $sql .= natural_search("s.zip", $search_zip); +} +if ($search_state) { + $sql .= natural_search("state.nom", $search_state); +} +if ($search_country) { + $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')'; +} +if ($search_type_thirdparty && $search_type_thirdparty != '-1') { + $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')'; +} +if ($search_company) { + $sql .= natural_search('s.nom', $search_company); +} +if ($search_company_alias) { + $sql .= natural_search('s.name_alias', $search_company_alias); +} +if ($search_sale > 0) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); +} +if ($search_user > 0) { + $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); +} +if ($search_total_ht != '') { + $sql .= natural_search('c.total_ht', $search_total_ht, 1); +} +if ($search_total_vat != '') { + $sql .= natural_search('c.total_tva', $search_total_vat, 1); +} +if ($search_total_ttc != '') { + $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); +} +if ($search_warehouse != '' && $search_warehouse > 0) { + $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); +} +if ($search_multicurrency_code != '') { + $sql .= " AND c.multicurrency_code = '".$db->escape($search_multicurrency_code)."'"; +} +if ($search_multicurrency_tx != '') { + $sql .= natural_search('c.multicurrency_tx', $search_multicurrency_tx, 1); +} +if ($search_multicurrency_montant_ht != '') { + $sql .= natural_search('c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1); +} +if ($search_multicurrency_montant_vat != '') { + $sql .= natural_search('c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1); +} +if ($search_multicurrency_montant_ttc != '') { + $sql .= natural_search('c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1); +} +if ($search_login) { + $sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login); +} +if ($search_project_ref != '') { + $sql .= natural_search("p.ref", $search_project_ref); +} +if ($search_project != '') { + $sql .= natural_search("p.title", $search_project); +} +if ($search_categ_cus > 0) { + $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); +} +if ($search_categ_cus == -2) { + $sql .= " AND cc.fk_categorie IS NULL"; +} +if ($search_fk_cond_reglement > 0) { + $sql .= " AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement); +} +if ($search_fk_shipping_method > 0) { + $sql .= " AND c.fk_shipping_method = ".((int) $search_fk_shipping_method); +} +if ($search_fk_mode_reglement > 0) { + $sql .= " AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement); +} +if ($search_fk_input_reason > 0) { + $sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason); +} + +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + +// Add HAVING from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; + +$sql .= $db->order($sortfield, $sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + $page = 0; + $offset = 0; + } +} + +$sql .= $db->plimit($limit + 1, $offset); +//print $sql; + +$resql = $db->query($sql); +if ($resql) { + if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + $title = $langs->trans('CustomersOrders').' - '.$soc->name; + if (empty($search_company)) { + $search_company = $soc->name; + } + } else { + $title = $langs->trans('CustomersOrders'); + } + if (strval($search_status) == '0') { + $title .= ' - '.$langs->trans('StatusOrderDraftShort'); + } + if ($search_status == 1) { + $title .= ' - '.$langs->trans('StatusOrderValidatedShort'); + } + if ($search_status == 2) { + $title .= ' - '.$langs->trans('StatusOrderSentShort'); + } + if ($search_status == 3) { + $title .= ' - '.$langs->trans('StatusOrderToBillShort'); + } + if ($search_status == -1) { + $title .= ' - '.$langs->trans('StatusOrderCanceledShort'); + } + if ($search_status == -2) { + $title .= ' - '.$langs->trans('StatusOrderToProcessShort'); + } + if ($search_status == -3) { + $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); + } + if ($search_status == -4) { + $title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"); + } + + $num = $db->num_rows($resql); + + $arrayofselected = is_array($toselect) ? $toselect : array(); + + if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/commande/card.php?id='.$id); + exit; + } + + llxHeader('', $title, $help_url); + + $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 ($socid > 0) { + $param .= '&socid='.urlencode($socid); + } + if ($search_status != '') { + $param .= '&search_status='.urlencode($search_status); + } + if ($search_datecloture_start) { + $param .= '&search_datecloture_startday='.dol_print_date($search_datecloture_start, '%d').'&search_datecloture_startmonth='.dol_print_date($search_datecloture_start, '%m').'&search_datecloture_startyear='.dol_print_date($search_datecloture_start, '%Y'); + } + if ($search_datecloture_end) { + $param .= '&search_datecloture_endday='.dol_print_date($search_datecloture_end, '%d').'&search_datecloture_endmonth='.dol_print_date($search_datecloture_end, '%m').'&search_datecloture_endyear='.dol_print_date($search_datecloture_end, '%Y'); + } + if ($search_dateorder_start) { + $param .= '&search_dateorder_start_day='.dol_print_date($search_dateorder_start, '%d').'&search_dateorder_start_month='.dol_print_date($search_dateorder_start, '%m').'&search_dateorder_start_year='.dol_print_date($search_dateorder_start, '%Y'); + } + if ($search_dateorder_end) { + $param .= '&search_dateorder_end_day='.dol_print_date($search_dateorder_end, '%d').'&search_dateorder_end_month='.dol_print_date($search_dateorder_end, '%m').'&search_dateorder_end_year='.dol_print_date($search_dateorder_end, '%Y'); + } + if ($search_datedelivery_start) { + $param .= '&search_datedelivery_start_day='.dol_print_date($search_datedelivery_start, '%d').'&search_datedelivery_start_month='.dol_print_date($search_datedelivery_start, '%m').'&search_datedelivery_start_year='.dol_print_date($search_datedelivery_start, '%Y'); + } + if ($search_datedelivery_end) { + $param .= '&search_datedelivery_end_day='.dol_print_date($search_datedelivery_end, '%d').'&search_datedelivery_end_month='.dol_print_date($search_datedelivery_end, '%m').'&search_datedelivery_end_year='.dol_print_date($search_datedelivery_end, '%Y'); + } + if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); + } + if ($search_company) { + $param .= '&search_company='.urlencode($search_company); + } + if ($search_company_alias) { + $param .= '&search_company_alias='.urlencode($search_company_alias); + } + if ($search_ref_customer) { + $param .= '&search_ref_customer='.urlencode($search_ref_customer); + } + if ($search_user > 0) { + $param .= '&search_user='.urlencode($search_user); + } + if ($search_sale > 0) { + $param .= '&search_sale='.urlencode($search_sale); + } + if ($search_total_ht != '') { + $param .= '&search_total_ht='.urlencode($search_total_ht); + } + if ($search_total_vat != '') { + $param .= '&search_total_vat='.urlencode($search_total_vat); + } + if ($search_total_ttc != '') { + $param .= '&search_total_ttc='.urlencode($search_total_ttc); + } + if ($search_warehouse != '') { + $param .= '&search_warehouse='.urlencode($search_warehouse); + } + if ($search_login) { + $param .= '&search_login='.urlencode($search_login); + } + if ($search_multicurrency_code != '') { + $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code); + } + if ($search_multicurrency_tx != '') { + $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx); + } + if ($search_multicurrency_montant_ht != '') { + $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht); + } + if ($search_multicurrency_montant_vat != '') { + $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat); + } + if ($search_multicurrency_montant_ttc != '') { + $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc); + } + if ($search_project_ref >= 0) { + $param .= "&search_project_ref=".urlencode($search_project_ref); + } + if ($search_town != '') { + $param .= '&search_town='.urlencode($search_town); + } + if ($search_zip != '') { + $param .= '&search_zip='.urlencode($search_zip); + } + if ($search_state != '') { + $param .= '&search_state='.urlencode($search_state); + } + if ($search_country != '') { + $param .= '&search_country='.urlencode($search_country); + } + if ($search_type_thirdparty && $search_type_thirdparty != '-1') { + $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + } + if ($search_product_category != '') { + $param .= '&search_product_category='.urlencode($search_product_category); + } + if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { + $param .= '&search_categ_cus='.urlencode($search_categ_cus); + } + if ($show_files) { + $param .= '&show_files='.urlencode($show_files); + } + if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); + } + if ($search_billed != '') { + $param .= '&search_billed='.urlencode($search_billed); + } + if ($search_fk_cond_reglement > 0) { + $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + } + if ($search_fk_shipping_method > 0) { + $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + } + if ($search_fk_mode_reglement > 0) { + $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + } + if ($search_fk_input_reason > 0) { + $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + } + + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + + // Add $param from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook + $param .= $hookmanager->resPrint; + + // List of mass actions available + $arrayofmassactions = array( + 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + ); + if ($permissiontovalidate) { + $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); + } + if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); + } + if ($permissiontoclose) { + $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); + } + if ($permissiontocancel) { + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + } + if (!empty($conf->invoice->enabled) && $user->rights->facture->creer) { + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); + } + if ($permissiontoclose) { + $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); + } + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + } + if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { + $arrayofmassactions = array(); + } + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + + $url = DOL_URL_ROOT.'/commande/card.php?action=create'; + if (!empty($socid)) { + $url .= '&socid='.$socid; + } + $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd); + + // Lines of title fields + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1); + + $topicmail = "SendOrderRef"; + $modelmail = "order_send"; + $objecttmp = new Commande($db); + $trackid = 'ord'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + + if ($massaction == 'prevalidate') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); + } + if ($massaction == 'preshipped') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("CloseOrder"), $langs->trans("ConfirmCloseOrder"), "shipped", null, '', 0, 200, 500, 1); + } + + if ($massaction == 'createbills') { + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans('DateInvoice'); + print ''; + print $form->selectDate('', '', '', '', '', '', 1, 1); + print '
'; + print $langs->trans('CreateOneBillByThird'); + print ''; + print $form->selectyesno('createbills_onebythird', '', 1); + print '
'; + print $langs->trans('ValidateInvoices'); + print ''; + if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + print $form->selectyesno('validate_invoices', 0, 1, 1); + print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; + } else { + print $form->selectyesno('validate_invoices', 0, 1); + } + if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { + print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; + } else { + print '     '.$langs->trans("OptionToSetOrderBilledNotEnabled").''; + } + print '
'; + + print '
'; + print '
'; + print ' '; + print ''; + print '
'; + print '
'; + } + + // Détail commande + if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)) { + print '
 
'; + } + + if ($sall) { + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); + } + print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; + } + + $moreforfilter = ''; + + // If the user can view prospects other than his' + if ($user->rights->user->user->lire) { + $langs->load("commercial"); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx'); + $moreforfilter .= '
'; + } + // If the user can view other users + if ($user->rights->user->user->lire) { + $moreforfilter .= '
'; + $tmptitle = $langs->trans('LinkedToSpecificUsers'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); + $moreforfilter .= '
'; + } + // If the user can view prospects other than his' + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter .= '
'; + $tmptitle = $langs->trans('IncludingProductWithTag'); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1); + $moreforfilter .= '
'; + } + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter .= '
'; + $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, 'maxwidth300 widthcentpercentminusx'); + $moreforfilter .= '
'; + } + if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx'); + $moreforfilter .= '
'; + } + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; + } else { + $moreforfilter = $hookmanager->resPrint; + } + + if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + print '
'; + } + + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + + if (GETPOST('autoselectall', 'int')) { + $selectedfields .= ''; + } + + print '
'; + print ''."\n"; + + print ''; + + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + + // Détail commande + if (!empty($arrayfields['pr.ref']['checked'])) { + print ''; + } + // Product Description + if (!empty($arrayfields['pr.desc']['checked'])) { + print ''; + } + // Product QtyOrdered + if (!empty($arrayfields['cdet.qty']['checked'])) { + print ''; + } + + // Ref + if (!empty($arrayfields['c.ref']['checked'])) { + print ''; + } + // Ref customer + if (!empty($arrayfields['c.ref_client']['checked'])) { + print ''; + } + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + } + // Project title + if (!empty($arrayfields['p.title']['checked'])) { + print ''; + } + // Thirpdarty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + } + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print ''; + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + } + // Company type + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + } + // Date order + if (!empty($arrayfields['c.date_commande']['checked'])) { + print ''; + } + if (!empty($arrayfields['c.date_delivery']['checked'])) { + print ''; + } + // Shipping Method + if (!empty($arrayfields['c.fk_shipping_method']['checked'])) { + print ''; + } + // Payment term + if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { + print ''; + } + // Payment mode + if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { + print ''; + } + // Channel + if (!empty($arrayfields['c.fk_input_reason']['checked'])) { + print ''; + } + if (!empty($arrayfields['c.total_ht']['checked'])) { + // Amount + print ''; + } + if (!empty($arrayfields['c.total_vat']['checked'])) { + // Amount + print ''; + } + if (!empty($arrayfields['c.total_ttc']['checked'])) { + // Amount + print ''; + } + if (!empty($arrayfields['c.multicurrency_code']['checked'])) { + // Currency + print ''; + } + if (!empty($arrayfields['c.multicurrency_tx']['checked'])) { + // Currency rate + print ''; + } + if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { + // Amount + print ''; + } + if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { + // Amount VAT + print ''; + } + if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { + // Amount + print ''; + } + if (!empty($arrayfields['u.login']['checked'])) { + // Author + print ''; + } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } + if (!empty($arrayfields['total_pa']['checked'])) { + print ''; + } + if (!empty($arrayfields['total_margin']['checked'])) { + print ''; + } + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''; + } + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields); + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['c.datec']['checked'])) { + print ''; + } + // Date modification + if (!empty($arrayfields['c.tms']['checked'])) { + print ''; + } + // Date cloture + if (!empty($arrayfields['c.date_cloture']['checked'])) { + print ''; + } + // Note public + if (!empty($arrayfields['c.note_public']['checked'])) { + print ''; + } + // Note private + if (!empty($arrayfields['c.note_private']['checked'])) { + print ''; + } + // Shippable + if (!empty($arrayfields['shippable']['checked'])) { + print ''; + } + // Status billed + if (!empty($arrayfields['c.facture']['checked'])) { + print ''; + } + // Import key + if (!empty($arrayfields['c.import_key']['checked'])) { + print ''; + } + // Status + if (!empty($arrayfields['c.fk_statut']['checked'])) { + print ''; + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + print "\n"; + + // Fields title + print ''; + + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); + } + + // Détail commande + if (!empty($arrayfields['pr.ref']['checked'])) { + print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['pr.desc']['checked'])) { + print_liste_field_titre($arrayfields['pr.desc']['label'], $_SERVER["PHP_SELF"], 'pr.desc', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['cdet.qty']['checked'])) { + print_liste_field_titre($arrayfields['cdet.qty']['label'], $_SERVER["PHP_SELF"], 'cdet.qty', '', $param, '', $sortfield, $sortorder); + } + + if (!empty($arrayfields['c.ref']['checked'])) { + print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.ref_client']['checked'])) { + print_liste_field_titre($arrayfields['c.ref_client']['label'], $_SERVER["PHP_SELF"], 'c.ref_client', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['p.ref']['checked'])) { + print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['p.title']['checked'])) { + print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['s.nom']['checked'])) { + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['s.name_alias']['checked'])) { + print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['s.town']['checked'])) { + print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['s.zip']['checked'])) { + print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['state.nom']['checked'])) { + print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['country.code_iso']['checked'])) { + print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['typent.code']['checked'])) { + print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['c.date_commande']['checked'])) { + print_liste_field_titre($arrayfields['c.date_commande']['label'], $_SERVER["PHP_SELF"], 'c.date_commande', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['c.date_delivery']['checked'])) { + print_liste_field_titre($arrayfields['c.date_delivery']['label'], $_SERVER["PHP_SELF"], 'c.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['c.fk_shipping_method']['checked'])) { + print_liste_field_titre($arrayfields['c.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "c.fk_shipping_method", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { + print_liste_field_titre($arrayfields['c.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { + print_liste_field_titre($arrayfields['c.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.fk_input_reason']['checked'])) { + print_liste_field_titre($arrayfields['c.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "c.fk_input_reason", "", $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.total_ht']['checked'])) { + print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + } + if (!empty($arrayfields['c.total_vat']['checked'])) { + print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); + } + if (!empty($arrayfields['c.total_ttc']['checked'])) { + print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + } + if (!empty($arrayfields['c.multicurrency_code']['checked'])) { + print_liste_field_titre($arrayfields['c.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_code', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.multicurrency_tx']['checked'])) { + print_liste_field_titre($arrayfields['c.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_tx', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { + print_liste_field_titre($arrayfields['c.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { + print_liste_field_titre($arrayfields['c.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + } + if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { + print_liste_field_titre($arrayfields['c.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + } + if (!empty($arrayfields['u.login']['checked'])) { + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } + if (!empty($arrayfields['total_pa']['checked'])) { + print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + } + if (!empty($arrayfields['total_margin']['checked'])) { + print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + } + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + } + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + } + + $totalarray = array( + 'nbfield' => 0, + 'val' => array( + 'c.total_ht' => 0, + 'c.total_tva' => 0, + 'c.total_ttc' => 0, + ), + 'pos' => array(), + ); + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields + $parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, + ); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (!empty($arrayfields['c.datec']['checked'])) { + print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (!empty($arrayfields['c.tms']['checked'])) { + print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (!empty($arrayfields['c.date_cloture']['checked'])) { + print_liste_field_titre($arrayfields['c.date_cloture']['label'], $_SERVER["PHP_SELF"], "c.date_cloture", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (!empty($arrayfields['c.note_public']['checked'])) { + print_liste_field_titre($arrayfields['c.note_public']['label'], $_SERVER["PHP_SELF"], "c.note_public", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (!empty($arrayfields['c.note_private']['checked'])) { + print_liste_field_titre($arrayfields['c.note_private']['label'], $_SERVER["PHP_SELF"], "c.note_private", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (!empty($arrayfields['shippable']['checked'])) { + print_liste_field_titre($arrayfields['shippable']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['c.facture']['checked'])) { + print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['c.import_key']['checked'])) { + print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (!empty($arrayfields['c.fk_statut']['checked'])) { + print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); + } + print ''."\n"; + + $total = 0; + $subtotal = 0; + $productstat_cache = array(); + $productstat_cachevirtual = array(); + $getNomUrl_cache = array(); + + $generic_commande = new Commande($db); + $generic_product = new Product($db); + $userstatic = new User($db); + $i = 0; + + $with_margin_info = false; + if (!empty($conf->margin->enabled) && ( + !empty($arrayfields['total_pa']['checked']) + || !empty($arrayfields['total_margin']['checked']) + || !empty($arrayfields['total_margin_rate']['checked']) + || !empty($arrayfields['total_mark_rate']['checked']) + ) + ) { + $with_margin_info = true; + } + $total_ht = 0; + $total_margin = 0; + + // Détail commande + $totalqty = 0; + + $imaxinloop = ($limit ? min($num, $limit) : $num); + $last_num = min($num, $limit); + while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + + $notshippable = 0; + $warning = 0; + $text_info = ''; + $text_warning = ''; + $nbprod = 0; + + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $companystatic->name_alias = $obj->alias; + $companystatic->client = $obj->client; + $companystatic->code_client = $obj->code_client; + $companystatic->email = $obj->email; + $companystatic->phone = $obj->phone; + $companystatic->address = $obj->address; + $companystatic->zip = $obj->zip; + $companystatic->town = $obj->town; + $companystatic->country_code = $obj->country_code; + if (!isset($getNomUrl_cache[$obj->socid])) { + $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer'); + } + + $generic_commande->id = $obj->rowid; + $generic_commande->ref = $obj->ref; + $generic_commande->statut = $obj->fk_statut; + $generic_commande->billed = $obj->billed; + $generic_commande->date = $db->jdate($obj->date_commande); + $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated + $generic_commande->delivery_date = $db->jdate($obj->date_delivery); + $generic_commande->ref_client = $obj->ref_client; + $generic_commande->total_ht = $obj->total_ht; + $generic_commande->total_tva = $obj->total_tva; + $generic_commande->total_ttc = $obj->total_ttc; + $generic_commande->note_public = $obj->note_public; + $generic_commande->note_private = $obj->note_private; + + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_label; + + $marginInfo = array(); + if ($with_margin_info === true) { + $generic_commande->fetch_lines(); + $marginInfo = $formmargin->getMarginInfosArray($generic_commande); + $total_ht += $obj->total_ht; + $total_margin += $marginInfo['total_margin']; + } + + print ''; + + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } else { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Product Description + if (!empty($arrayfields['pr.desc']['checked'])) { + // print ''; + !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description; + print ''; + + if (!$i) { + $totalarray['nbfield']++; + } + } + // Product QtyOrdered + if (!empty($arrayfields['cdet.qty']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; + } + if (isset($totalarray['val']['cdet.qty'])) { + $totalarray['val']['cdet.qty'] += $obj->qty; + } else { + $totalarray['val']['cdet.qty'] = $obj->qty; + } + } + + // Ref + if (!empty($arrayfields['c.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Ref customer + if (!empty($arrayfields['c.ref_client']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project label + if (!empty($arrayfields['p.title']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Alias name + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Order date + if (!empty($arrayfields['c.date_commande']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Plannned date of delivery + if (!empty($arrayfields['c.date_delivery']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Shipping Method + if (!empty($arrayfields['c.fk_shipping_method']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment terms + if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment mode + if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Channel + if (!empty($arrayfields['c.fk_input_reason']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['c.total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht'; + } + if (isset($totalarray['val']['c.total_ht'])) { + $totalarray['val']['c.total_ht'] += $obj->total_ht; + } else { + $totalarray['val']['c.total_ht'] = $obj->total_ht; + } + } + // Amount VAT + if (!empty($arrayfields['c.total_vat']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva'; + } + $totalarray['val']['c.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['c.total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc'; + } + $totalarray['val']['c.total_ttc'] += $obj->total_ttc; + } + + // Currency + if (!empty($arrayfields['c.multicurrency_code']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['c.multicurrency_tx']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Total buying or cost price + if (!empty($arrayfields['total_pa']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; + } + $totalarray['val']['total_margin'] += $marginInfo['total_margin']; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $last_num - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; + } + } + } + + // 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); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['c.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date modification + if (!empty($arrayfields['c.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date cloture + if (!empty($arrayfields['c.date_cloture']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Note public + if (!empty($arrayfields['c.note_public']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Note private + if (!empty($arrayfields['c.note_private']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Show shippable Icon (this creates subloops, so may be slow) + if (!empty($arrayfields['shippable']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Billed + if (!empty($arrayfields['c.facture']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Import key + if (!empty($arrayfields['c.import_key']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['c.fk_statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + + $total += $obj->total_ht; + $subtotal += $obj->total_ht; + $i++; + } + + // Show total line + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + + // If no record found + if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; + } + + $db->free($resql); + + $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); + print ''; + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); + print ''; + print '
'; + print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print '
'; + print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + $form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1); + print ''; + $form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); + print ''; + $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1); + print ''; + $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1, 'search_datecloture_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1, 'search_datecloture_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print ''; + print ''; + //print $form->selectyesno('search_shippable', $search_shippable, 1, 0, 1, 1); + if (!empty($conf->global->ORDER_SHIPABLE_STATUS_DISABLED_BY_DEFAULT)) { + print ''; + print $langs->trans('ShowShippableStatus'); + } else { + $show_shippable_command = 1; + } + print ''; + print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); + print ''; + print ''; + $liststatus = array( + Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), + Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), + Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"), + Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), + -3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"), + -2=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"), + Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") + ); + print $form->selectarray('search_status', $liststatus, $search_status, -5, 0, 0, '', 0, 0, 0, '', 'maxwidth125', 1); + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + 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 ''; + } + } + + // Détail commande + // Product Ref + if (!empty($arrayfields['pr.ref']['checked'])) { + if (!empty($obj->product_rowid)) { + $generic_product->id = $obj->product_rowid; + $generic_product->ref = $obj->product_ref; + $generic_product->label = $obj->product_label; + $generic_product->status = $obj->product_status; + $generic_product->status_buy = $obj->product_status_buy; + $generic_product->status_batch = $obj->product_batch; + $generic_product->barcode = $obj->product_barcode; + print ''.$generic_product->getNomUrl(1).'Ligne libre'.$obj->description.''.dol_escape_htmltag($labelproduct).''.$obj->qty.''; + print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1); + + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); + + print ''.$obj->ref_client.''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if ($obj->project_id > 0) { + print $projectstatic->title; + } + print ''; + print $getNomUrl_cache[$obj->socid]; + + // If module invoices enabled and user with invoice creation permissions + if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) { + if ($user->rights->facture->creer) { + if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) { + print ' '; + print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; + } + } + } + print ''; + print $obj->alias; + print ''; + print $obj->town; + print ''; + print $obj->zip; + print '".$obj->state_name."'; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + print dol_print_date($db->jdate($obj->date_commande), 'day'); + // Warning late icon and note + if ($generic_commande->hasDelay()) { + print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning"); + } + print ''; + print dol_print_date($db->jdate($obj->date_delivery), 'dayhour'); + print ''; + $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); + print ''; + $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); + print ''; + $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + print ''; + $form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', ''); + print ''.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_vat)."'.price($obj->multicurrency_total_ttc)."'; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); + } else { + print ' '; + } + print "'; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print '
'.price($marginInfo['pa_total']).''.price($marginInfo['total_margin']).''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) { + if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { + $generic_commande->getLinesArray(); // Load array ->lines + $generic_commande->loadExpeditions(); // Load array ->expeditions + + $numlines = count($generic_commande->lines); // Loop on each line of order + for ($lig = 0; $lig < $numlines; $lig++) { + if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) { + $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; + } else { + $reliquat = $generic_commande->lines[$lig]->qty; + } + if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service + $nbprod++; // order contains real products + $generic_product->id = $generic_commande->lines[$lig]->fk_product; + + // Get local and virtual stock and store it into cache + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { + $generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock() + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; + $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + } else { + $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; + $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + } + + if ($reliquat > $generic_product->stock_reel) { + $notshippable++; + } + if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case. + $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); + $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.''; + $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.''; + $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); + $text_info .= '
'; + } else { // BUGGED CODE. + // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. + // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE + // Detailed virtual stock, looks bugged, uncomplete and need heavy load. + // stock order and stock order_supplier + $stock_order = 0; + $stock_order_supplier = 0; + if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ? + if (!empty($conf->commande->enabled)) { + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { + $generic_product->load_stats_commande(0, '1,2'); + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; + } else { + $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; + } + $stock_order = $generic_product->stats_commande['qty']; + } + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) { + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { + $generic_product->load_stats_commande_fournisseur(0, '3'); + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; + } else { + $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; + } + $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; + } + } + $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); + $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; + if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { + $warning++; + $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + } + if ($reliquat > $generic_product->stock_reel) { + $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + } else { + $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + } + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) { + $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier; + } + $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); + $text_info .= '
'; + } + } + } + if ($notshippable == 0) { + $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); + $text_info = $text_icon.' '.$langs->trans('Shippable').'
'.$text_info; + } else { + $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft'); + $text_info = $text_icon.' '.$langs->trans('NonShippable').'
'.$text_info; + } + } + + if ($nbprod) { + print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2); + } + if ($warning) { // Always false in default mode + print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'
'.$text_warning, 2, 1, img_picto('', 'error'), '', 2); + } + } + print '
'.yn($obj->billed).''.$obj->import_key.''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + 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 ''; + } + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; + print '
'; + + print '
'."\n"; + + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} else { + dol_print_error($db); +} + +// End of page +llxFooter(); +$db->close(); From 5eb495224b1f73ccd960b1d0ce03681d932337ba Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 10:51:38 +0200 Subject: [PATCH 013/370] clean --- htdocs/commande/list.php | 50 +--------------------------------------- 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1b74238db1c..dbb99d0f993 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2021 Anthony Berton + * Copyright (C) 2021 Anthony Berton * * 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 @@ -71,9 +71,6 @@ $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_end_mon $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_start_month', 'int'), GETPOST('search_datedelivery_start_day', 'int'), GETPOST('search_datedelivery_start_year', 'int')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_end_month', 'int'), GETPOST('search_datedelivery_end_day', 'int'), GETPOST('search_datedelivery_end_year', 'int')); $search_product_category = GETPOST('search_product_category', 'int'); - - - $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); @@ -207,9 +204,6 @@ $arrayfields = array( 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); - - - // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -245,8 +239,6 @@ if (empty($reshook)) { $search_user = ''; $search_sale = ''; $search_product_category = ''; - $search_refProduct = ''; - $search_descProduct = ''; $search_ref = ''; $search_ref_customer = ''; $search_company = ''; @@ -800,9 +792,6 @@ $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label, $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_input_reason, c.import_key'; - - - if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; } @@ -823,11 +812,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } - - $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; - - if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; } @@ -865,13 +850,6 @@ if ($socid > 0) { if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } -if ($search_refProduct) { - $sql .= natural_search('pr.ref', $search_refProduct); -} -if ($search_descProduct) { - $sql .= natural_search('pr.label', $search_descProduct); - $sql .= natural_search('cdet.description', $search_descProduct); -} if ($search_ref) { $sql .= natural_search('c.ref', $search_ref); } @@ -1336,8 +1314,6 @@ if ($resql) { print '
'; } - - if ($sall) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); @@ -1418,7 +1394,6 @@ if ($resql) { print ''."\n"; print ''; - // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print ''; } - - // Product Description - if (!empty($arrayfields['pr.desc']['checked'])) { - print ''; - } - // Product QtyOrdered - if (!empty($arrayfields['cdet.qty']['checked'])) { - print ''; - } - // Ref if (!empty($arrayfields['c.ref']['checked'])) { print ''; } - if (!empty($arrayfields['c.total_ht']['checked'])) { + if (!empty($arrayfields['cdet.total_ht']['checked'])) { // Amount print ''; } - if (!empty($arrayfields['c.total_ttc']['checked'])) { + if (!empty($arrayfields['cdet.total_ttc']['checked'])) { // Amount print '\n"; if (!$i) { $totalarray['nbfield']++; } if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht'; + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.total_ht'; } - if (isset($totalarray['val']['c.total_ht'])) { - $totalarray['val']['c.total_ht'] += $obj->total_ht; + if (isset($totalarray['val']['cdet.total_ht'])) { + $totalarray['val']['cdet.total_ht'] += $obj->total_ht; } else { - $totalarray['val']['c.total_ht'] = $obj->total_ht; + $totalarray['val']['cdet.total_ht'] = $obj->total_ht; } } // Amount VAT @@ -2216,20 +1708,20 @@ if ($resql) { $totalarray['nbfield']++; } if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva'; + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.total_tva'; } - $totalarray['val']['c.total_tva'] += $obj->total_tva; + $totalarray['val']['cdet.total_tva'] += $obj->total_tva; } // Amount TTC - if (!empty($arrayfields['c.total_ttc']['checked'])) { + if (!empty($arrayfields['cdet.total_ttc']['checked'])) { print '\n"; if (!$i) { $totalarray['nbfield']++; } if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc'; + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.total_ttc'; } - $totalarray['val']['c.total_ttc'] += $obj->total_ttc; + $totalarray['val']['cdet.total_ttc'] += $obj->total_ttc; } // Currency From 62163ae903a3f0c9e0d37f343c4497d5e765f4cb Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 14:47:54 +0200 Subject: [PATCH 016/370] Add in auguria menu --- htdocs/core/menus/init_menu_auguria.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 96625dd1f95..6821b065010 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -178,6 +178,7 @@ 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->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->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->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->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 ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->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->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($user->socid)', __HANDLER__, 'left', 1210__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list_line.php?mainmenu=commercial&leftmenu=orders', 'ListOrderLigne', 1, 'orders', '$user->rights->commande->lire', '', 2, 1, __ENTITY__); -- Commercial - Supplier's proposals 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->supplier_proposal->enabled', __HANDLER__, 'left', 1650__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); From 19248016bf05e8f77946035731c5643331fc12db Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 15:40:12 +0200 Subject: [PATCH 017/370] Fix - $generic_commande mount --- htdocs/commande/list_line.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index 9437daebf33..cb7d76e8930 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -350,8 +350,9 @@ $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.pho $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " country.code as country_code,"; -$sql .= ' c.rowid, c.ref, c.ref_client, c.fk_user_author,'; +$sql .= ' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,'; $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; +$sql .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc,'; $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; @@ -601,12 +602,12 @@ if ($resql) { if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); - $title = $langs->trans('CustomersOrders').' - '.$soc->name; + $title = $langs->trans('ListOrderLigne').' - '.$soc->name; if (empty($search_company)) { $search_company = $soc->name; } } else { - $title = $langs->trans('CustomersOrders'); + $title = $langs->trans('ListOrderLigne'); } if (strval($search_status) == '0') { $title .= ' - '.$langs->trans('StatusOrderDraftShort'); @@ -1419,7 +1420,7 @@ if ($resql) { $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer'); } - $generic_commande->id = $obj->rowid; + $generic_commande->id = $obj->c_rowid; $generic_commande->ref = $obj->ref; $generic_commande->statut = $obj->fk_statut; $generic_commande->billed = $obj->billed; @@ -1427,9 +1428,9 @@ if ($resql) { $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; - $generic_commande->total_ht = $obj->total_ht; - $generic_commande->total_tva = $obj->total_tva; - $generic_commande->total_ttc = $obj->total_ttc; + $generic_commande->total_ht = $obj->c_total_ht; + $generic_commande->total_tva = $obj->c_total_tva; + $generic_commande->total_ttc = $obj->c_total_ttc; $generic_commande->note_public = $obj->note_public; $generic_commande->note_private = $obj->note_private; From 6d625d6128bb1656d8dfe2ccf58aa0977053fe04 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 20:09:40 +0200 Subject: [PATCH 018/370] Add options for clean list --- htdocs/commande/list_line.php | 14 +++++++++++++- htdocs/langs/en_US/orders.lang | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index cb7d76e8930..d564daf27ab 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -57,6 +57,8 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; +$productonly = GETPOST('productonly', 'alpha'); +$disablelinefree = GETPOST('disablelinefree', 'alpha'); $search_datecloture_start = GETPOST('search_datecloture_start', 'int'); if (empty($search_datecloture_start)) { @@ -361,7 +363,7 @@ $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shippin $sql .= ' c.fk_input_reason, c.import_key'; // Détail commande -$sql .= ', cdet.rowid, cdet.description, cdet.qty, cdet.total_ht, cdet.total_tva, cdet.total_ttc, '; +$sql .= ', cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc, '; $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { @@ -418,6 +420,13 @@ $sql .= $hookmanager->resPrint; $sql .= ' WHERE c.fk_soc = s.rowid'; $sql .= ' AND c.entity IN ('.getEntity('commande').')'; + +if (!empty($productonly)) { + $sql .= " AND (cdet.product_type = 0 OR cdet.product_type = 1)"; +} +if (!empty($disablelinefree)) { + $sql .= " AND cdet.fk_product IS NOT NULL"; +} if ($search_product_category > 0) { $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } @@ -830,6 +839,9 @@ if ($resql) { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1); + print ''; + print ''; + $topicmail = "SendOrderRef"; $modelmail = "order_send"; $objecttmp = new Commande($db); diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index cb64d1b603a..a465fc41ea6 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -97,6 +97,8 @@ NumberOfOrdersByMonth=Number of orders by month AmountOfOrdersByMonthHT=Amount of orders by month (excl. tax) ListOfOrders=List of orders ListOrderLigne=Lines of orders +productonly=Lines products only +disablelinefree=No lines free CloseOrder=Close order ConfirmCloseOrder=Are you sure you want to set this order to delivered? Once an order is delivered, it can be set to billed. ConfirmDeleteOrder=Are you sure you want to delete this order? From c0c12a40b088b57694981844bc2d130958b15e88 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 1 Sep 2022 16:37:13 +0200 Subject: [PATCH 019/370] Fix inithook --- htdocs/commande/list_line.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index d564daf27ab..7ea36fe8d09 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -146,7 +146,7 @@ $show_shippable_command = GETPOST('show_shippable_command', 'aZ09'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Commande($db); -$hookmanager->initHooks(array('orderlist')); +$hookmanager->initHooks(array('orderlistdetail')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels From 1833add141e439011e56691b6f038907ba7adfc3 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 8 Sep 2022 10:12:40 +0200 Subject: [PATCH 020/370] FIX theorical stock when stock calculate on bill --- htdocs/product/class/product.class.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0900f11ed29..bb04f6e9359 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2990,7 +2990,6 @@ class Product extends CommonObject $sql .= " JOIN ".MAIN_DB_PREFIX."commande c ON el.fk_source = c.rowid "; $sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND c.facture = 0 AND fd.fk_product = ".((int) $this->id); dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE); - $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql) > 0) { @@ -2999,6 +2998,24 @@ class Product extends CommonObject } } + $this->stats_commande['qty'] -= $adeduire; + } else { + //For every order having invoice already validated we need to decrease stock cause it's in physical stock + $adeduire = 0; + $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet fd '; + $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON fd.fk_facture = f.rowid '; + $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element el ON el.fk_target = f.rowid and el.targettype = 'facture' and sourcetype = 'commande'"; + $sql .= ' JOIN '.MAIN_DB_PREFIX.'commande c ON el.fk_source = c.rowid '; + $sql .= ' WHERE c.fk_statut IN ('.$this->db->sanitize($filtrestatut).') AND f.fk_statut > '.Facture::STATUS_DRAFT.' AND fd.fk_product = '.((int) $this->id); + dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE); + $resql = $this->db->query($sql); + if($resql) { + if($this->db->num_rows($resql) > 0) { + $obj = $this->db->fetch_object($resql); + $adeduire += $obj->count; + } + } + $this->stats_commande['qty'] -= $adeduire; } } From c4793fdb06a6f59f85defe372621c8c270df999a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 8 Sep 2022 08:32:08 +0000 Subject: [PATCH 021/370] Fixing style errors. --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bb04f6e9359..5a1385deb6f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3009,8 +3009,8 @@ class Product extends CommonObject $sql .= ' WHERE c.fk_statut IN ('.$this->db->sanitize($filtrestatut).') AND f.fk_statut > '.Facture::STATUS_DRAFT.' AND fd.fk_product = '.((int) $this->id); dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE); $resql = $this->db->query($sql); - if($resql) { - if($this->db->num_rows($resql) > 0) { + if ($resql) { + if ($this->db->num_rows($resql) > 0) { $obj = $this->db->fetch_object($resql); $adeduire += $obj->count; } From 4fcfe966903ad783639492bc2c0039e2c7553ef9 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 14 Sep 2022 09:45:18 +0200 Subject: [PATCH 022/370] fix two sides --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bb04f6e9359..670b4548228 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3004,7 +3004,7 @@ class Product extends CommonObject $adeduire = 0; $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet fd '; $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON fd.fk_facture = f.rowid '; - $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element el ON el.fk_target = f.rowid and el.targettype = 'facture' and sourcetype = 'commande'"; + $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; $sql .= ' JOIN '.MAIN_DB_PREFIX.'commande c ON el.fk_source = c.rowid '; $sql .= ' WHERE c.fk_statut IN ('.$this->db->sanitize($filtrestatut).') AND f.fk_statut > '.Facture::STATUS_DRAFT.' AND fd.fk_product = '.((int) $this->id); dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE); From 18be0b4f271d428e13949c2fc9441b9576c5a6a6 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 20 Sep 2022 14:44:43 +0200 Subject: [PATCH 023/370] FIX missing facture class inclusion --- htdocs/product/class/product.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 705081484fe..ca2418a0ab1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2926,7 +2926,6 @@ class Product extends CommonObject { // phpcs:enable global $conf, $user, $hookmanager; - $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,"; $sql .= " COUNT(cd.rowid) as nb_rows, SUM(cd.qty) as qty"; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; @@ -3000,6 +2999,8 @@ class Product extends CommonObject $this->stats_commande['qty'] -= $adeduire; } else { + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + //For every order having invoice already validated we need to decrease stock cause it's in physical stock $adeduire = 0; $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet fd '; From 9c6dd0f5df000710aa193195fdfe2f23ba805250 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 24 Oct 2022 18:24:11 +0200 Subject: [PATCH 024/370] FIX - removefilter --- htdocs/commande/list_line.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index 7ea36fe8d09..98e0016d36f 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -247,6 +247,8 @@ 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 + $productonly = ''; + $disablelinefree = ''; $search_categ = ''; $search_user = ''; $search_sale = ''; From 2671bd6433ccf2d60d2af5690a087a9ca8447b4f Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 24 Oct 2022 18:28:00 +0200 Subject: [PATCH 025/370] FIX - no ligne title or sub-total or comment --- htdocs/commande/list_line.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index 98e0016d36f..4b20250e6de 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -422,6 +422,7 @@ $sql .= $hookmanager->resPrint; $sql .= ' WHERE c.fk_soc = s.rowid'; $sql .= ' AND c.entity IN ('.getEntity('commande').')'; +$sql .= ' AND cdet.product_type <> 9'; if (!empty($productonly)) { $sql .= " AND (cdet.product_type = 0 OR cdet.product_type = 1)"; From 64bc7a93c3e328b57fedcc1cab339ff117c19744 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 24 Oct 2022 18:43:23 +0200 Subject: [PATCH 026/370] ADD - Option Products to buy only --- htdocs/commande/list_line.php | 6 ++++++ htdocs/langs/en_US/orders.lang | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index 4b20250e6de..a569d7a56e1 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -57,6 +57,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; +$productobuy = GETPOST('productobuy', 'alpha'); $productonly = GETPOST('productonly', 'alpha'); $disablelinefree = GETPOST('disablelinefree', 'alpha'); @@ -247,6 +248,7 @@ 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 + $productobuy = ''; $productonly = ''; $disablelinefree = ''; $search_categ = ''; @@ -424,6 +426,9 @@ $sql .= ' WHERE c.fk_soc = s.rowid'; $sql .= ' AND c.entity IN ('.getEntity('commande').')'; $sql .= ' AND cdet.product_type <> 9'; +if (!empty($productobuy)) { + $sql .= " AND pr.tobuy = 1"; +} if (!empty($productonly)) { $sql .= " AND (cdet.product_type = 0 OR cdet.product_type = 1)"; } @@ -842,6 +847,7 @@ if ($resql) { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1); + print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index a465fc41ea6..f988cd62f19 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -97,7 +97,8 @@ NumberOfOrdersByMonth=Number of orders by month AmountOfOrdersByMonthHT=Amount of orders by month (excl. tax) ListOfOrders=List of orders ListOrderLigne=Lines of orders -productonly=Lines products only +productobuy=Products to buy only +productonly=Products only disablelinefree=No lines free CloseOrder=Close order ConfirmCloseOrder=Are you sure you want to set this order to delivered? Once an order is delivered, it can be set to billed. From 60acbe8186b3015ff02f24d4612ad21c1ce40149 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 12:45:09 +0200 Subject: [PATCH 027/370] FIX - contextpage --- htdocs/commande/list_line.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index a569d7a56e1..70aef999c72 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -56,7 +56,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') : 'orderlist'; +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlistdet'; $productobuy = GETPOST('productobuy', 'alpha'); $productonly = GETPOST('productonly', 'alpha'); $disablelinefree = GETPOST('disablelinefree', 'alpha'); From 78063b864ab65bc4c1c8ee28be4ddadffd39dd1b Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 14:01:54 +0200 Subject: [PATCH 028/370] FIX - Delete button ADD order --- htdocs/commande/list_line.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index 70aef999c72..42e4ce98b00 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -829,7 +829,7 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd); + $newcardbutton = '';//dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlistdet' && $permissiontoadd); // Lines of title fields print '
'; From 1a9f1e557455f9d76defe1d1e2a662ab8bfa1e37 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 14:04:25 +0200 Subject: [PATCH 029/370] rename file --- htdocs/commande/{list_line.php => list_det.php} | 0 htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename htdocs/commande/{list_line.php => list_det.php} (100%) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_det.php similarity index 100% rename from htdocs/commande/list_line.php rename to htdocs/commande/list_det.php diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 27dd621ed59..5c479e900bd 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -178,7 +178,7 @@ 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->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->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->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->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 ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->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->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($user->socid)', __HANDLER__, 'left', 1210__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list_line.php?mainmenu=commercial&leftmenu=orders', 'ListOrderLigne', 1, 'orders', '$user->rights->commande->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->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($user->socid)', __HANDLER__, 'left', 1210__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list_det.php?mainmenu=commercial&leftmenu=orders', 'ListOrderLigne', 1, 'orders', '$user->rights->commande->lire', '', 2, 1, __ENTITY__); -- Commercial - Supplier's proposals 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->supplier_proposal->enabled', __HANDLER__, 'left', 1650__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index cdea369e47c..62cd8055cc1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1338,7 +1338,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->hasRight('commande', 'lire')); } if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($user->socid)) { - $newmenu->add("/commande/list_line.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list_det.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->hasRight('commande', 'lire')); } $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->hasRight('commande', 'lire')); } From e1ee0b7d66a224ca1baffb7d60ae65fc82be59e2 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 15:34:04 +0200 Subject: [PATCH 030/370] FIX - /td --- htdocs/commande/list_det.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 42e4ce98b00..089c5dedbe1 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -2098,8 +2098,9 @@ if ($resql) { } print ''; } + print ''; } - print ''; + if (!$i) { $totalarray['nbfield']++; } From cb3680a91bcc275357286757269846102157115f Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 15:43:59 +0200 Subject: [PATCH 031/370] FIX - td --- htdocs/commande/list_det.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 089c5dedbe1..7cd3f61c16d 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1479,6 +1479,7 @@ if ($resql) { } print ''; } + print ''; } // Détail commande From 0f842fdb3a42b65cf254ff3d5aa9fc35bc30fe60 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 16:02:25 +0200 Subject: [PATCH 032/370] FIX - $totalarray['nbfield']++; --- htdocs/commande/list_det.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 7cd3f61c16d..cac3d3e50e6 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1480,6 +1480,9 @@ if ($resql) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Détail commande @@ -2100,10 +2103,9 @@ if ($resql) { print ''; } print ''; - } - - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "
\n"; @@ -2112,7 +2114,7 @@ if ($resql) { $subtotal += $obj->total_ht; $i++; } - + var_dump($totalarray['nbfield']); // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From 6c4b77a23c818c9b4225a2cd0659e7e93996835c Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 18:35:58 +0200 Subject: [PATCH 033/370] Hook --- htdocs/commande/list_det.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index cac3d3e50e6..18c096d38c7 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1911,7 +1911,7 @@ if ($resql) { 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); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -2107,7 +2107,8 @@ if ($resql) { $totalarray['nbfield']++; } } - + // $totalarray['nbfield']--; + // $totalarray['nbfield']--; print "\n"; $total += $obj->total_ht; From 1fc644572d678e455bcbc9d55b7c5ecfd601a556 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sat, 29 Oct 2022 21:45:45 +0200 Subject: [PATCH 034/370] FIX - totalarray --- htdocs/commande/list_det.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 18c096d38c7..7dcd8fb3835 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1415,8 +1415,11 @@ if ($resql) { // Détail commande $totalqty = 0; + $totalarray = array(); + $totalarray['nbfield'] = 0; + $totalarray['val']['cdet.total_tva'] = 0; + $totalarray['val']['cdet.total_ttc'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); - $last_num = min($num, $limit); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); @@ -1517,9 +1520,6 @@ if ($resql) { // Product QtyOrdered if (!empty($arrayfields['cdet.qty']['checked'])) { print ''; - if (!$i) { - $totalarray['nbfield']++; - } if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; } @@ -1528,6 +1528,9 @@ if ($resql) { } else { $totalarray['val']['cdet.qty'] = $obj->qty; } + if (!$i) { + $totalarray['nbfield']++; + } } // Ref @@ -1898,7 +1901,7 @@ if ($resql) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; } - if ($i >= $last_num - 1) { + if ($i >= $imaxinloop - 1) { if (!empty($total_ht)) { $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); } else { From 7baf98d6aa76a7e58c6f4360a6f519b8fec1de7f Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Fri, 4 Nov 2022 16:18:19 +0100 Subject: [PATCH 035/370] FIX: Reload page on supplier change and keeping the values of the input already set in the form --- htdocs/fourn/commande/card.php | 17 +++++++++-------- htdocs/fourn/facture/card.php | 15 ++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 86e34ce39a1..204b2d724da 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1616,15 +1616,16 @@ if ($action == 'create') { print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { - print ''; + '; } print ' '; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 366047da07c..103748aa541 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1945,14 +1945,15 @@ if ($action == 'create') { // reload page to retrieve supplier informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { print ''; + '; } print ' '; } From c62a23b75a38009b39cca5db57dfb484d90d90aa Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 7 Nov 2022 13:07:50 +0100 Subject: [PATCH 036/370] clean code --- htdocs/commande/list_det.php | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 7dcd8fb3835..fff7dc5b142 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -805,24 +805,6 @@ if ($resql) { $arrayofmassactions = array( 'GenerateOrdersSuppliers'=>img_picto('', 'doc', 'class="pictofixedwidth"').$langs->trans("GenerateOrdersSupplie"), ); - // if ($permissiontovalidate) { - // $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); - // } - // if ($permissiontosendbymail) { - // $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); - // } - // if ($permissiontoclose) { - // $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); - // } - // if ($permissiontocancel) { - // $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); - // } - // if ($permissiontodelete) { - // $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); - // } - // if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { - // $arrayofmassactions = array(); - // } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $url = DOL_URL_ROOT.'/commande/card.php?action=create'; @@ -2118,7 +2100,7 @@ if ($resql) { $subtotal += $obj->total_ht; $i++; } - var_dump($totalarray['nbfield']); + // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From ce7e59a4b27d4e5eb6f762fd6a443b8940aa7131 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 7 Nov 2022 14:15:21 +0100 Subject: [PATCH 037/370] ADD colum warehouse --- htdocs/commande/list_det.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fff7dc5b142..fd36f229e5c 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -200,6 +200,7 @@ $arrayfields = array( 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100), 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), + 'c.fk_warehouse'=>array('label'=>'Warehouse', 'checked'=>0, 'enabled'=>(empty($conf->stock->enabled) && empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), @@ -358,7 +359,7 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " country.code as country_code,"; $sql .= ' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,'; $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; -$sql .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc,'; +$sql .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc, c.fk_warehouse as warehouse,'; $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; @@ -1066,6 +1067,10 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['c.fk_warehouse']['checked'])) { + // Warehouse + print ''; + } if (!empty($arrayfields['c.multicurrency_code']['checked'])) { // Currency print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } // Currency if (!empty($arrayfields['c.multicurrency_code']['checked'])) { print '\n"; From e9d32c882291c2eded62dca1b4ae5ae4ca02f7fe Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 16 Nov 2022 14:31:59 +0100 Subject: [PATCH 038/370] NEW hook printFieldListFrom in contact list --- htdocs/contact/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 2bfdf9d1f66..39feeb125f4 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -402,6 +402,10 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stco if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; } +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= ' WHERE p.entity IN ('.getEntity('contact').')'; if (empty($user->rights->societe->client->voir) && !$socid) { //restriction $sql .= " AND (sc.fk_user = ".((int) $user->id)." OR p.fk_soc IS NULL)"; From b5688427abb8e7c356d84fb5d5dff7d58742bca4 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 21 Nov 2022 16:59:36 +0100 Subject: [PATCH 039/370] NEW : Now we can edit amount on vat and salaries clone action --- htdocs/compta/tva/card.php | 5 +++++ htdocs/salaries/card.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index e7c7678b818..eae2f17f4ec 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -333,6 +333,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char $object->id = $object->ref = null; $object->paye = 0; + if (GETPOST('amount', 'alphanohtml')) { + $object->amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT', 2); + } + if (GETPOST('clone_label', 'alphanohtml')) { $object->label = GETPOST('clone_label', 'alphanohtml'); } else { @@ -540,6 +544,7 @@ if ($id > 0) { //$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1); + $formquestion[] = array('type' => 'text', 'name' => 'amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount), 'morecss' => 'width100'); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVAT', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240); } diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 5ba1b818137..66844d40f5b 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -380,6 +380,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries- $object->paye = 0; $object->id = $object->ref = null; + if (GETPOST('amount', 'alphanohtml')) { + $object->amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT', 2); + } + if (GETPOST('clone_label', 'alphanohtml')) { $object->label = GETPOST('clone_label', 'alphanohtml'); } else { @@ -710,6 +714,7 @@ if ($id) { //$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_date_start', 'label' => $langs->trans("DateStart"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_date_end', 'label' => $langs->trans("DateEnd"), 'value' => -1); + $formquestion[] = array('type' => 'text', 'name' => 'amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount), 'morecss' => 'width100'); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneSalary', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250); } From c689ce1c52c6c3bae58975acb4e9d080ca3cb674 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Nov 2022 16:08:00 +0000 Subject: [PATCH 040/370] Fixing style errors. --- htdocs/salaries/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 66844d40f5b..7e3111743b3 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -380,9 +380,9 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries- $object->paye = 0; $object->id = $object->ref = null; - if (GETPOST('amount', 'alphanohtml')) { - $object->amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT', 2); - } + if (GETPOST('amount', 'alphanohtml')) { + $object->amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT', 2); + } if (GETPOST('clone_label', 'alphanohtml')) { $object->label = GETPOST('clone_label', 'alphanohtml'); From 01a4d0414d2cf0504e7696110e166d5953283a43 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 22 Nov 2022 16:22:10 +0100 Subject: [PATCH 041/370] add applicant name --- htdocs/recruitment/recruitmentcandidature_agenda.php | 1 + htdocs/recruitment/recruitmentcandidature_card.php | 1 + htdocs/recruitment/recruitmentcandidature_document.php | 1 + htdocs/recruitment/recruitmentcandidature_note.php | 1 + 4 files changed, 4 insertions(+) diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index 04118f55572..ac4f54d115c 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -143,6 +143,7 @@ if ($object->id > 0) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; + $morehtmlref.= $object->getFullName('', 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 2452c9e530b..7cf9fb47b56 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -426,6 +426,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; + $morehtmlref.= $object->getFullName('', 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index 3f08c770111..ed0cb115ea7 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -121,6 +121,7 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; + $morehtmlref.= $object->getFullName('', 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php index 1649ab5ee5e..f04a22aaf1b 100644 --- a/htdocs/recruitment/recruitmentcandidature_note.php +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -96,6 +96,7 @@ if ($id > 0 || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; + $morehtmlref.= $object->getFullName('', 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); From 1c5888d6d27c8608a701b46d106efa09ba4a19ea Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 23 Nov 2022 20:47:32 +0100 Subject: [PATCH 042/370] add hook 'llxFooter' --- htdocs/core/class/hookmanager.class.php | 1 + htdocs/main.inc.php | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 5f87d81db9d..4886a3fd5d0 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -195,6 +195,7 @@ class HookManager 'getFormatedSupplierRef', 'getIdProfUrl', 'getInputIdProf', + 'llxFooter', 'menuDropdownQuickaddItems', 'menuLeftMenuItems', 'moveUploadedFile', diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4b580e7b808..e0ea7b1dbfc 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3213,6 +3213,17 @@ if (!function_exists("llxFooter")) { $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); + // Hook to add more things on all pages within fiche DIV + $llxfooter = ''; + $parameters = array(); + $reshook = $hookmanager->executeHooks('llxFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $llxfooter .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $llxfooter = $hookmanager->resPrint; + } + print $llxfooter; + // Global html output events ($mesgs, $errors, $warnings) dol_htmloutput_events($disabledoutputofmessages); From 88ab5d72030ee0f5d1b2b306456907d0175b055b Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 13 Dec 2022 15:48:00 +0100 Subject: [PATCH 043/370] NEW Quadratus export with attachments in accountancy export --- htdocs/accountancy/bookkeeping/list.php | 96 ++++++---- .../class/accountancyexport.class.php | 177 +++++++++++++++++- htdocs/accountancy/tpl/export_journal.tpl.php | 8 +- htdocs/langs/en_US/accountancy.lang | 2 + htdocs/langs/fr_FR/accountancy.lang | 2 + 5 files changed, 233 insertions(+), 52 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f0e95c3efb7..2d48bc706ea 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -715,58 +715,62 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements } } - $mimetype = $accountancyexport->getMimeType($formatexportset); - - top_httphead($mimetype, 1); - - // Output data on screen - $accountancyexport->export($object->lines, $formatexportset); - $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha'); $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha'); + $withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0; - if (!empty($accountancyexport->errors)) { - dol_print_error('', '', $accountancyexport->errors); - } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) { - // Specify as export : update field date_export or date_validated - $error = 0; - $db->begin(); + // Output data on screen or download + $result = $accountancyexport->export($object->lines, $formatexportset, $withAttachment); - if (is_array($object->lines)) { - foreach ($object->lines as $movement) { - $now = dol_now(); + $error = 0; + if ($result < 0) { + $error++; + } else { + if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) { + if (is_array($object->lines)) { + // Specify as export : update field date_export or date_validated + $db->begin(); - $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " SET"; - if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) { - $sql .= " date_export = '".$db->idate($now)."'"; - $sql .= ", date_validated = '".$db->idate($now)."'"; - } elseif (!empty($notifiedexportdate)) { - $sql .= " date_export = '".$db->idate($now)."'"; - } elseif (!empty($notifiedvalidationdate)) { - $sql .= " date_validated = '".$db->idate($now)."'"; + foreach ($object->lines as $movement) { + $now = dol_now(); + + $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; + $sql .= " SET"; + if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) { + $sql .= " date_export = '".$db->idate($now)."'"; + $sql .= ", date_validated = '".$db->idate($now)."'"; + } elseif (!empty($notifiedexportdate)) { + $sql .= " date_export = '".$db->idate($now)."'"; + } elseif (!empty($notifiedvalidationdate)) { + $sql .= " date_validated = '".$db->idate($now)."'"; + } + $sql .= " WHERE rowid = ".((int) $movement->id); + + dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG); + + $result = $db->query($sql); + if (!$result) { + $error++; + break; + } } - $sql .= " WHERE rowid = ".((int) $movement->id); - dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG); - - $result = $db->query($sql); - if (!$result) { + if (!$error) { + $db->commit(); + } else { $error++; - break; + $accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated'); + $db->rollback(); } } } - - if (!$error) { - $db->commit(); - } else { - $error++; - $db->rollback(); - dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated")); - } } - exit; + + if ($error) { + setEventMessages('', $accountancyexport->errors, 'errors'); + header('Location: '.$_SERVER['PHP_SELF']); + } + exit(); // download or show errors } } @@ -854,7 +858,17 @@ if ($action == 'export_file') { $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator'); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600); + // add documents in an archive for accountancy export (Quadratus) + if(getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) { + $form_question['notifiedexportfull'] = array( + 'name' => 'notifiedexportfull', + 'type' => 'checkbox', + 'label' => $langs->trans('NotifiedExportFull'), + 'value' => 'false', + ); + } + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 400, 600); } //if ($action == 'delbookkeepingyear') { diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 3c45315ffa9..76b6782c174 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; /** @@ -313,9 +314,10 @@ class AccountancyExport * * @param array $TData Array with data * @param int $formatexportset Id of export format - * @return void + * @param int $withAttachment [=0] Not add files or 1 to have attached in an archive (ex : Quadratus) + * @return int <0 if KO, >0 OK */ - public function export(&$TData, $formatexportset) + public function export(&$TData, $formatexportset, $withAttachment = 0) { global $conf, $langs; global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php @@ -325,8 +327,44 @@ class AccountancyExport $type_export = 'general_ledger'; global $db; // The tpl file use $db + $completefilename = ''; + $exportFile = null; + $exportFileName = ''; + $exportFilePath = ''; + $archiveFileList = array(); + if ($withAttachment == 1) { + // PHP ZIP extension must be enabled + if (!extension_loaded('zip')) { + $langs->load('install'); + $this->errors[] = $langs->trans('ErrorPHPDoesNotSupport', 'ZIP');; + return -1; + } + } else { + $mimetype = $this->getMimeType($formatexportset); + top_httphead($mimetype, 1); + } include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; + if ($withAttachment == 1 && !empty($completefilename)) { + // create export file + $tmpDir = !empty($conf->accounting->multidir_temp[$conf->entity]) ? $conf->accounting->multidir_temp[$conf->entity] : $conf->accounting->dir_temp; + $exportFileFullName = $completefilename; + $exportFileBaseName = basename($exportFileFullName); + $exportFileName = pathinfo($exportFileBaseName, PATHINFO_FILENAME); + $exportFilePath = $tmpDir.'/'.$exportFileFullName; + $exportFile = fopen($exportFilePath, 'w'); + if (!$exportFile) { + $this->errors[] = $langs->trans('ErrorFileNotFound', $exportFilePath); + return -1; + } + $archiveFileList[0] = array( + 'path' => $exportFilePath, + 'name' => $exportFileFullName, + ); + // archive name and path + $archiveFullName = $exportFileName.'.zip'; + $archivePath = $tmpDir.'/'.$archiveFullName; + } switch ($formatexportset) { case self::$EXPORT_TYPE_CONFIGURABLE: @@ -345,7 +383,7 @@ class AccountancyExport $this->exportCiel($TData); break; case self::$EXPORT_TYPE_QUADRATUS: - $this->exportQuadratus($TData); + $archiveFileList = $this->exportQuadratus($TData, $exportFile, $archiveFileList, $withAttachment); break; case self::$EXPORT_TYPE_WINFIC: $this->exportWinfic($TData); @@ -399,6 +437,69 @@ class AccountancyExport } break; } + + // create and download export file or archive + if ($withAttachment == 1) { + $error = 0; + + // close export file + if ($exportFile) { + fclose($exportFile); + } + + if (!empty($archiveFullName) && !empty($archivePath) && !empty($archiveFileList)) { + // archive files + $downloadFileMimeType = 'application/zip'; + $downloadFileFullName = $archiveFullName; + $downloadFilePath = $archivePath; + + // create archive + $archive = new ZipArchive(); + $res = $archive->open($archivePath, ZipArchive::OVERWRITE | ZipArchive::CREATE); + if ($res !== true) { + $error++; + $this->errors[] = $langs->trans('ErrorFileNotFound', $archivePath); + } + if (!$error) { + // add files + foreach ($archiveFileList as $archiveFileArr) { + $res = $archive->addFile($archiveFileArr['path'], $archiveFileArr['name']); + if (!$res) { + $error++; + $this->errors[] = $langs->trans('ErrorArchiveAddFile', $archiveFileArr['name']); + break; + } + } + } + if (!$error) { + // close archive + $archive->close(); + } + } elseif (!empty($exportFileFullName) && !empty($exportFilePath)) { + // only one file to download + $downloadFileMimeType = 'text/csv'; + $downloadFileFullName = $exportFileFullName; + $downloadFilePath = $exportFilePath; + } + + if (!$error) { + // download export file + if (!empty($downloadFileMimeType) && !empty($downloadFileFullName) && !empty($downloadFilePath)) { + header('Content-Type: '.$downloadFileMimeType); + header('Content-Disposition: attachment; filename='.$downloadFileFullName); + header('Cache-Control: Public, must-revalidate'); + header('Pragma: public'); + header('Content-Length: '.dol_filesize($downloadFilePath)); + readfileLowMemory($downloadFilePath); + } + } + + if ($error) { + return -1; + } + } + + return 1; } @@ -584,10 +685,13 @@ class AccountancyExport * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)" * - * @param array $TData data - * @return void + * @param array $TData Data + * @param resource $exportFile [=null] File resource to export or print if null + * @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name'] + * @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive + * @return array Archive file list : array of ['path', 'name'] */ - public function exportQuadratus(&$TData) + public function exportQuadratus(&$TData, $exportFile = null, $archiveFileList = array(), $withAttachment = 0) { global $conf, $db; @@ -637,7 +741,11 @@ class AccountancyExport $Tab['end_line'] = $end_line; - print implode($Tab); + if ($exportFile) { + fwrite($exportFile, implode($Tab)); + } else { + print implode($Tab); + } } $Tab = array(); @@ -708,12 +816,63 @@ class AccountancyExport // We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part // $Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10); $Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10); - $Tab['filler4'] = str_repeat(' ', 73); + $Tab['reserved'] = str_repeat(' ', 10); // position 159 + $Tab['currency_amount'] = str_repeat(' ', 13); // position 169 + // get document file + $attachmentFileName = ''; + if ($withAttachment == 1) { + $attachmentFileKey = trim($data->piece_num); + if (!isset($archiveFileList[$attachmentFileKey])) { + $objectDirPath = ''; + $objectFileName = dol_sanitizeFileName($data->doc_ref); + if ($data->doc_type == 'customer_invoice') { + $objectDirPath = !empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->multidir_output[$conf->entity] : $conf->facture->dir_output; + } elseif ($data->doc_type == 'expense_report') { + $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->factureexpensereport->dir_output; + } elseif ($data->doc_type == 'supplier_invoice') { + $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; + } + $arrayofinclusion = array(); + $arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').'\.pdf$'; + $fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, true); + if (!empty($fileFoundList)) { + $attachmentFileNameTrunc = str_pad(self::trunc($data->piece_num, 8), 8, '0', STR_PAD_LEFT); + foreach ($fileFoundList as $fileFound) { + if (strstr($fileFound['name'], $objectFileName)) { + $fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name']; + if (file_exists($fileFoundPath)) { + $archiveFileList[$attachmentFileKey] = array( + 'path' => $fileFoundPath, + 'name' => $attachmentFileNameTrunc.'.pdf', + ); + break; + } + } + } + } + } + + if (isset($archiveFileList[$attachmentFileKey])) { + $attachmentFileName = $archiveFileList[$attachmentFileKey]['name']; + } + } + if (dol_strlen($attachmentFileName) == 12) { + $Tab['attachment'] = $attachmentFileName; // position 182 + } else { + $Tab['attachment'] = str_repeat(' ', 12); // position 182 + } + $Tab['filler4'] = str_repeat(' ', 38); $Tab['end_line'] = $end_line; - print implode($Tab); + if ($exportFile) { + fwrite($exportFile, implode($Tab)); + } else { + print implode($Tab); + } } + + return $archiveFileList; } /** diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 22537a60a39..833b81fc8c0 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -33,7 +33,9 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); -header('Content-Type: text/csv'); +if (!isset($withAttachments) || $withAttachments == 1) { + header('Content-Type: text/csv'); +} include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $accountancyexport = new AccountancyExport($db); @@ -66,4 +68,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; } -header('Content-Disposition: attachment;filename='.$completefilename); +if (!isset($withAttachments) || $withAttachments == 1) { + header('Content-Disposition: attachment;filename=' . $completefilename); +} diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e988764d8ba..5ea3c692aee 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -342,6 +342,7 @@ ACCOUNTING_ENABLE_LETTERING=Enable the lettering function in the accounting NotExportLettering=Do not export the lettering when generating the file NotifiedExportDate=Flag exported lines as Exported (to modify a line, you will need to delete the whole transaction and re-transfert it into accounting) NotifiedValidationDate=Validate and Lock the exported entries (same effect than the "%s" feature, modification and deletion of the lines will DEFINITELY not be possible) +NotifiedExportFull=Export documents ? DateValidationAndLock=Date validation and lock ConfirmExportFile=Confirmation of the generation of the accounting export file ? ExportDraftJournal=Export draft journal @@ -442,6 +443,7 @@ AccountancyErrorMismatchLetterCode=Mismatch in reconcile code AccountancyErrorMismatchBalanceAmount=The balance (%s) is not equal to 0 AccountancyErrorLetteringBookkeeping=Errors have occurred concerning the transactions: %s ErrorAccountNumberAlreadyExists=The accounting number %s already exists +ErrorArchiveAddFile=Can't put "%s" file in archive ## Import ImportAccountingEntries=Accounting entries diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 53edef4c0a1..0d2b7bb69a2 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -337,6 +337,7 @@ ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Désactiver la liaison et le transf ## Export NotifiedExportDate=Marquer les lignes exportées comme Exportées (pour modifier une ligne, vous devrez supprimer toute la transaction et la retransférer en comptabilité) NotifiedValidationDate=Validez et verrouillez les entrées exportées (même effet que la fonctionnalité "%s", la modification et la suppression des lignes ne seront définitivement plus possibles) +NotifiedExportFull=Exporter les pièces ? DateValidationAndLock=Validation et verrouillage de la date ConfirmExportFile=Confirmation de la génération du fichier d'export comptable ? ExportDraftJournal=Exporter le journal brouillon @@ -437,6 +438,7 @@ AccountancyErrorMismatchLetterCode=Non-concordance dans le code de réconciliati AccountancyErrorMismatchBalanceAmount=Le solde (%s) n'est pas égal à 0 AccountancyErrorLetteringBookkeeping=Des erreurs sont survenues concernant les transactions : %s ErrorAccountNumberAlreadyExists=Le code comptable %s existe déjà +ErrorArchiveAddFile=Impossible d'ajouter le fichier "%s" dans l'archive ## Import ImportAccountingEntries=Écritures comptables From 6dedeb368d1f18d610dcd21ac4de81d30eb8bbfd Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 13 Dec 2022 15:51:23 +0100 Subject: [PATCH 044/370] NEW Quadratus export with attachments in accountancy export --- htdocs/accountancy/tpl/export_journal.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 833b81fc8c0..4dc4dedbe0e 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -33,7 +33,7 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); -if (!isset($withAttachments) || $withAttachments == 1) { +if (empty($withAttachment)) { header('Content-Type: text/csv'); } @@ -68,6 +68,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; } -if (!isset($withAttachments) || $withAttachments == 1) { +if (empty($withAttachment)) { header('Content-Disposition: attachment;filename=' . $completefilename); } From 787618d9d6927a25faa0ae6bdf8f9fa67dedb67f Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 13 Dec 2022 16:36:49 +0100 Subject: [PATCH 045/370] NEW Copyrights --- htdocs/accountancy/bookkeeping/list.php | 3 ++- htdocs/accountancy/class/accountancyexport.class.php | 3 ++- htdocs/accountancy/tpl/export_journal.tpl.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 2d48bc706ea..2f255dec734 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,9 +1,10 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2022 Alexandre Spangaro + * Copyright (C) 2013-2022 Open-DSI * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2022 Progiseize * * 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 diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 76b6782c174..e101c09abd3 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,13 +5,14 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2021 Alexandre Spangaro + * Copyright (C) 2016-2022 Open-DSI * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France * Copyright (C) 2017 André Schild * Copyright (C) 2020 Guillaume Alexandre * Copyright (C) 2022 Joachim Kueter + * Copyright (C) 2022 Progiseize * * 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 diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 4dc4dedbe0e..f57d54fcfbd 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,6 +1,7 @@ +/* Copyright (C) 2015-2022 Open-DSI * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2022 Progiseize * * 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 From fb16a97d6d4e743c8f8a44884399a81badba2a88 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 13 Dec 2022 18:13:24 +0100 Subject: [PATCH 046/370] FIX stickler-ci --- htdocs/accountancy/bookkeeping/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 2f255dec734..781b20edc2e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -860,7 +860,7 @@ if ($action == 'export_file') { } // add documents in an archive for accountancy export (Quadratus) - if(getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) { + if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) { $form_question['notifiedexportfull'] = array( 'name' => 'notifiedexportfull', 'type' => 'checkbox', From f90b887ec257c2580c9a8db36c4f39254fd8be13 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 19 Dec 2022 13:48:08 +0100 Subject: [PATCH 047/370] NEW mode view for list adherent --- htdocs/adherents/class/adherent.class.php | 36 ++ htdocs/adherents/list.php | 541 +++++++++++----------- 2 files changed, 319 insertions(+), 258 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4c68b3e91ec..ec2cd91813d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3167,4 +3167,40 @@ class Adherent extends CommonObject return $nbko; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + + $return = '
'; + $return .= '
'; + $return .= ''; + + if (property_exists($this, 'photo') || !empty($this->photo)) { + $return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + } else { + $return .= img_picto('', 'user'); + } + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'type')) { + $return .= '
'.$this->type.''; + } + if (method_exists($this, 'getmorphylib')) { + $return .= '
'.$this->getmorphylib('', 2).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index c2b81860210..6ef559deb75 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -47,6 +47,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); // Search fields @@ -535,6 +536,9 @@ if ($search_type > 0) { } $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -636,6 +640,8 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($user->hasRight('adherent', 'creer')) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); } @@ -650,6 +656,8 @@ print ''; print ''; print ''; print ''; +print ''; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -988,276 +996,293 @@ while ($i < min($num, $limit)) { } $memberstatic->company = $companyname; - print '
'; - - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - } - - if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Civility - if (!empty($arrayfields['d.civility']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Firstname - if (!empty($arrayfields['d.firstname']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Lastname - if (!empty($arrayfields['d.lastname']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Gender - if (!empty($arrayfields['d.gender']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Company - if (!empty($arrayfields['d.company']['checked'])) { - print '\n"; - } - // Login - if (!empty($arrayfields['d.login']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Nature (Moral/Physical) - if (!empty($arrayfields['d.morphy']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type label - if (!empty($arrayfields['t.libelle']['checked'])) { $membertypestatic->id = $obj->type_id; $membertypestatic->label = $obj->type; - print ''; - if (!$i) { - $totalarray['nbfield']++; + $memberstatic->type = $membertypestatic->label; + $memberstatic->photo = $obj->photo; + // Output Kanban + print $memberstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } - } - // Address - if (!empty($arrayfields['d.address']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['d.zip']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['d.town']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - $tmparray = getCountry($obj->country, 'all'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone pro - if (!empty($arrayfields['d.phone']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone perso - if (!empty($arrayfields['d.phone_perso']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone mobile - if (!empty($arrayfields['d.phone_mobile']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // EMail - if (!empty($arrayfields['d.email']['checked'])) { - print '\n"; - } - // End of subscription date - $datefin = $db->jdate($obj->datefin); - if (!empty($arrayfields['d.datefin']['checked'])) { - print ''; + + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + + if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Civility + if (!empty($arrayfields['d.civility']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Firstname + if (!empty($arrayfields['d.firstname']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Lastname + if (!empty($arrayfields['d.lastname']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Gender + if (!empty($arrayfields['d.gender']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Company + if (!empty($arrayfields['d.company']['checked'])) { + print '\n"; + } + // Login + if (!empty($arrayfields['d.login']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Nature (Moral/Physical) + if (!empty($arrayfields['d.morphy']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type label + if (!empty($arrayfields['t.libelle']['checked'])) { + $membertypestatic->id = $obj->type_id; + $membertypestatic->label = $obj->type; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Address + if (!empty($arrayfields['d.address']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['d.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['d.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + $tmparray = getCountry($obj->country, 'all'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone pro + if (!empty($arrayfields['d.phone']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone perso + if (!empty($arrayfields['d.phone_perso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone mobile + if (!empty($arrayfields['d.phone_mobile']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // EMail + if (!empty($arrayfields['d.email']['checked'])) { + print '\n"; + } + // End of subscription date + $datefin = $db->jdate($obj->datefin); + if (!empty($arrayfields['d.datefin']['checked'])) { + print ''; + } + // 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); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['d.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - } - // 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); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['d.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Birth - if (!empty($arrayfields['d.birth']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['d.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['d.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['d.import_key']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + // Date modification + if (!empty($arrayfields['d.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['d.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['d.import_key']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } - print ''."\n"; + print ''."\n"; + } $i++; } From 517af503ed225d26e7a76df5e9891031fff2aa91 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 19 Dec 2022 14:27:22 +0100 Subject: [PATCH 048/370] NEW category of operation for crabe PDF model --- .../modules/facture/doc/pdf_crabe.modules.php | 57 +++++++++++++++++++ .../facture/doc/pdf_sponge.modules.php | 20 ++++--- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ee4cc9b5d0d..30a61fbb1d3 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -132,6 +132,11 @@ class pdf_crabe extends ModelePDFFactures */ public $posxprogress; + /** + * @var int Category of operation + */ + public $categoryOfOperation = -1; // unknown by default + /** * Constructor @@ -402,11 +407,37 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Set $this->atleastonediscount if you have at least one discount + // and determine category of operation + $categoryOfOperation = 0; + $nbProduct = 0; + $nbService = 0; for ($i = 0; $i < $nblines; $i++) { if ($object->lines[$i]->remise_percent) { $this->atleastonediscount++; } + + // determine category of operation + if ($categoryOfOperation < 2) { + $lineProductType = $object->lines[$i]->product_type; + if ($lineProductType == Product::TYPE_PRODUCT) { + $nbProduct++; + } elseif ($lineProductType == Product::TYPE_SERVICE) { + $nbService++; + } + if ($nbProduct > 0 && $nbService > 0) { + // mixed products and services + $categoryOfOperation = 2; + } + } } + // determine category of operation + if ($categoryOfOperation <= 0) { + // only services + if ($nbProduct == 0 && $nbService > 0) { + $categoryOfOperation = 1; + } + } + $this->categoryOfOperation = $categoryOfOperation; if (empty($this->atleastonediscount)) { // retrieve space not used by discount $delta = ($this->posxprogress - $this->posxdiscount); $this->posxpicture += $delta; @@ -1128,6 +1159,10 @@ class pdf_crabe extends ModelePDFFactures } $posxval = 52; + $posxend = 110; // End of x for text on left side + if ($this->page_largeur < 210) { // To work with US executive format + $posxend -= 10; + } // Show payments conditions if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { @@ -1145,6 +1180,21 @@ class pdf_crabe extends ModelePDFFactures $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } + // Show category of operations + if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 2 && $this->categoryOfOperation >= 0) { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $categoryOfOperationTitle = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '; + $pdf->MultiCell($posxval - $this->marge_gauche, 4, $categoryOfOperationTitle, 0, 'L'); + + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); + $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); + + $posy = $pdf->GetY() + 3; // for 2 lines + } + if ($object->type != 2) { // Check a payment mode is defined if (empty($object->mode_reglement_code) @@ -1659,6 +1709,13 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 2); if (empty($hidetop)) { + // Show category of operations + if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); + $pdf->SetXY($this->marge_gauche, $tab_top - 4); + $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); + } + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index adf47af3cce..072ddb566bd 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -445,15 +445,17 @@ class pdf_sponge extends ModelePDFFactures } // determine category of operation - $lineProductType = $object->lines[$i]->product_type; - if ($lineProductType == Product::TYPE_PRODUCT) { - $nbProduct++; - } elseif ($lineProductType == Product::TYPE_SERVICE) { - $nbService++; - } - if ($nbProduct > 0 && $nbService > 0) { - // mixed products and services - $categoryOfOperation = 2; + if ($categoryOfOperation < 2) { + $lineProductType = $object->lines[$i]->product_type; + if ($lineProductType == Product::TYPE_PRODUCT) { + $nbProduct++; + } elseif ($lineProductType == Product::TYPE_SERVICE) { + $nbService++; + } + if ($nbProduct > 0 && $nbService > 0) { + // mixed products and services + $categoryOfOperation = 2; + } } } // determine category of operation From abd5a86f348256fa6ab2eb09b93bed678f0ff9d2 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 19 Dec 2022 15:19:12 +0100 Subject: [PATCH 049/370] mode Kanban for subscription list --- htdocs/adherents/class/subscription.class.php | 32 ++ htdocs/adherents/subscription/list.php | 275 ++++++++++-------- 2 files changed, 187 insertions(+), 120 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index b3cfe027197..411fdb2181f 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -505,4 +505,36 @@ class Subscription extends CommonObject dol_print_error($this->db); } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + + $return .= '
'; + $return .= ''.(property_exists($this, 'fk_adherent')? $this->fk_adherent: $this->ref ).''; + if (property_exists($this, 'dateh') || property_exists($this, 'datef')) { + $return .= '
'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').''; + } + + if (property_exists($this, 'fk_bank')) { + $return .= '
'.$this->fk_bank.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.price($this->amount).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 1523bd4ee90..5aa19c6c6d0 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -37,6 +37,8 @@ $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'subscriptionlist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); + $statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1); $search_ref = GETPOST('search_ref', 'alpha'); @@ -253,6 +255,9 @@ if (!empty($date_select)) { } $param = ''; +if (!empty($mode)) { + $param .='&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -298,6 +303,9 @@ if (in_array($massaction, array('presend', 'predelete'))) { $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + if ($user->rights->adherent->cotisation->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); } @@ -313,6 +321,8 @@ print ''; print ''; print ''; print ''; +print ''; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -506,144 +516,169 @@ while ($i < min($num, $limit)) { $adht->fetch($typeid); $adherent->need_subscription = $adht->subscription; - - print '
'; - - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Lastname - if (!empty($arrayfields['d.lastname']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Firstname - if (!empty($arrayfields['d.firstname']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Login - if (!empty($arrayfields['d.login']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Label - if (!empty($arrayfields['t.libelle']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Banque - if (!empty($arrayfields['d.bank']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; + // Output Kanban + print $subscription->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } } - // Date start - if (!empty($arrayfields['c.dateadh']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; + else { + print ''; + + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date end - if (!empty($arrayfields['c.datef']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; + // Type + if (!empty($arrayfields['d.fk_type']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Price - if (!empty($arrayfields['d.amount']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + + // Lastname + if (!empty($arrayfields['d.lastname']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.amount'; + // Firstname + if (!empty($arrayfields['d.firstname']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (empty($totalarray['val']['d.amount'])) { - $totalarray['val']['d.amount'] = $obj->subscription; - } else { - $totalarray['val']['d.amount'] += $obj->subscription; + + // Login + if (!empty($arrayfields['d.login']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Label + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Banque + if (!empty($arrayfields['d.bank']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date start + if (!empty($arrayfields['c.dateadh']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date end + if (!empty($arrayfields['c.datef']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Price + if (!empty($arrayfields['d.amount']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.amount'; + } + if (empty($totalarray['val']['d.amount'])) { + $totalarray['val']['d.amount'] = $obj->subscription; + } else { + $totalarray['val']['d.amount'] += $obj->subscription; + } + } + // 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); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['c.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['c.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + print ''; if (!$i) { $totalarray['nbfield']++; } - } - // Date modification - if (!empty($arrayfields['c.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + print "\n"; + } $i++; } From 0c75e5bb2d81adb5cfa356e528c0cf77ec2c94c2 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 19 Dec 2022 15:19:18 +0100 Subject: [PATCH 050/370] mode Kanban for subscription list --- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/adherents/subscription/list.php | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 411fdb2181f..12e19fd9c3a 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -525,7 +525,7 @@ class Subscription extends CommonObject if (property_exists($this, 'dateh') || property_exists($this, 'datef')) { $return .= '
'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').''; } - + if (property_exists($this, 'fk_bank')) { $return .= '
'.$this->fk_bank.''; } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 5aa19c6c6d0..501bd9c80e5 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -516,13 +516,13 @@ while ($i < min($num, $limit)) { $adht->fetch($typeid); $adherent->need_subscription = $adht->subscription; - + if ($mode == 'kanban') { if ($i == 0) { print '
'; } - } - - else { + } else { print ''; // Ref From aed3f841bc1424304bc44e71449456d38ea3a2f7 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 20 Dec 2022 11:27:55 +0100 Subject: [PATCH 051/370] New View mode for Adherent Type list --- .../adherents/class/adherent_type.class.php | 42 +++++++++++ htdocs/adherents/type.php | 71 ++++++++++++------- 2 files changed, 89 insertions(+), 24 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 4516b132982..25211f11bd9 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -927,4 +927,46 @@ class AdherentType extends CommonObject return ''; } + + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return void HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs,$user; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if ($user->rights->adherent->configurer) { + $return .= 'ref.'">'.img_edit().''; + } else { + $return .= ' '; + } + if (property_exists($this, 'vote')) { + $return .= '
'.$langs->trans("VoteAllowed").' : '.yn($this->vote).''; + } + if (property_exists($this, 'amount')) { + if (is_null($this->amount) || $this->amount === '') { + $return .= '
'; + } else { + $return .= '
'.$langs->trans("Amount").''; + $return .= ' : '.price($this->amount).''; + } + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + print $return; + } } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 257e7266e5a..6a2dbdb125d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -44,6 +44,7 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$mode = GETPOST('mode', 'alopha'); $sall = GETPOST("sall", "alpha"); $filter = GETPOST("filter", 'alpha'); @@ -248,6 +249,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode'.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } @@ -256,6 +260,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + if ($user->rights->adherent->configurer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } @@ -269,6 +276,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; + print ''; + print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -302,32 +311,46 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $membertype->amount = $objp->amount; $membertype->caneditamount = $objp->caneditamount; - print '
'; - print ''; - print ''; - print ''; + } } else { - print $langs->trans("MorAndPhy"); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($user->rights->adherent->configurer) { + print ''; + } else { + print ''; + } + print ""; } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($user->rights->adherent->configurer) { - print ''; - } else { - print ''; - } - print ""; $i++; } From 54bd44e14af1744946b0d8d8148080b84be49422 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Tue, 20 Dec 2022 11:43:42 +0100 Subject: [PATCH 052/370] NEW : notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR) --- htdocs/ticket/class/ticket.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 2a3160b3b67..10c0541c168 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2449,6 +2449,16 @@ class Ticket extends CommonObject $assigned_user_dont_have_email = $assigned_user->getFullName($langs); } } + if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)) { + $contactList = $object->liste_contact(-1, 'internal', 0, 'CONTRIBUTOR'); + if (is_array($contactList)) { + foreach ($contactList as $contactArray) { + if (!empty($contactArray['email'])) { + $sendto[] = dolGetFirstLastname($contactArray['firstname'], $contactArray['lastname']) . " <" . $contactArray['email'] . ">"; + } + } + } + } if (empty($sendto)) { if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { $sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; From a849283e378b883ec59c6702efa1dcd2cbc2010e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 20 Dec 2022 12:41:54 +0100 Subject: [PATCH 053/370] update return type --- htdocs/adherents/class/adherent_type.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 25211f11bd9..e0311aacd34 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -933,7 +933,7 @@ class AdherentType extends CommonObject * Return clicable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @return void HTML Code for Kanban thumb. + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '') { @@ -967,6 +967,6 @@ class AdherentType extends CommonObject $return .= ''; $return .= ''; $return .= ''; - print $return; + return $return; } } From 0582653a679d0da3399f399ed39d634d46c99d57 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 21 Dec 2022 10:55:03 +0100 Subject: [PATCH 054/370] FIX : get multicurrency infos of propal when create order from propal with "WORKFLOW_PROPAL_AUTOCREATE_ORDER" conf --- htdocs/commande/class/commande.class.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54e50baa9f7..2e20567e4c5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1355,6 +1355,27 @@ class Commande extends CommonOrder $this->origin = $object->element; $this->origin_id = $object->id; + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) + if (!empty($conf->multicurrency->enabled)) { + if (!empty($object->multicurrency_code)) { + $this->multicurrency_code = $object->multicurrency_code; + } + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($object->multicurrency_tx)) { + $this->multicurrency_tx = $object->multicurrency_tx; + } + + if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { + list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande); + } else { + $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); + } + if (empty($this->fk_multicurrency)) { + $this->multicurrency_code = $conf->currency; + $this->fk_multicurrency = 0; + $this->multicurrency_tx = 1; + } + } + // get extrafields from original line $object->fetch_optionals(); From 3b9d39c1d2fae893b272532167353a64ba866ba1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 21 Dec 2022 10:00:26 +0000 Subject: [PATCH 055/370] Fixing style errors. --- htdocs/commande/class/commande.class.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2e20567e4c5..12054c3ccb8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1355,7 +1355,7 @@ class Commande extends CommonOrder $this->origin = $object->element; $this->origin_id = $object->id; - // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($conf->multicurrency->enabled)) { if (!empty($object->multicurrency_code)) { $this->multicurrency_code = $object->multicurrency_code; @@ -1364,16 +1364,16 @@ class Commande extends CommonOrder $this->multicurrency_tx = $object->multicurrency_tx; } - if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { - list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande); - } else { - $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); - } - if (empty($this->fk_multicurrency)) { - $this->multicurrency_code = $conf->currency; - $this->fk_multicurrency = 0; - $this->multicurrency_tx = 1; - } + if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { + list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande); + } else { + $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); + } + if (empty($this->fk_multicurrency)) { + $this->multicurrency_code = $conf->currency; + $this->fk_multicurrency = 0; + $this->multicurrency_tx = 1; + } } // get extrafields from original line From a48d1ae8e392cc2b2ad9d9c324983d1e6193c1b1 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 21 Dec 2022 12:31:24 +0100 Subject: [PATCH 056/370] FIX : multicurrency_tx and not currency_tx --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c0d7cf53a5d..4f3d9230899 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2929,8 +2929,8 @@ if ($action == 'create') { $remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); if (!empty($conf->multicurrency->enabled)) { - $currency_code = (!empty($expesrc->currency_code) ? $expesrc->currency_code : (!empty($soc->currency_code) ? $soc->currency_code : $objectsrc->multicurrency_code)); - $currency_tx = (!empty($expesrc->currency_tx) ? $expesrc->currency_tx : (!empty($soc->currency_tx) ? $soc->currency_tx : $objectsrc->currency_tx)); + $currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code)); + $currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx)); } //Replicate extrafields From c033a4778e68f8371ff7a4983a0751de0ed6b591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Wed, 21 Dec 2022 13:17:18 +0100 Subject: [PATCH 057/370] New filter for Signed+Billed in proposals New filter for Signed+Billed in proposals --- htdocs/core/class/html.formpropal.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index e23e71a8124..d9c458161bc 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -132,6 +132,14 @@ class FormPropal print ''; $i++; } + //Option for Signed+Billed + if ($selected != '' && $selected == "2,4") { + print ''; print ''; print ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($showempty < 0 ? (string) $showempty : '-1'), $morecss); From 3004c3cd920b815651aaa36c491cd4444d7fb1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Wed, 21 Dec 2022 13:22:56 +0100 Subject: [PATCH 058/370] Update html.formpropal.class.php --- htdocs/core/class/html.formpropal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index d9c458161bc..48551926e1f 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2022 Josep Lluís Amador * * 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 From 80d6c262029ec69caec69db358fa4fbae5cc89ec Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 21 Dec 2022 12:31:33 +0000 Subject: [PATCH 059/370] Fixing style errors. --- htdocs/core/class/html.formpropal.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index 48551926e1f..fbbf2c97fb7 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -135,12 +135,12 @@ class FormPropal } //Option for Signed+Billed if ($selected != '' && $selected == "2,4") { - print ''; + print ''; print ''; print ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($showempty < 0 ? (string) $showempty : '-1'), $morecss); From 69b0cf9bcfeeab25166131128b3f229477255771 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 21 Dec 2022 14:05:54 +0100 Subject: [PATCH 060/370] FIX : include class multicurrency --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 12054c3ccb8..d56eeb2af0e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1281,6 +1281,7 @@ class Commande extends CommonOrder { global $conf, $hookmanager; + dol_include_once('/multicurrency/class/multicurrency.class.php'); dol_include_once('/core/class/extrafields.class.php'); $error = 0; From 2c7e0afabd7c04cbde50fcd9734edc75ac60cb35 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 21 Dec 2022 17:17:33 +0100 Subject: [PATCH 061/370] FIX : travis --- htdocs/commande/class/commande.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d56eeb2af0e..33de271b45d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1366,7 +1366,9 @@ class Commande extends CommonOrder } if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { - list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande); + $tmparray = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande); + $this->fk_multicurrency = $tmparray[0]; + $this->multicurrency_tx = $tmparray[1]; } else { $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); } From 53ba5c0a4939e019a34e265bb8528e0b163cd781 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 22 Dec 2022 10:22:57 +0000 Subject: [PATCH 062/370] Fixing style errors. --- htdocs/adherents/type.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 0d8b37bbeb9..3796522e70e 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -264,9 +264,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); - - if ($user->hasRight('adherent', 'configurer')) { + if ($user->hasRight('adherent', 'configurer')) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } @@ -327,8 +326,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; } - } - else { + } else { print ''; print ''; // IBAN - print ''; // BIC - print ''; if (!empty($conf->prelevement->enabled)) { From 2aa271d96eea915d56f5230689b25b2a0ffe539c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 28 Dec 2022 17:50:16 +0100 Subject: [PATCH 072/370] avoid editretainedwarranty if invoice is not draft --- htdocs/compta/facture/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c0d7cf53a5d..d682a17d91b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4517,13 +4517,13 @@ if ($action == 'create') { print '
'; @@ -1427,18 +1402,6 @@ if ($resql) { print ''; - print ''; - print ''; @@ -1705,15 +1668,6 @@ if ($resql) { if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); } - - - if (!empty($arrayfields['pr.desc']['checked'])) { - print_liste_field_titre($arrayfields['pr.desc']['label'], $_SERVER["PHP_SELF"], 'pr.desc', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cdet.qty']['checked'])) { - print_liste_field_titre($arrayfields['cdet.qty']['label'], $_SERVER["PHP_SELF"], 'cdet.qty', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['c.ref']['checked'])) { print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder); } @@ -1885,8 +1839,6 @@ if ($resql) { $total_ht = 0; $total_margin = 0; - - $imaxinloop = ($limit ? min($num, $limit) : $num); $last_num = min($num, $limit); while ($i < $imaxinloop) { From b3c903723f3e3335be8f8a8fe426cd5312c846b3 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 11:37:08 +0200 Subject: [PATCH 014/370] Add menu and clean --- htdocs/commande/list_line.php | 33 +++++++------------------ htdocs/core/menus/standard/eldy.lib.php | 3 +++ htdocs/langs/en_US/orders.lang | 1 + 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index ac1885b03af..219d8745587 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -75,7 +75,6 @@ $search_product_category = GETPOST('search_product_category', 'int'); // Détail commande $search_refProduct = GETPOST('search_refProduct', 'alpha'); $search_descProduct = GETPOST('search_descProduct', 'alpha'); -$check_orderdetail = GETPOST('check_orderdetail', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); @@ -169,6 +168,10 @@ if (empty($user->socid)) { $checkedtypetiers = 0; $arrayfields = array( + // Détail commande + 'pr.ref'=> array('label'=>'ProductRef', 'checked'=>1, 'position'=>1), + 'pr.desc'=> array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1), + 'cdet.qty'=> array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1), 'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10), 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>20), @@ -211,13 +214,6 @@ $arrayfields = array( 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); -// Détail commande -if (!empty($check_orderdetail)) { - $arrayfields['cdet.qty'] = array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1); - $arrayfields['pr.desc'] = array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1); - $arrayfields['pr.ref'] = array('label'=>'ProductRef', 'checked'=>1, 'position'=>1); -} - // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -810,10 +806,8 @@ $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shippin $sql .= ' c.fk_input_reason, c.import_key'; // Détail commande -if (!empty($check_orderdetail)) { - $sql .= ', cdet.description, cdet.qty, '; - $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; -} +$sql .= ', cdet.description, cdet.qty, '; +$sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; @@ -837,13 +831,9 @@ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { } // Détail commande -if (!empty($check_orderdetail)) { - $sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; -} else { - $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; -} +$sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; @@ -1353,11 +1343,6 @@ if ($resql) { print '
'; } - // Détail commande - if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)) { - print '
 
'; - } - if ($sall) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4707657d3e3..e4e6c8e2839 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1324,6 +1324,9 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($user->socid)) { + $newmenu->add("/commande/list_line.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->rights->commande->lire); + } $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); } diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 78a5e348516..cb64d1b603a 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -96,6 +96,7 @@ OrdersStatisticsSuppliers=Purchase order statistics NumberOfOrdersByMonth=Number of orders by month AmountOfOrdersByMonthHT=Amount of orders by month (excl. tax) ListOfOrders=List of orders +ListOrderLigne=Lines of orders CloseOrder=Close order ConfirmCloseOrder=Are you sure you want to set this order to delivered? Once an order is delivered, it can be set to billed. ConfirmDeleteOrder=Are you sure you want to delete this order? From d7387ecd17ac974351de6dcd5919be717bd9632f Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 12:33:03 +0200 Subject: [PATCH 015/370] optimise --- htdocs/commande/list_line.php | 606 +++------------------------------- 1 file changed, 49 insertions(+), 557 deletions(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index 219d8745587..9437daebf33 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -189,9 +189,9 @@ $arrayfields = array( 'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>-1, 'position'=>67), 'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>-1, 'position'=>68), 'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>-1, 'position'=>69), - 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), + 'cdet.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80), - 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), + 'cdet.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), 'c.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>90), 'c.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>95), 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100), @@ -314,458 +314,12 @@ if (empty($reshook)) { $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - - if ($massaction == 'confirm_createbills') { // Create bills from orders. - $orders = GETPOST('toselect', 'array'); - $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('validate_invoices', 'int'); - - $errors = array(); - - $TFact = array(); - $TFactThird = array(); - $TFactThirdNbLines = array(); - - $nb_bills_created = 0; - $lastid= 0; - $lastref = ''; - - $db->begin(); - - $nbOrders = is_array($orders) ? count($orders) : 1; - - foreach ($orders as $id_order) { - $cmd = new Commande($db); - if ($cmd->fetch($id_order) <= 0) { - continue; - } - $cmd->fetch_thirdparty(); - - $objecttmp = new Facture($db); - if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) { - // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it. - $objecttmp = $TFactThird[$cmd->socid]; - } else { - // If we want one invoice per order or if there is no first invoice yet for this thirdparty. - $objecttmp->socid = $cmd->socid; - $objecttmp->thirdparty = $cmd->thirdparty; - - $objecttmp->type = $objecttmp::TYPE_STANDARD; - $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id; - $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id; - - $objecttmp->fk_project = $cmd->fk_project; - $objecttmp->multicurrency_code = $cmd->multicurrency_code; - if (empty($createbills_onebythird)) { - $objecttmp->ref_client = $cmd->ref_client; - } - - $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - if (empty($datefacture)) { - $datefacture = dol_now(); - } - - $objecttmp->date = $datefacture; - $objecttmp->origin = 'commande'; - $objecttmp->origin_id = $id_order; - - $objecttmp->array_options = $cmd->array_options; // Copy extrafields - - $res = $objecttmp->create($user); - - if ($res > 0) { - $nb_bills_created++; - $lastref = $objecttmp->ref; - $lastid = $objecttmp->id; - - $TFactThird[$cmd->socid] = $objecttmp; - $TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang - } else { - $langs->load("errors"); - $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]); - $error++; - } - } - - if ($objecttmp->id > 0) { - $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order); - - if ($res == 0) { - $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]); - $error++; - } - - if (!$error) { - $lines = $cmd->lines; - if (empty($lines) && method_exists($cmd, 'fetch_lines')) { - $cmd->fetch_lines(); - $lines = $cmd->lines; - } - - $fk_parent_line = 0; - $num = count($lines); - - for ($i = 0; $i < $num; $i++) { - $desc = ($lines[$i]->desc ? $lines[$i]->desc : ''); - // If we build one invoice for several orders, we must put the ref of order on the invoice line - if (!empty($createbills_onebythird)) { - $desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day')); - } - - if ($lines[$i]->subprice < 0) { - // Negative line, we create a discount line - $discount = new DiscountAbsolute($db); - $discount->fk_soc = $objecttmp->socid; - $discount->amount_ht = abs($lines[$i]->total_ht); - $discount->amount_tva = abs($lines[$i]->total_tva); - $discount->amount_ttc = abs($lines[$i]->total_ttc); - $discount->tva_tx = $lines[$i]->tva_tx; - $discount->fk_user = $user->id; - $discount->description = $desc; - $discountid = $discount->create($user); - if ($discountid > 0) { - $result = $objecttmp->insert_discount($discountid); - //$result=$discount->link_to_invoice($lineid,$id); - } else { - setEventMessages($discount->error, $discount->errors, 'errors'); - $error++; - break; - } - } else { - // Positive line - $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); - // Date start - $date_start = false; - if ($lines[$i]->date_debut_prevue) { - $date_start = $lines[$i]->date_debut_prevue; - } - if ($lines[$i]->date_debut_reel) { - $date_start = $lines[$i]->date_debut_reel; - } - if ($lines[$i]->date_start) { - $date_start = $lines[$i]->date_start; - } - //Date end - $date_end = false; - if ($lines[$i]->date_fin_prevue) { - $date_end = $lines[$i]->date_fin_prevue; - } - if ($lines[$i]->date_fin_reel) { - $date_end = $lines[$i]->date_fin_reel; - } - if ($lines[$i]->date_end) { - $date_end = $lines[$i]->date_end; - } - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { - $fk_parent_line = 0; - } - - // Extrafields - if (method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals(); - $array_options = $lines[$i]->array_options; - } - - $objecttmp->context['createfromclone']; - - $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang; - //there may already be rows from previous orders - if (!empty($createbills_onebythird)) { - $rang = $TFactThirdNbLines[$cmd->socid]; - } - - $result = $objecttmp->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $date_start, - $date_end, - 0, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $product_type, - $rang, - $lines[$i]->special_code, - $objecttmp->origin, - $lines[$i]->rowid, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht, - $lines[$i]->label, - $array_options, - 100, - 0, - $lines[$i]->fk_unit - ); - if ($result > 0) { - $lineid = $result; - if (!empty($createbills_onebythird)) //increment rang to keep order - $TFactThirdNbLines[$rcp->socid]++; - } else { - $lineid = 0; - $error++; - break; - } - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { - $fk_parent_line = $result; - } - } - } - } - } - - //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. - - if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) { - $TFactThird[$cmd->socid] = $objecttmp; - } else { - $TFact[$objecttmp->id] = $objecttmp; - } - } - - // Build doc with all invoices - $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; - $toselect = array(); - - if (!$error && $validate_invoices) { - $massaction = $action = 'builddoc'; - - foreach ($TAllFact as &$objecttmp) { - $result = $objecttmp->validate($user); - if ($result <= 0) { - $error++; - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - break; - } - - $id = $objecttmp->id; // For builddoc action - - // Builddoc - $donotredirect = 1; - $upload_dir = $conf->facture->dir_output; - $permissiontoadd = $user->rights->facture->creer; - - // Call action to build doc - $savobject = $object; - $object = $objecttmp; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - $object = $savobject; - } - - $massaction = $action = 'confirm_createbills'; - } - - if (!$error) { - $db->commit(); - - if ($nb_bills_created == 1) { - $texttoshow = $langs->trans('BillXCreated', '{s1}'); - $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); - setEventMessages($texttoshow, null, 'mesgs'); - } else { - setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); - } - - // Make a redirect to avoid to bill twice if we make a refresh or back - $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 ($socid > 0) { - $param .= '&socid='.urlencode($socid); - } - if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); - } - if ($search_orderday) { - $param .= '&search_orderday='.urlencode($search_orderday); - } - if ($search_ordermonth) { - $param .= '&search_ordermonth='.urlencode($search_ordermonth); - } - if ($search_orderyear) { - $param .= '&search_orderyear='.urlencode($search_orderyear); - } - if ($search_deliveryday) { - $param .= '&search_deliveryday='.urlencode($search_deliveryday); - } - if ($search_deliverymonth) { - $param .= '&search_deliverymonth='.urlencode($search_deliverymonth); - } - if ($search_deliveryyear) { - $param .= '&search_deliveryyear='.urlencode($search_deliveryyear); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_company) { - $param .= '&search_company='.urlencode($search_company); - } - if ($search_ref_customer) { - $param .= '&search_ref_customer='.urlencode($search_ref_customer); - } - if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); - } - if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); - } - if ($search_total_ht != '') { - $param .= '&search_total_ht='.urlencode($search_total_ht); - } - if ($search_total_vat != '') { - $param .= '&search_total_vat='.urlencode($search_total_vat); - } - if ($search_total_ttc != '') { - $param .= '&search_total_ttc='.urlencode($search_total_ttc); - } - if ($search_project_ref >= 0) { - $param .= "&search_project_ref=".urlencode($search_project_ref); - } - if ($show_files) { - $param .= '&show_files='.urlencode($show_files); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - if ($billed != '') { - $param .= '&billed='.urlencode($billed); - } - - header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); - exit; - } else { - $db->rollback(); - - $action = 'create'; - $_GET["origin"] = $_POST["origin"]; - $_GET["originid"] = $_POST["originid"]; - if (!empty($errors)) { - setEventMessages(null, $errors, 'errors'); - } else { - setEventMessages("Error", null, 'errors'); - } - $error++; - } - } -} -if ($action == 'validate' && $permissiontoadd) { - if (GETPOST('confirm') == 'yes') { - $objecttmp = new $objectclass($db); - $db->begin(); - $error = 0; - foreach ($toselect as $checked) { - if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 0) { - if (!empty($objecttmp->fk_warehouse)) { - $idwarehouse = $objecttmp->fk_warehouse; - } else { - $idwarehouse = 0; - } - if ($objecttmp->valid($user, $idwarehouse)) { - setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs'); - } else { - setEventMessage($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - } - } else { - $langs->load("errors"); - setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors'); - $error++; - } - } else { - dol_print_error($db); - $error++; - } - } - if ($error) { - $db->rollback(); - } else { - $db->commit(); - } - } -} -if ($action == 'shipped' && $permissiontoadd) { - if (GETPOST('confirm') == 'yes') { - $objecttmp = new $objectclass($db); - $db->begin(); - $error = 0; - foreach ($toselect as $checked) { - if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { - if ($objecttmp->cloture($user)) { - setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs'); - } else { - setEventMessage($langs->trans('CantBeClosed'), 'errors'); - $error++; - } - } else { - $langs->load("errors"); - setEventMessage($langs->trans('ErrorIsNotADraft', $objecttmp->ref), 'errors'); - $error++; - } - } else { - dol_print_error($db); - $error++; - } - } - if ($error) { - $db->rollback(); - } else { - $db->commit(); - } - } } + // Closed records -if (!$error && $massaction === 'setbilled' && $permissiontoclose) { - $db->begin(); +// if (!$error && $massaction === 'setbilled' && $permissiontoclose) { - $objecttmp = new $objectclass($db); - $nbok = 0; - foreach ($toselect as $toselectid) { - $result = $objecttmp->fetch($toselectid); - if ($result > 0) { - $result = $objecttmp->classifyBilled($user, 0); - if ($result <= 0) { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } else { - $nbok++; - } - } else { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } - - if (!$error) { - if ($nbok > 1) { - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - } else { - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - } - $db->commit(); - } else { - $db->rollback(); - } -} +// } /* * View @@ -796,7 +350,7 @@ $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.pho $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " country.code as country_code,"; -$sql .= ' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; +$sql .= ' c.rowid, c.ref, c.ref_client, c.fk_user_author,'; $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; @@ -806,7 +360,7 @@ $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shippin $sql .= ' c.fk_input_reason, c.import_key'; // Détail commande -$sql .= ', cdet.description, cdet.qty, '; +$sql .= ', cdet.rowid, cdet.description, cdet.qty, cdet.total_ht, cdet.total_tva, cdet.total_ttc, '; $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { @@ -959,13 +513,13 @@ if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); } if ($search_total_ht != '') { - $sql .= natural_search('c.total_ht', $search_total_ht, 1); + $sql .= natural_search('cdet.total_ht', $search_total_ht, 1); } if ($search_total_vat != '') { - $sql .= natural_search('c.total_tva', $search_total_vat, 1); + $sql .= natural_search('cdet.total_tva', $search_total_vat, 1); } if ($search_total_ttc != '') { - $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); + $sql .= natural_search('cdet.total_ttc', $search_total_ttc, 1); } if ($search_warehouse != '' && $search_warehouse > 0) { $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); @@ -1231,33 +785,26 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + 'GenerateOrdersSuppliers'=>img_picto('', 'doc', 'class="pictofixedwidth"').$langs->trans("GenerateOrdersSupplie"), ); - if ($permissiontovalidate) { - $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); - } - if ($permissiontosendbymail) { - $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); - } - if ($permissiontoclose) { - $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); - } - if ($permissiontocancel) { - $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); - } - if (!empty($conf->invoice->enabled) && $user->rights->facture->creer) { - $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); - } - if ($permissiontoclose) { - $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); - } - if ($permissiontodelete) { - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); - } - if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { - $arrayofmassactions = array(); - } + // if ($permissiontovalidate) { + // $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); + // } + // if ($permissiontosendbymail) { + // $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); + // } + // if ($permissiontoclose) { + // $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); + // } + // if ($permissiontocancel) { + // $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + // } + // if ($permissiontodelete) { + // $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + // } + // if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { + // $arrayofmassactions = array(); + // } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $url = DOL_URL_ROOT.'/commande/card.php?action=create'; @@ -1288,61 +835,6 @@ if ($resql) { $trackid = 'ord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - if ($massaction == 'prevalidate') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); - } - if ($massaction == 'preshipped') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("CloseOrder"), $langs->trans("ConfirmCloseOrder"), "shipped", null, '', 0, 200, 500, 1); - } - - if ($massaction == 'createbills') { - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans('DateInvoice'); - print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); - print '
'; - print $langs->trans('CreateOneBillByThird'); - print ''; - print $form->selectyesno('createbills_onebythird', '', 1); - print '
'; - print $langs->trans('ValidateInvoices'); - print ''; - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - print $form->selectyesno('validate_invoices', 0, 1, 1); - print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; - } else { - print $form->selectyesno('validate_invoices', 0, 1); - } - if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { - print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; - } else { - print '     '.$langs->trans("OptionToSetOrderBilledNotEnabled").''; - } - print '
'; - - print '
'; - print '
'; - print ' '; - print ''; - print '
'; - print '
'; - } - if ($sall) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); @@ -1552,7 +1044,7 @@ if ($resql) { $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1); print '
'; print ''; @@ -1564,7 +1056,7 @@ if ($resql) { print ''; print ''; print ''; @@ -1778,14 +1270,14 @@ if ($resql) { if (!empty($arrayfields['c.fk_input_reason']['checked'])) { print_liste_field_titre($arrayfields['c.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "c.fk_input_reason", "", $param, '', $sortfield, $sortorder); } - if (!empty($arrayfields['c.total_ht']['checked'])) { - print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['cdet.total_ht']['checked'])) { + print_liste_field_titre($arrayfields['cdet.total_ht']['label'], $_SERVER["PHP_SELF"], 'cdet.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['c.total_vat']['checked'])) { - print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'cdet.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); } - if (!empty($arrayfields['c.total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['cdet.total_ttc']['checked'])) { + print_liste_field_titre($arrayfields['cdet.total_ttc']['label'], $_SERVER["PHP_SELF"], 'cdet.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['c.multicurrency_code']['checked'])) { print_liste_field_titre($arrayfields['c.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_code', '', $param, '', $sortfield, $sortorder); @@ -1824,9 +1316,9 @@ if ($resql) { $totalarray = array( 'nbfield' => 0, 'val' => array( - 'c.total_ht' => 0, - 'c.total_tva' => 0, - 'c.total_ttc' => 0, + 'cdet.total_ht' => 0, + 'cdet.total_tva' => 0, + 'cdet.total_ttc' => 0, ), 'pos' => array(), ); @@ -2195,18 +1687,18 @@ if ($resql) { } } // Amount HT - if (!empty($arrayfields['c.total_ht']['checked'])) { + if (!empty($arrayfields['cdet.total_ht']['checked'])) { print ''.price($obj->total_ht)."'.price($obj->total_ttc)."
'.$obj->qty.''; @@ -1283,6 +1288,9 @@ if ($resql) { if (!empty($arrayfields['cdet.total_ttc']['checked'])) { print_liste_field_titre($arrayfields['cdet.total_ttc']['label'], $_SERVER["PHP_SELF"], 'cdet.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); } + if (!empty($arrayfields['c.fk_warehouse']['checked'])) { + print_liste_field_titre($arrayfields['c.fk_warehouse']['label'], "", '', '', $param, '', $sortfield, $sortorder); + } if (!empty($arrayfields['c.multicurrency_code']['checked'])) { print_liste_field_titre($arrayfields['c.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_code', '', $param, '', $sortfield, $sortorder); } @@ -1734,7 +1742,18 @@ if ($resql) { } $totalarray['val']['cdet.total_ttc'] += $obj->total_ttc; } - + // Warehouse + if (!empty($arrayfields['c.fk_warehouse']['checked'])) { + print ''; + if ($obj->warehouse > 0) { + print img_picto('', 'stock', 'class="paddingrightonly"'); + } + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'], $obj->warehouse, 'none'); + print "'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."
'; - 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 ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - print '
'.$obj->rowid.'"; - print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); - print ""; - print $obj->civility; - print "'; - print $memberstatic->getNomUrl(0, 0, 'card', 'firstname'); - //print $obj->firstname; - print "'; - print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); - //print $obj->lastname; - print "'; - if ($obj->gender) { - print $langs->trans("Gender".$obj->gender); - } - print ''; - print $companynametoshow; - print "'.$obj->login."'; - print $memberstatic->getmorphylib('', 2); - print "'; - print $membertypestatic->getNomUrl(1, 32); - print '
'; - print $obj->address; - print ''; - print $obj->zip; - print ''; - print $obj->town; - print '".$obj->state_name."'; - print dol_escape_htmltag($tmparray['label']); - print ''; - print $obj->phone; - print ''; - print $obj->phone_perso; - print ''; - print $obj->phone_mobile; - print ''; - print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); - print "'; - if ($datefin) { - print dol_print_date($datefin, 'day'); - if ($memberstatic->hasDelay()) { - $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; - print " ".img_warning($langs->trans("SubscriptionLate").$textlate); + } else { + print '
'; + 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 ''; } - } else { - if (!empty($obj->subscription)) { - print ''.$langs->trans("SubscriptionNotReceived").''; - if ($obj->statut > 0) { - print " ".img_warning(); + print ''.$obj->rowid.'"; + print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); + print ""; + print $obj->civility; + print "'; + print $memberstatic->getNomUrl(0, 0, 'card', 'firstname'); + //print $obj->firstname; + print "'; + print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); + //print $obj->lastname; + print "'; + if ($obj->gender) { + print $langs->trans("Gender".$obj->gender); + } + print ''; + print $companynametoshow; + print "'.$obj->login."'; + print $memberstatic->getmorphylib('', 2); + print "'; + print $membertypestatic->getNomUrl(1, 32); + print ''; + print $obj->address; + print ''; + print $obj->zip; + print ''; + print $obj->town; + print '".$obj->state_name."'; + print dol_escape_htmltag($tmparray['label']); + print ''; + print $obj->phone; + print ''; + print $obj->phone_perso; + print ''; + print $obj->phone_mobile; + print ''; + print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); + print "'; + if ($datefin) { + print dol_print_date($datefin, 'day'); + if ($memberstatic->hasDelay()) { + $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; + print " ".img_warning($langs->trans("SubscriptionLate").$textlate); } } else { - print ' '; + if (!empty($obj->subscription)) { + print ''.$langs->trans("SubscriptionNotReceived").''; + if ($obj->statut > 0) { + print " ".img_warning(); + } + } else { + print ' '; + } + } + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); - print ''; - print dol_escape_htmltag($obj->import_key); - print "'; - 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; + // Birth + if (!empty($arrayfields['d.birth']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); + print ''; + print dol_escape_htmltag($obj->import_key); + print "'; + 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 ''; + } + print '
'.$subscription->getNomUrl(1).'
'; + print '
'; } - } - // Type - if (!empty($arrayfields['d.fk_type']['checked'])) { - print '
'; - if ($typeid > 0) { - print $adht->getNomUrl(1); - } - print ''.$adherent->getNomUrl(-1, 0, 'card', 'lastname').''.$adherent->firstname.''.$adherent->login.''; - print $obj->note; - print ''; + + //fetch informations needs on this mode + $subscription->fk_adherent = $adherent->getNomUrl(1); + $subscription->fk_type = $adht->getNomUrl(1); + $subscription->amount = $obj->subscription; if ($obj->fk_account > 0) { $accountstatic->id = $obj->fk_account; $accountstatic->fetch($obj->fk_account); - //$accountstatic->label=$obj->label; - print $accountstatic->getNomUrl(1); + $subscription->fk_bank = $accountstatic->getNomUrl(1); } - print "
'.dol_print_date($db->jdate($obj->dateadh), 'day')."
'.$subscription->getNomUrl(1).''.dol_print_date($db->jdate($obj->datef), 'day')."'; + if ($typeid > 0) { + print $adht->getNomUrl(1); + } + print ''.price($obj->subscription).''.$adherent->getNomUrl(-1, 0, 'card', 'lastname').''.$adherent->firstname.''.$adherent->login.''; + print $obj->note; + print ''; + if ($obj->fk_account > 0) { + $accountstatic->id = $obj->fk_account; + $accountstatic->fetch($obj->fk_account); + //$accountstatic->label=$obj->label; + print $accountstatic->getNomUrl(1); + } + print "'.dol_print_date($db->jdate($obj->dateadh), 'day')."'.dol_print_date($db->jdate($obj->datef), 'day')."'.price($obj->subscription).''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + 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->crowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - } - // 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); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['c.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - 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->crowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'; print '
'; } - + //fetch informations needs on this mode $subscription->fk_adherent = $adherent->getNomUrl(1); $subscription->fk_type = $adht->getNomUrl(1); @@ -538,9 +538,7 @@ while ($i < min($num, $limit)) { print '
'; print '
'; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''.dol_escape_htmltag($objp->label).''; - if ($objp->morphy == 'phy') { - print $langs->trans("Physical"); - } elseif ($objp->morphy == 'mor') { - print $langs->trans("Moral"); + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; + } + //output kanban + $membertype->label = $objp->label; + $membertype->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + print '
'; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''.dol_escape_htmltag($objp->label).''; + if ($objp->morphy == 'phy') { + print $langs->trans("Physical"); + } elseif ($objp->morphy == 'mor') { + print $langs->trans("Moral"); + } else { + print $langs->trans("MorAndPhy"); + } + print ''.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().' 
'.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().' 
'; print $membertype->getNomUrl(1); From 1b03c423b94427c6eef855b9678b797c984c5f37 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Thu, 22 Dec 2022 17:13:11 +0100 Subject: [PATCH 063/370] FIX #23281 --- htdocs/admin/perms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index d2f0d79e4f3..60f8c9d064a 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -226,7 +226,7 @@ if ($result) { // Tick if ($obj->bydefault == 1) { print ''; - print ''; + print ''; //print img_edit_remove(); print img_picto('', 'switch_on'); print ''; From 298c97d5a65a0c1512d1b5ab44cbea3320db2c90 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 23 Dec 2022 12:43:26 +0100 Subject: [PATCH 064/370] NEW copyrights --- htdocs/accountancy/bookkeeping/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 781b20edc2e..bdd0fefe191 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,8 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2022 Open-DSI + * Copyright (C) 2013-2022 Alexandre Spangaro + * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Progiseize From 92d9d31b8ce8dc956b30658d459a295366c4f70e Mon Sep 17 00:00:00 2001 From: Randall Mora <50120822+randallmoraes@users.noreply.github.com> Date: Fri, 23 Dec 2022 13:18:04 -0600 Subject: [PATCH 065/370] Update functions.lib.php Agrega el tipo de moneda CRC (colones Costa Rica) para que se muestre al incio como simbolo de moneda. Adds the CRC currency (Costa Rican colones) so that it is displayed at the beginning as a currency symbol. --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 00defaf909c..cf5b77ff63e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5762,7 +5762,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ $currency_code = $conf->currency; } - $listofcurrenciesbefore = array('AUD', 'CAD', 'CNY', 'COP', 'CLP', 'GBP', 'HKD', 'MXN', 'PEN', 'USD'); + $listofcurrenciesbefore = array('AUD', 'CAD', 'CNY', 'COP', 'CLP', 'GBP', 'HKD', 'MXN', 'PEN', 'USD', 'CRC); $listoflanguagesbefore = array('nl_NL'); if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore)) { $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); From 07a1f8e65188d5b352aa233cfca13128de8c1bf8 Mon Sep 17 00:00:00 2001 From: Amael <41053833+Amael-PE@users.noreply.github.com> Date: Mon, 26 Dec 2022 00:05:34 +0100 Subject: [PATCH 066/370] FIX #23334 Implement a price equivalent in command Implement a price equivalent when dealing with minimum prices and foreign currencies. Added in command/card.php for add and update. --- htdocs/commande/card.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d394df997ff..051f047241a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -629,6 +629,15 @@ if (empty($reshook)) { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } + + $price_equivalent = $price_ht; + $currency_tx = $object->multicurrency_tx; + + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($price_ht == '' && $price_ht_devise != '' && $currency_tx != '') { + $price_equivalent = $price_ht_devise * $currency_tx; + } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); @@ -916,7 +925,7 @@ if (empty($reshook)) { $info_bits |= 0x01; } - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($price_equivalent) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { @@ -990,6 +999,15 @@ if (empty($reshook)) { $pu_ht = price2num(GETPOST('price_ht'), '', 2); $vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); + + $pu_equivalent = $pu_ht; + $currency_tx = $object->multicurrency_tx; + + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } // Define info_bits $info_bits = 0; @@ -1039,7 +1057,7 @@ if (empty($reshook)) { $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_equivalent) * (1 - $remise_percent / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } From 58d3cdb13cc55fe5d221270d4c8babe107639fa3 Mon Sep 17 00:00:00 2001 From: Amael <41053833+Amael-PE@users.noreply.github.com> Date: Mon, 26 Dec 2022 00:31:38 +0100 Subject: [PATCH 067/370] FIX #23334 Implement a price equivalent in propal Implement a price equivalent when dealing with minimum prices and foreign currencies. Added in comm/propal/card.php as it was done in command/card.php for add and update. --- htdocs/comm/propal/card.php | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index da4c756705f..9461927bec5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1116,7 +1116,17 @@ if (empty($reshook)) { $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + + // Prepare a price equivlanet for mimum price check + $pu_equivalent = $pu_ht; + $currency_tx = $object->multicurrency_tx; + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } + // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $tva_npr); @@ -1125,8 +1135,9 @@ if (empty($reshook)) { if ($tva_npr) { $info_bits |= 0x01; } - - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { + + // Check minimum price + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($pu_equivalent) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { @@ -1218,6 +1229,16 @@ if (empty($reshook)) { $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); $remise_percent = price2num(GETPOST('remise_percent'), '', 2); + + // Prepare pu_equivament for checking the minimun price + $pu_equivalent = $pu_ht; + $currency_tx = $object->multicurrency_tx; + + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1250,7 +1271,7 @@ if (empty($reshook)) { } $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_equivalent) * (1 - $remise_percent / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } From 50e2545bea8bbb7d3632fe54d81c655cb51831b7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 25 Dec 2022 23:41:03 +0000 Subject: [PATCH 068/370] Fixing style errors. --- htdocs/comm/propal/card.php | 12 ++++++------ htdocs/commande/card.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9461927bec5..4881209e386 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1116,7 +1116,7 @@ if (empty($reshook)) { $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); - + // Prepare a price equivlanet for mimum price check $pu_equivalent = $pu_ht; $currency_tx = $object->multicurrency_tx; @@ -1126,7 +1126,7 @@ if (empty($reshook)) { if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { $pu_equivalent = $pu_ht_devise * $currency_tx; } - + // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $tva_npr); @@ -1135,7 +1135,7 @@ if (empty($reshook)) { if ($tva_npr) { $info_bits |= 0x01; } - + // Check minimum price if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($pu_equivalent) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); @@ -1229,7 +1229,7 @@ if (empty($reshook)) { $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); $remise_percent = price2num(GETPOST('remise_percent'), '', 2); - + // Prepare pu_equivament for checking the minimun price $pu_equivalent = $pu_ht; $currency_tx = $object->multicurrency_tx; @@ -1237,8 +1237,8 @@ if (empty($reshook)) { // Check if we have a foreing currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; - } + $pu_equivalent = $pu_ht_devise * $currency_tx; + } // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 051f047241a..e48b3183006 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -629,14 +629,14 @@ if (empty($reshook)) { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } - + $price_equivalent = $price_ht; $currency_tx = $object->multicurrency_tx; // Check if we have a foreing currency // If so, we update the pu_equiv as the equivalent price in base currency if ($price_ht == '' && $price_ht_devise != '' && $currency_tx != '') { - $price_equivalent = $price_ht_devise * $currency_tx; + $price_equivalent = $price_ht_devise * $currency_tx; } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); @@ -999,14 +999,14 @@ if (empty($reshook)) { $pu_ht = price2num(GETPOST('price_ht'), '', 2); $vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); - + $pu_equivalent = $pu_ht; $currency_tx = $object->multicurrency_tx; // Check if we have a foreing currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; + $pu_equivalent = $pu_ht_devise * $currency_tx; } // Define info_bits From d0ea4760d9f8921c3e2761c84689f9c9b0904e4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 02:38:40 +0100 Subject: [PATCH 069/370] Update perms.php --- htdocs/admin/perms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 60f8c9d064a..8b1f6249d93 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -226,7 +226,7 @@ if ($result) { // Tick if ($obj->bydefault == 1) { print ''; - print ''; + print ''; //print img_edit_remove(); print img_picto('', 'switch_on'); print ''; From f3d73690c6a8139590ff7db7b752909e72379deb Mon Sep 17 00:00:00 2001 From: Randall Mora <50120822+randallmoraes@users.noreply.github.com> Date: Wed, 28 Dec 2022 08:29:55 -0600 Subject: [PATCH 070/370] Update notify.class.php Allows modification of attachments using the hook --- htdocs/core/class/notify.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 2a3a2b805da..c85339f7df8 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -658,6 +658,11 @@ class Notify $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { + if (!empty($hookmanager->resArray['files'])) { + $filename_list = $hookmanager->resArray['files']['file']; + $mimetype_list = $hookmanager->resArray['files']['mimefile']; + $mimefilename_list = $hookmanager->resArray['files']['filename']; + } if (!empty($hookmanager->resArray['subject'])) { $subject .= $hookmanager->resArray['subject']; } @@ -901,6 +906,11 @@ class Notify $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list); $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { + if (!empty($hookmanager->resArray['files'])) { + $filename_list = $hookmanager->resArray['files']['file']; + $mimetype_list = $hookmanager->resArray['files']['mimefile']; + $mimefilename_list = $hookmanager->resArray['files']['filename']; + } if (!empty($hookmanager->resArray['subject'])) { $subject .= $hookmanager->resArray['subject']; } From 53912df6f2b8127c61cc215798f7fc27c6fc77af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 15:49:03 +0100 Subject: [PATCH 071/370] FIX Warning not visible --- htdocs/societe/paymentmodes.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index ae39569a36e..6869e80bd87 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1480,20 +1480,22 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $string; print ''.dol_escape_htmltag($rib->iban); + print ''; if (!empty($rib->iban)) { if (!checkIbanForAccount($rib)) { - print ' '.img_picto($langs->trans("IbanNotValid"), 'warning'); + print img_picto($langs->trans("IbanNotValid"), 'warning').' '; } } + print dol_escape_htmltag($rib->iban); print ''.$rib->bic; + print ''; if (!empty($rib->bic)) { if (!checkSwiftForAccount($rib)) { - print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning'); + print img_picto($langs->trans("SwiftNotValid"), 'warning').' '; } } + print dol_escape_htmltag($rib->bic); print '
'; - if ($action != 'editretainedwarranty' && $user->rights->facture->creer) { + if ($action != 'editretainedwarranty' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) { print ''; } print '
'; print $langs->trans('RetainedWarranty'); print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'
'; print '
'; - if ($action == 'editretainedwarranty') { + if ($action == 'editretainedwarranty' && $object->statut == Facture::STATUS_DRAFT) { print ''; print ''; print ''; @@ -4540,7 +4540,7 @@ if ($action == 'create') { print ''; - if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) { + if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) { print ''; } @@ -4551,7 +4551,7 @@ if ($action == 'create') { $defaultDate = $object->date; } - if ($action == 'editretainedwarrantypaymentterms') { + if ($action == 'editretainedwarrantypaymentterms' && $object->statut == Facture::STATUS_DRAFT) { //date('Y-m-d',$object->date_lim_reglement) print ''; print ''; @@ -4575,7 +4575,7 @@ if ($action == 'create') { print '
'; print $langs->trans('PaymentConditionsShortRetainedWarranty'); print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'
'; - if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) { + if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) { print ''; } @@ -4586,7 +4586,7 @@ if ($action == 'create') { $defaultDate = $object->date; } - if ($action == 'editretainedwarrantydatelimit') { + if ($action == 'editretainedwarrantydatelimit' && $object->statut == Facture::STATUS_DRAFT) { //date('Y-m-d',$object->date_lim_reglement) print ''; print ''; From be03dcb8ceeb94f03958509e7070caa1ac1a8da5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 19:06:16 +0100 Subject: [PATCH 073/370] Fix strange condition --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ca2418a0ab1..5e5198d6b4c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2985,7 +2985,7 @@ class Product extends CommonObject $adeduire = 0; $sql = "SELECT sum(fd.qty) as count FROM ".MAIN_DB_PREFIX."facturedet fd "; $sql .= " JOIN ".MAIN_DB_PREFIX."facture f ON fd.fk_facture = f.rowid "; - $sql .= " JOIN ".MAIN_DB_PREFIX."element_element el ON el.fk_target = f.rowid and el.targettype = 'facture' and sourcetype = 'commande'"; + $sql .= " JOIN ".MAIN_DB_PREFIX."element_element el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; $sql .= " JOIN ".MAIN_DB_PREFIX."commande c ON el.fk_source = c.rowid "; $sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND c.facture = 0 AND fd.fk_product = ".((int) $this->id); dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE); From 934d7b46d01c3ae93d7fe50179dfb1c0376fab7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 19:15:07 +0100 Subject: [PATCH 074/370] Update product.class.php --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9cb7187a0ad..d9e09ce788d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3091,9 +3091,9 @@ class Product extends CommonObject // For every order having invoice already validated we need to decrease stock cause it's in physical stock $adeduire = 0; $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet fd '; - $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON fd.fk_facture = f.rowid '; - $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; - $sql .= ' JOIN '.MAIN_DB_PREFIX.'commande c ON el.fk_source = c.rowid '; + $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture as f ON fd.fk_facture = f.rowid '; + $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; + $sql .= ' JOIN '.MAIN_DB_PREFIX.'commande as c ON el.fk_source = c.rowid '; $sql .= ' WHERE c.fk_statut IN ('.$this->db->sanitize($filtrestatut).') AND f.fk_statut > '.Facture::STATUS_DRAFT.' AND fd.fk_product = '.((int) $this->id); dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE); $resql = $this->db->query($sql); From 572ba6d3e06b591c51dd7c0dd3d0ec7f6592248e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 19:15:46 +0100 Subject: [PATCH 075/370] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d9e09ce788d..0271e0c0d2c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3070,7 +3070,7 @@ class Product extends CommonObject if (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if (!empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) { $adeduire = 0; - $sql = "SELECT sum(fd.qty) as count FROM ".$this->db->prefix()."facturedet fd "; + $sql = "SELECT sum(fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd "; $sql .= " JOIN ".$this->db->prefix()."facture as f ON fd.fk_facture = f.rowid "; $sql .= " JOIN ".$this->db->prefix()."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; $sql .= " JOIN ".$this->db->prefix()."commande as c ON el.fk_source = c.rowid "; @@ -3090,7 +3090,7 @@ class Product extends CommonObject // For every order having invoice already validated we need to decrease stock cause it's in physical stock $adeduire = 0; - $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet fd '; + $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet as fd '; $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture as f ON fd.fk_facture = f.rowid '; $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; $sql .= ' JOIN '.MAIN_DB_PREFIX.'commande as c ON el.fk_source = c.rowid '; From 582d9ac514bd94632a8eea47fe39e25844cb0365 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 19:22:34 +0100 Subject: [PATCH 076/370] Update product.class.php --- htdocs/product/class/product.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0271e0c0d2c..f17a128544a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3005,7 +3005,7 @@ class Product extends CommonObject * * @param int $socid Id societe pour filtrer sur une societe * @param string $filtrestatut Id statut pour filtrer sur un statut - * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. + * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. Set when load_stats_commande is used for virtual stock calculation. * @return integer Array of stats in $this->stats_commande (nb=nb of order, qty=qty ordered), <0 if ko or >0 if ok */ public function load_stats_commande($socid = 0, $filtrestatut = '', $forVirtualStock = 0) @@ -3065,10 +3065,10 @@ class Product extends CommonObject } // If stock decrease is on invoice validation, the theorical stock continue to - // count the orders to ship in theorical stock when some are already removed b invoice validation. - // If option DECREASE_ONLY_UNINVOICEDPRODUCTS is on, we make a compensation. - if (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + // count the orders to ship in theorical stock when some are already removed by invoice validation. + if ($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if (!empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) { + // If option DECREASE_ONLY_UNINVOICEDPRODUCTS is on, we make a compensation but only if order not yet invoice. $adeduire = 0; $sql = "SELECT sum(fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd "; $sql .= " JOIN ".$this->db->prefix()."facture as f ON fd.fk_facture = f.rowid "; @@ -3086,6 +3086,7 @@ class Product extends CommonObject $this->stats_commande['qty'] -= $adeduire; } else { + // If option DECREASE_ONLY_UNINVOICEDPRODUCTS is off, we make a compensation with lines of invoices linked to the order include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // For every order having invoice already validated we need to decrease stock cause it's in physical stock From ec95c6402452d45557e1be939fdd9ea730330de1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 23:20:42 +0100 Subject: [PATCH 077/370] Clean code --- htdocs/accountancy/admin/categories.php | 3 ++- htdocs/categories/viewcat.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/modules/modMrp.class.php | 2 +- .../mailings/mailinglist_mymodule_myobject.modules.php | 8 ++++---- htdocs/mrp/lib/mrp.lib.php | 2 +- htdocs/recruitment/admin/setup.php | 3 +-- htdocs/recruitment/admin/setup_candidatures.php | 3 +-- htdocs/recruitment/lib/recruitment.lib.php | 4 ++-- 9 files changed, 14 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 87e6a3b490c..442c0d6763b 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -1,6 +1,7 @@ * Copyright (C) 2017-2022 Alexandre Spangaro + * Copyright (C) 2022 Laurent Destailleur * * 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 @@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $error = 0; // Load translation files required by the page -$langs->loadLangs(array("bills", "accountancy")); +$langs->loadLangs(array("bills", "accountancy", "compta")); $id = GETPOST('id', 'int'); $cancel = GETPOST('cancel', 'alpha'); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 329c9473cc7..6f09e734406 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->load("categories"); +$langs->loadLangs(array("categories", "compta")); $id = GETPOST('id', 'int'); $label = GETPOST('label', 'alpha'); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 398aa6421a7..fece6df98ec 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1622,7 +1622,6 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chartmodel', 40); $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 50); $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 60); if (isModEnabled('banque')) { $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_bank', 70); @@ -1640,6 +1639,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($conf->global->MAIN_FEATURES_LEVEL > 1) { $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120); } + $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 125); $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_export', 130); } diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php index fb836c8393b..58e7791845a 100644 --- a/htdocs/core/modules/modMrp.class.php +++ b/htdocs/core/modules/modMrp.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019 Frédéric France - * Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson + * Copyright (C) 2019 Destailleur Laurent * * 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 diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 7b2c4e2ab5a..ad0814f7b4d 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -104,9 +104,9 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets $target = array(); $j = 0; - $sql = " select rowid as id, email, firstname, lastname, plan, partner"; + $sql = " select rowid as id, label, firstname, lastname"; $sql .= " from ".MAIN_DB_PREFIX."myobject"; - $sql .= " where email IS NOT NULL AND email != ''"; + $sql .= " where email IS NOT NULL AND email <> ''"; if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') { $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; } @@ -129,10 +129,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets 'name' => $obj->lastname, 'id' => $obj->id, 'firstname' => $obj->firstname, - 'other' => $obj->plan.';'.$obj->partner, + 'other' => $obj->label, 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, - 'source_type' => 'dolicloud' + 'source_type' => 'myobject@mymodule' ); $old = $obj->email; $j++; diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php index 854244e53c7..55ec94ef097 100644 --- a/htdocs/mrp/lib/mrp.lib.php +++ b/htdocs/mrp/lib/mrp.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2019 Laurent Destailleur * * 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 diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 517bbca5c19..120c476de90 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -1,6 +1,5 @@ - * Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh +/* Copyright (C) 2004-2020 Laurent Destailleur * * 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 diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index adc12a656f4..b53fff4213a 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -1,6 +1,5 @@ - * Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh +/* Copyright (C) 2004-2020 Laurent Destailleur * * 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 diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php index 6fa58cc64f5..911c6abdb03 100644 --- a/htdocs/recruitment/lib/recruitment.lib.php +++ b/htdocs/recruitment/lib/recruitment.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2022 Frédéric France +/* Copyright (C) 2019 Laurent Destailleur + * Copyright (C) 2022 Frédéric France * * 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 From f7f140f003eb0b7e10bb929b054d9f1d640efc3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 23:39:46 +0100 Subject: [PATCH 078/370] css --- htdocs/accountancy/admin/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 385c105451e..244b6f72330 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -430,7 +430,7 @@ foreach ($list_binding as $key) { print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1); } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') { $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear")); - print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0)); + print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage'); } else { print ''; } From aa5419cfb53626010970a5a6339bd33e298cb6a2 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 29 Dec 2022 16:10:53 +0100 Subject: [PATCH 079/370] update in modulbuilder for menu object --- htdocs/modulebuilder/index.php | 58 +++++++++++++++++-- .../core/modules/modMyModule.class.php | 2 +- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 8b87d84c10e..eeb016db6b6 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1344,12 +1344,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 );\n"; - $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); + $stringtoadd = preg_replace('/MyObject/', $objectname, $stringtoadd); $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); - $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); + $stringtoadd = preg_replace('/myobject/', strtolower($objectname), $stringtoadd); $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; - + } // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 // TODO Avoid duplicate addition @@ -1357,7 +1357,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { // Add module descriptor to list of files to replace "MyObject' string with real name of object. $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; - } } if (!$error) { @@ -1377,7 +1376,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { 'htdocs/modulebuilder/template/'=>strtolower($modulename), 'myobject'=>strtolower($objectname), 'MyObject'=>$objectname, - 'MYOBJECT'=>strtoupper($objectname), + //'MYOBJECT'=>strtoupper($objectname), '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); @@ -1730,6 +1729,55 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php'=>'core/modules/'.strtolower($module).'/doc/pdf_standard_'.strtolower($objectname).'.modules.php' ); + //menu for the object selected + $stringtoedit = "\$this->menu[\$r++]=array( + // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'fk_menu'=>'fk_mainmenu=".strtolower($module)."', + // This is a Left menu entry + 'type'=>'left', + 'titre'=>'List ".ucfirst($objectname)."', + 'mainmenu'=>'".strtolower($module)."', + 'leftmenu'=>'".strtolower($module)."_".strtolower($objectname)."', + 'url'=>'/".strtolower($module)."/".strtolower($objectname)."_list.php', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'".strtolower($module)."@".strtolower($module)."', + 'position'=>1100+\$r, + // Define condition to show or hide menu entry. Use '\$conf->".strtolower($module)."->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'\$conf->".strtolower($module)."->enabled', + // Use 'perms'=>'\$user->rights->".strtolower($module)."->level1->level2' if you want your menu with a permission rules + 'perms'=>'1', + 'target'=>'', + // 0=Menu for internal users, 1=external users, 2=both + 'user'=>2, + ); + \$this->menu[\$r++]=array( + // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'fk_menu'=>'fk_mainmenu=".strtolower($module).",fk_leftmenu=".strtolower($module)."_".strtolower($objectname)."', + // This is a Left menu entry + 'type'=>'left', + 'titre'=>'New ".ucfirst($objectname)."', + 'mainmenu'=>'".strtolower($module)."', + 'leftmenu'=>'".strtolower($module)."_".strtolower($objectname)."', + 'url'=>'/".strtolower($module)."/".strtolower($objectname)."_card.php?action=create', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'".strtolower($module)."@".strtolower($module)."', + 'position'=>1100+\$r, + // Define condition to show or hide menu entry. Use '\$conf->".strtolower($module)."->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'\$conf->".strtolower($module)."->enabled', + // Use 'perms'=>'\$user->rights->".strtolower($module)."->level1->level2' if you want your menu with a permission rules + 'perms'=>'1', + 'target'=>'', + // 0=Menu for internal users, 1=external users, 2=both + 'user'=>2 + );"; + + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + + $check = dolReplaceInFile($moduledescriptorfile, array($stringtoedit => '')); + if ($check > 0) { + dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => '')); + } + $resultko = 0; foreach ($filetodelete as $filetodelete) { $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 99cd900b512..2788c78fc37 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -348,7 +348,7 @@ class modMyModule extends DolibarrModules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); - END MODULEBUILDER LEFTMENU MYOBJECT */ + /* END MODULEBUILDER LEFTMENU MYOBJECT */ // Exports profiles provided by this module $r = 1; /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ From a7c2d723158916e1e73b4e28063a202df2b5ab11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 13:28:36 +0100 Subject: [PATCH 080/370] NEW Can filter on a custom group of accounts. Perf or ledger list. --- htdocs/accountancy/admin/card.php | 4 +- htdocs/accountancy/admin/categories.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 83 ++++++-- .../accountancy/bookkeeping/listbyaccount.php | 53 +++-- .../class/accountancycategory.class.php | 127 ++++++------ .../accountancy/class/bookkeeping.class.php | 181 ++++++++++-------- .../core/class/html.formaccounting.class.php | 4 +- htdocs/langs/en_US/accountancy.lang | 2 +- 8 files changed, 277 insertions(+), 179 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 97d2509b898..43d1852c720 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -282,7 +282,7 @@ if ($action == 'create') { print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); print ''; print ''; print '
'; print $langs->trans('RetainedWarrantyDateLimit'); print 'id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).''; - $formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1); + print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1); print '
'; @@ -359,7 +359,7 @@ if ($action == 'create') { print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); print '
'; - $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); + print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); print '
'; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 442c0d6763b..3414c36cd52 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -111,7 +111,7 @@ print ''; // Select the category print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9590c3551cf..ac1cc93cba7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -102,7 +102,9 @@ if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOS $action = 'export_file'; } -$search_accountancy_code = GETPOST("search_accountancy_code"); +$search_account_category = GETPOST('search_account_category', 'int'); + +$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); if ($search_accountancy_code_start == - 1) { $search_accountancy_code_start = ''; @@ -253,6 +255,7 @@ if (empty($reshook)) { $search_doc_type = ''; $search_doc_ref = ''; $search_doc_date = ''; + $search_account_category = ''; $search_accountancy_code = ''; $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; @@ -335,6 +338,20 @@ if (empty($reshook)) { $filter['t.doc_ref'] = $search_doc_ref; $param .= '&search_doc_ref='.urlencode($search_doc_ref); } + if ($search_account_category != '-1' && !empty($search_account_category)) { + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; + $accountingcategory = new AccountancyCategory($db); + + $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category)); + $listofaccountsforgroup2 = array(); + if (is_array($listofaccountsforgroup)) { + foreach ($listofaccountsforgroup as $tmpval) { + $listofaccountsforgroup2[] = $tmpval['id']; + } + } + $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); + $param .= '&search_account_category='.urlencode($search_account_category); + } if (!empty($search_accountancy_code)) { $filter['t.numero_compte'] = $search_accountancy_code; $param .= '&search_accountancy_code='.urlencode($search_accountancy_code); @@ -642,6 +659,9 @@ $sql .= " t.tms as date_modification,"; $sql .= " t.date_export,"; $sql .= " t.date_validated as date_validation,"; $sql .= " t.import_key"; + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; // Manage filter $sqlwhere = array(); @@ -672,7 +692,13 @@ if (count($filter) > 0) { } elseif ($key == 't.reconciled_option') { $sqlwhere[] = 't.lettering_code IS NULL'; } elseif ($key == 't.code_journal' && !empty($value)) { - $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + if (is_array($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + } else { + $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); + } + } elseif ($key == 't.search_accounting_code_in' && !empty($value)) { + $sqlwhere[] = 't.numero_compte IN ('.$value.')'; } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } @@ -685,9 +711,6 @@ if (empty($conf->global->ACCOUNTING_REEXPORT)) { if (count($sqlwhere) > 0) { $sql .= ' AND '.implode(' AND ', $sqlwhere); } -if (!empty($sortfield)) { - $sql .= $db->order($sortfield, $sortorder); -} //print $sql; @@ -783,28 +806,38 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals"); // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { - $num = $nbtotalofrecords; -} else { + +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { $sql .= $db->plimit($limit + 1, $offset); - - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + $arrayofselected = is_array($toselect) ? $toselect : array(); // Output page @@ -997,6 +1030,12 @@ if ($massactionbutton && $contextpage != 'poslist') { } $moreforfilter = ''; +$moreforfilter .= '
'; +$moreforfilter .= $langs->trans('AccountingCategory').': '; +$moreforfilter .= '
'; +$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0); +$moreforfilter .= '
'; +$moreforfilter .= '
'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1006,6 +1045,10 @@ if (empty($reshook)) { $moreforfilter = $hookmanager->resPrint; } +print '
'; +print $moreforfilter; +print '
'; + print '
'; print '
'.$langs->trans("AccountingCategory").''; -$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); +print $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); print ''; print '
'; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 4a6e37ceb29..c24e509ff60 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -79,7 +79,8 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_import_key = GETPOST("search_import_key", 'alpha'); -$search_accountancy_code = GETPOST("search_accountancy_code"); +$search_account_category = GETPOST('search_account_category', 'int'); + $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); if ($search_accountancy_code_start == - 1) { $search_accountancy_code_start = ''; @@ -198,6 +199,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } +$error = 0; + /* * Action @@ -224,7 +227,7 @@ if (empty($reshook)) { 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 $search_doc_date = ''; - $search_accountancy_code = ''; + $search_account_category = ''; $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; $search_label_account = ''; @@ -280,6 +283,20 @@ if (empty($reshook)) { $filter['t.doc_date'] = $search_doc_date; $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int'); } + if ($search_account_category != '-1' && !empty($search_account_category)) { + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; + $accountingcategory = new AccountancyCategory($db); + + $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category)); + $listofaccountsforgroup2 = array(); + if (is_array($listofaccountsforgroup)) { + foreach ($listofaccountsforgroup as $tmpval) { + $listofaccountsforgroup2[] = $tmpval['id']; + } + } + $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); + $param .= '&search_account_category='.urlencode($search_account_category); + } if (!empty($search_accountancy_code_start)) { if ($type == 'sub') { $filter['t.subledger_account>='] = $search_accountancy_code_start; @@ -358,7 +375,6 @@ if (empty($reshook)) { $filter['t.import_key'] = $search_import_key; $param .= '&search_import_key='.urlencode($search_import_key); } - // param with type of list $url_param = substr($param, 1); // remove first "&" if (!empty($type)) { @@ -544,25 +560,29 @@ llxHeader('', $title_page); // List $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + // TODO Perf Replace this by a count if ($type == 'sub') { - $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1); + $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1); } else { - $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); + $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1); } if ($nbtotalofrecords < 0) { setEventMessages($object->error, $object->errors, 'errors'); + $error++; } } -if ($type == 'sub') { - $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1); -} else { - $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter); -} +if (!$error) { + if ($type == 'sub') { + $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1); + } else { + $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0); + } -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } $arrayofselected = is_array($toselect) ? $toselect : array(); @@ -711,7 +731,7 @@ if ($type == 'sub') { $moreforfilter = ''; -// Accountancy account +// Search on accountancy custom groups or account $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= '
'; @@ -729,6 +749,13 @@ if ($type == 'sub') { $moreforfilter .= '
'; $moreforfilter .= '
'; +$moreforfilter .= '
'; +$moreforfilter .= $langs->trans('AccountingCategory').': '; +$moreforfilter .= '
'; +$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0); +$moreforfilter .= '
'; +$moreforfilter .= '
'; + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) { diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 2f6c71dde7f..74626aa61e0 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -605,60 +605,6 @@ class AccountancyCategory // extends CommonObject } } - /** - * Function to know all custom groupd from an accounting account - * - * @return array|integer Result in table (array), -1 if KO - */ - public function getCatsCpts() - { - global $mysoc, $conf; - - if (empty($mysoc->country_id)) { - dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); - exit(); - } - - $sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens "; - $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat"; - $sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; - $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql .= " WHERE c.active = 1"; - $sql .= " AND c.entity = ".$conf->entity; - $sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)"; - $sql .= " AND cat.rowid = t.fk_accounting_category"; - $sql .= " AND t.entity = ".$conf->entity; - $sql .= " ORDER BY cat.position ASC"; - - $resql = $this->db->query($sql); - if ($resql) { - $i = 0; - $obj = ''; - $num = $this->db->num_rows($resql); - $data = array(); - if ($num) { - while ($obj = $this->db->fetch_object($resql)) { - $name_cat = $obj->name_cat; - $data[$name_cat][$i] = array( - 'id' => $obj->rowid, - 'code' => $obj->code, - 'position' => $obj->position, - 'account_number' => $obj->account_number, - 'account_label' => $obj->account_label, - 'sens' => $obj->sens - ); - $i++; - } - } - return $data; - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(__METHOD__." ".$this->error, LOG_ERR); - - return -1; - } - } - /** * Function to show result of an accounting account from the ledger with a direction and a period * @@ -734,12 +680,75 @@ class AccountancyCategory // extends CommonObject } } + /** + * Function to get an array of all active custom groups (llx_c_accunting_categories) with their accounts from the chart of account (ll_accounting_acount) + * + * @param int $catid Custom group ID + * @return array|integer Result in table (array), -1 if KO + * @see getCats(), getCptsCat() + */ + public function getCatsCpts($catid = 0) + { + global $mysoc, $conf; + + if (empty($mysoc->country_id)) { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(__METHOD__." ".$this->error, LOG_ERR); + return -1; + } + + $sql = "SELECT t.rowid, t.account_number, t.label as account_label,"; + $sql .= " cat.code, cat.position, cat.label as name_cat, cat.sens, cat.category_type, cat.formula"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat"; + $sql .= " WHERE t.fk_accounting_category IN (SELECT c.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; + $sql .= " WHERE c.active = 1"; + $sql .= " AND c.entity = ".$conf->entity; + $sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)"; + $sql .= " AND cat.rowid = t.fk_accounting_category"; + $sql .= " AND t.entity = ".$conf->entity; + if ($catid > 0) { + $sql .= " AND cat.rowid = ".((int) $catid); + } + $sql .= " ORDER BY cat.position ASC"; + + $resql = $this->db->query($sql); + if ($resql) { + $obj = ''; + $num = $this->db->num_rows($resql); + $data = array(); + if ($num) { + while ($obj = $this->db->fetch_object($resql)) { + $name_cat = $obj->name_cat; + $data[$name_cat][$obj->rowid] = array( + 'id' => $obj->rowid, + 'code' => $obj->code, + 'label' => $obj->label, + 'position' => $obj->position, + 'category_type' => $obj->category_type, + 'formula' => $obj->formula, + 'sens' => $obj->sens, + 'account_number' => $obj->account_number, + 'account_label' => $obj->account_label + ); + } + } + return $data; + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(__METHOD__." ".$this->error, LOG_ERR); + return -1; + } + } + /** * Return list of custom groups. + * For list + detail of accounting account, see getCatsCpt() * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $active 1= active, 0=not active * @return array|int Array of groups or -1 if error + * @see getCatsCpts(), getCptsCat() */ public function getCats($categorytype = -1, $active = 1) { @@ -774,9 +783,10 @@ class AccountancyCategory // extends CommonObject 'rowid' => $obj->rowid, 'code' => $obj->code, 'label' => $obj->label, - 'formula' => $obj->formula, 'position' => $obj->position, 'category_type' => $obj->category_type, + 'formula' => $obj->formula, + 'sens' => $obj->sens, 'bc' => $obj->sens ); $i++; @@ -794,12 +804,15 @@ class AccountancyCategory // extends CommonObject /** - * Get all accounting account of a custom group (or a list of custom groups). + * Get all accounting account of a given custom group (or a list of custom groups). * You must choose between first parameter (personalized group) or the second (free criteria filter) * * @param int $cat_id Id if personalized accounting group/category - * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must not come from an input of a user. + * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must be sanitized and not come from an input of a user. + * Example: "pcg_type = 'EXPENSE' AND fk_pcg_version = 'xx'" + * Example: "fk_accounting_category = 99" * @return array|int Array of accounting accounts or -1 if error + * @see getCats(), getCatsCpts() */ public function getCptsCat($cat_id, $predefinedgroupwhere = '') { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 95ba38d20bb..0458250489f 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -817,56 +817,61 @@ class BookKeeping extends CommonObject /** - * Load object in memory from the database + * Load object in memory from the database in ->lines. Or just make a simple count if $countonly=1. * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit offset limit - * @param int $offset offset limit - * @param array $filter filter array - * @param string $filtermode filter mode (AND or OR) - * @param int $option option (0: general account or 1: subaccount) - * - * @return int <0 if KO, >=0 if OK + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) + * @param int $option option (0: general account or 1: subaccount) + * @param int $countonly Do not fill the $object->lines, return only the count. + * @return int <0 if KO, Number of lines if OK */ - public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0) + public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0, $countonly = 0) { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); $this->lines = array(); + $num = 0; $sql = 'SELECT'; - $sql .= ' t.rowid,'; - $sql .= " t.doc_date,"; - $sql .= " t.doc_type,"; - $sql .= " t.doc_ref,"; - $sql .= " t.fk_doc,"; - $sql .= " t.fk_docdet,"; - $sql .= " t.thirdparty_code,"; - $sql .= " t.subledger_account,"; - $sql .= " t.subledger_label,"; - $sql .= " t.numero_compte,"; - $sql .= " t.label_compte,"; - $sql .= " t.label_operation,"; - $sql .= " t.debit,"; - $sql .= " t.credit,"; - $sql .= " t.montant as amount,"; - $sql .= " t.sens,"; - $sql .= " t.multicurrency_amount,"; - $sql .= " t.multicurrency_code,"; - $sql .= " t.lettering_code,"; - $sql .= " t.date_lettering,"; - $sql .= " t.fk_user_author,"; - $sql .= " t.import_key,"; - $sql .= " t.code_journal,"; - $sql .= " t.journal_label,"; - $sql .= " t.piece_num,"; - $sql .= " t.date_creation,"; - $sql .= " t.date_export,"; - $sql .= " t.date_validated as date_validation,"; - $sql .= " t.import_key"; + if ($countonly) { + $sql .= ' COUNT(t.rowid) as nb'; + } else { + $sql .= ' t.rowid,'; + $sql .= " t.doc_date,"; + $sql .= " t.doc_type,"; + $sql .= " t.doc_ref,"; + $sql .= " t.fk_doc,"; + $sql .= " t.fk_docdet,"; + $sql .= " t.thirdparty_code,"; + $sql .= " t.subledger_account,"; + $sql .= " t.subledger_label,"; + $sql .= " t.numero_compte,"; + $sql .= " t.label_compte,"; + $sql .= " t.label_operation,"; + $sql .= " t.debit,"; + $sql .= " t.credit,"; + $sql .= " t.montant as amount,"; + $sql .= " t.sens,"; + $sql .= " t.multicurrency_amount,"; + $sql .= " t.multicurrency_code,"; + $sql .= " t.lettering_code,"; + $sql .= " t.date_lettering,"; + $sql .= " t.fk_user_author,"; + $sql .= " t.import_key,"; + $sql .= " t.code_journal,"; + $sql .= " t.journal_label,"; + $sql .= " t.piece_num,"; + $sql .= " t.date_creation,"; + $sql .= " t.date_export,"; + $sql .= " t.date_validated as date_validation,"; + $sql .= " t.import_key"; + } // Manage filter $sqlwhere = array(); if (count($filter) > 0) { @@ -880,7 +885,7 @@ class BookKeeping extends CommonObject } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { $sqlwhere[] = $key.'='.$value; } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { - $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; + $sqlwhere[] = $key.' LIKE \''.$this->db->escapeforlike($this->db->escape($value)).'%\''; } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') { @@ -897,18 +902,19 @@ class BookKeeping extends CommonObject } else { $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); } + } elseif ($key == 't.search_accounting_code_in' && !empty($value)) { + $sqlwhere[] = 't.numero_compte IN ('.$value.')'; } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } } } $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features + $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); } - // Affichage par compte comptable + // Filter by ledger account or subledger account if (!empty($option)) { $sql .= " AND t.subledger_account IS NOT NULL"; $sql .= " AND t.subledger_account <> ''"; @@ -919,54 +925,63 @@ class BookKeeping extends CommonObject $sortorder = 'ASC'.($sortorder ? ','.$sortorder : ''); } - $sql .= $this->db->order($sortfield, $sortorder); - if (!empty($limit)) { - $sql .= $this->db->plimit($limit + 1, $offset); + if (!$countonly) { + $sql .= $this->db->order($sortfield, $sortorder); + if (!empty($limit)) { + $sql .= $this->db->plimit($limit + 1, $offset); + } } $resql = $this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); + if ($countonly) { + $obj = $this->db->fetch_object($resql); + if ($obj) { + $num = $obj->nb; + } + } else { + $num = $this->db->num_rows($resql); - $i = 0; - while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) { - $line = new BookKeepingLine(); + $i = 0; + while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) { + $line = new BookKeepingLine(); - $line->id = $obj->rowid; + $line->id = $obj->rowid; - $line->doc_date = $this->db->jdate($obj->doc_date); - $line->doc_type = $obj->doc_type; - $line->doc_ref = $obj->doc_ref; - $line->fk_doc = $obj->fk_doc; - $line->fk_docdet = $obj->fk_docdet; - $line->thirdparty_code = $obj->thirdparty_code; - $line->subledger_account = $obj->subledger_account; - $line->subledger_label = $obj->subledger_label; - $line->numero_compte = $obj->numero_compte; - $line->label_compte = $obj->label_compte; - $line->label_operation = $obj->label_operation; - $line->debit = $obj->debit; - $line->credit = $obj->credit; - $line->montant = $obj->amount; // deprecated - $line->amount = $obj->amount; - $line->sens = $obj->sens; - $line->multicurrency_amount = $obj->multicurrency_amount; - $line->multicurrency_code = $obj->multicurrency_code; - $line->lettering_code = $obj->lettering_code; - $line->date_lettering = $obj->date_lettering; - $line->fk_user_author = $obj->fk_user_author; - $line->import_key = $obj->import_key; - $line->code_journal = $obj->code_journal; - $line->journal_label = $obj->journal_label; - $line->piece_num = $obj->piece_num; - $line->date_creation = $this->db->jdate($obj->date_creation); - $line->date_export = $this->db->jdate($obj->date_export); - $line->date_validation = $this->db->jdate($obj->date_validation); - $line->import_key = $obj->import_key; + $line->doc_date = $this->db->jdate($obj->doc_date); + $line->doc_type = $obj->doc_type; + $line->doc_ref = $obj->doc_ref; + $line->fk_doc = $obj->fk_doc; + $line->fk_docdet = $obj->fk_docdet; + $line->thirdparty_code = $obj->thirdparty_code; + $line->subledger_account = $obj->subledger_account; + $line->subledger_label = $obj->subledger_label; + $line->numero_compte = $obj->numero_compte; + $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; + $line->debit = $obj->debit; + $line->credit = $obj->credit; + $line->montant = $obj->amount; // deprecated + $line->amount = $obj->amount; + $line->sens = $obj->sens; + $line->multicurrency_amount = $obj->multicurrency_amount; + $line->multicurrency_code = $obj->multicurrency_code; + $line->lettering_code = $obj->lettering_code; + $line->date_lettering = $obj->date_lettering; + $line->fk_user_author = $obj->fk_user_author; + $line->import_key = $obj->import_key; + $line->code_journal = $obj->code_journal; + $line->journal_label = $obj->journal_label; + $line->piece_num = $obj->piece_num; + $line->date_creation = $this->db->jdate($obj->date_creation); + $line->date_export = $this->db->jdate($obj->date_export); + $line->date_validation = $this->db->jdate($obj->date_validation); + $line->import_key = $obj->import_key; - $this->lines[] = $line; + $this->lines[] = $line; - $i++; + $i++; + } } $this->db->free($resql); diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 8ebac3611cb..545d0da67a1 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -224,7 +224,7 @@ class FormAccounting extends Form * @param int $maxlen Max length of text in combo box * @param int $help Add or not the admin help picto * @param int $allcountries All countries - * @return void + * @return string HTML component with the select */ public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0) { @@ -295,7 +295,7 @@ class FormAccounting extends Form $out .= ajax_combobox($htmlname, array()); - print $out; + return $out; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b6bf1b90aef..03af44134e2 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -217,7 +217,7 @@ Codejournal=Journal JournalLabel=Journal label NumPiece=Piece number TransactionNumShort=Num. transaction -AccountingCategory=Custom group +AccountingCategory=Custom group of accounts GroupByAccountAccounting=Group by general ledger account GroupBySubAccountAccounting=Group by subledger account AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports. From 474dd5197ff24dd61d60539bfa48cb0c998717d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 17:06:39 +0100 Subject: [PATCH 081/370] Fix tooltip in report --- htdocs/compta/resultat/result.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 3f3e14e2d61..cb2158bb48b 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -320,9 +320,9 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; // Year NP - print ''; @@ -399,8 +399,7 @@ if ($modecompta == 'CREANCES-DETTES') { print "\n"; //var_dump($sommes); - } else // normal category - { + } else { // normal category $code = $cat['code']; // Category code we process $totCat = array(); @@ -478,37 +477,38 @@ if ($modecompta == 'CREANCES-DETTES') { // Now output columns for row $code ('VTE', 'MAR', ...) - print ""; + print ''; // Column group - print ''; // Label of group - print ''; print ''; From 13a19037dd8f3df460bfe735a4b533df2b275c9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 17:23:56 +0100 Subject: [PATCH 082/370] NEW sort of column of custom group of account --- htdocs/accountancy/admin/categories.php | 41 +++++++++++++++++-------- htdocs/compta/resultat/result.php | 6 ++-- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 3414c36cd52..2a15921243f 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -45,6 +45,26 @@ if ($cat_id == 0) { $cat_id = null; } +// Load variable for pagination +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters + $page = 0; +} +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + +if (empty($sortfield)) { + $sortfield = 'account_number'; +} +if (empty($sortorder)) { + $sortorder = 'ASC'; +} + // Security check if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); @@ -137,14 +157,6 @@ if (!empty($cat_id)) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"'); print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories")); - //print '
'; - /*print '
'; - print ajax_combobox('cpt_bk'); - */ print ' '; } } @@ -152,13 +164,16 @@ if (!empty($cat_id)) { print ''; -if ($action == 'display' || $action == 'delete') { +if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > 0) { + $param = 'account_category='.((int) $cat_id); + print '
'; print '
'; + print ''; print dol_escape_htmltag($cat['code']); - print ''; + print ''; print dol_escape_htmltag($cat['label']); print '
'; + print ''; print dol_escape_htmltag($cat['code']); print ''; - print dol_escape_htmltag($cat['label']); + $labeltoshow = dol_escape_htmltag($cat['label']); if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts $i = 0; foreach ($cpts as $cpt) { if ($i > 5) { - print '...)'; + $labeltoshow .= '...)'; break; } if ($i > 0) { - print ', '; + $labeltoshow .= ', '; } else { - print ' ('; + $labeltoshow .= ' ('; } - print dol_escape_htmltag($cpt['account_number']); + $labeltoshow .= dol_escape_htmltag($cpt['account_number']); $i++; } if ($i <= 5) { - print ')'; + $labeltoshow .= ')'; } } else { - print ' - '.$langs->trans("GroupIsEmptyCheckSetup").''; + $labeltoshow .= ' - '.$langs->trans("GroupIsEmptyCheckSetup").''; } + print ''; + print $labeltoshow; print ''.price($totCat['NP']).'
'."\n"; print ''; - print '"; - print '"; - print "\n"; + print getTitleFieldOfList('AccountAccounting', 0, $_SERVER['PHP_SELF'], 'account_number', '', $param, '', $sortfield, $sortorder, '')."\n"; + print getTitleFieldOfList('Label', 0, $_SERVER['PHP_SELF'], 'label', '', $param, '', $sortfield, $sortorder, '')."\n"; + print getTitleFieldOfList('', 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n"; + print ''."\n"; if (!empty($cat_id)) { $return = $accountingcategory->display($cat_id); // This load ->lines_display @@ -167,6 +182,8 @@ if ($action == 'display' || $action == 'delete') { } if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) { + $accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, 1, 0, 1); + foreach ($accountingcategory->lines_display as $cpt) { print ''; print ''; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index cb2158bb48b..4bbb20b18a1 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -322,7 +322,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Year NP print ''; @@ -507,7 +507,7 @@ if ($modecompta == 'CREANCES-DETTES') { } else { $labeltoshow .= ' - '.$langs->trans("GroupIsEmptyCheckSetup").''; } - print ''; @@ -537,7 +537,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($showaccountdetail == 'all' || $resultN != 0) { print ''; print ''; - print ''; - print '
'; - print '
'.$langs->trans("AccountAccounting")."'.$langs->trans("Label")."
'.length_accountg($cpt->account_number).''; print dol_escape_htmltag($cat['code']); - print ''; + print ''; print dol_escape_htmltag($cat['label']); print ''; + print ''; print $labeltoshow; print '
'; + print ''; print '     '.length_accountg($cpt['account_number']); print ' - '; print $cpt['account_label']; From 429b38a2e64ef4cf753580ece0c63c9847df4518 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 17:45:40 +0100 Subject: [PATCH 083/370] Fix sort --- htdocs/accountancy/admin/categories_list.php | 38 ++++++++++++-------- htdocs/compta/resultat/result.php | 2 +- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 0e7bd908c9a..755a5a88aed 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -444,15 +444,37 @@ if ($search_country_id > 0) { if ($sortfield == 'country') { $sortfield = 'country_code'; } +if (empty($sortfield)) { + $sortfield = 'position'; +} + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($listlimit + 1, $offset); //print $sql; $fieldlist = explode(',', $tabfield[$id]); +$param = '&id='.$id; +if ($search_country_id > 0) { + $param .= '&search_country_id='.urlencode($search_country_id); +} +$paramwithsearch = $param; +if ($sortorder) { + $paramwithsearch .= '&sortorder='.urlencode($sortorder); +} +if ($sortfield) { + $paramwithsearch .= '&sortfield='.urlencode($sortfield); +} +if (GETPOST('from', 'alpha')) { + $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); +} + print '
'; print ''; print ''; +print ''; +print ''; + print '
'; print ''; @@ -571,20 +593,6 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $param = '&id='.$id; - if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); - } - $paramwithsearch = $param; - if ($sortorder) { - $paramwithsearch .= '&sortorder='.$sortorder; - } - if ($sortfield) { - $paramwithsearch .= '&sortfield='.$sortfield; - } - if (GETPOST('from', 'alpha')) { - $paramwithsearch .= '&from='.GETPOST('from', 'alpha'); - } // There is several pages if ($num > $listlimit) { print ''; + print ''; // Column group print ''; - - // Year N - $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) - $sommes[$code]['NP'] += $r; - - // Current fiscal year (N) - if (is_array($sommes) && !empty($sommes)) { - foreach ($sommes as $code => $det) { - $vars[$code] = $det['N']; - } - } - - $result = strtr($formula, $vars); - - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, 1); - - print ''; - $sommes[$code]['N'] += $r; - - // Detail by month - foreach ($months as $k => $v) { - if (($k + 1) >= $date_startmonth) { - foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; + if (preg_match('/[a-z]/i', $result)) { + $r = 'Error bad formula: '.$result; + $rshort = 'Err'; + print ''; + print ''; + // Detail by month + foreach ($months as $k => $v) { + if (($k + 1) >= $date_startmonth) { + print ''; } - $result = strtr($formula, $vars); - - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, 1); - - print ''; - $sommes[$code]['M'][$k] += $r; } - } - foreach ($months as $k => $v) { - if (($k + 1) < $date_startmonth) { - foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; + foreach ($months as $k => $v) { + if (($k + 1) < $date_startmonth) { + print ''; } - $result = strtr($formula, $vars); + } + } else { + //var_dump($result); + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); + //var_dump($r); - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, 1); + print ''; - print ''; - $sommes[$code]['M'][$k] += $r; + // Year N + $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) + $sommes[$code]['NP'] += $r; + + // Current fiscal year (N) + if (is_array($sommes) && !empty($sommes)) { + foreach ($sommes as $code => $det) { + $vars[$code] = $det['N']; + } + } + + $result = strtr($formula, $vars); + + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, 1); + + print ''; + $sommes[$code]['N'] += $r; + + // Detail by month + foreach ($months as $k => $v) { + if (($k + 1) >= $date_startmonth) { + foreach ($sommes as $code => $det) { + $vars[$code] = $det['M'][$k]; + } + $result = strtr($formula, $vars); + + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, 1); + + print ''; + $sommes[$code]['M'][$k] += $r; + } + } + + + foreach ($months as $k => $v) { + if (($k + 1) < $date_startmonth) { + foreach ($sommes as $code => $det) { + $vars[$code] = $det['M'][$k]; + } + $result = strtr($formula, $vars); + + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, 1); + + print ''; + $sommes[$code]['M'][$k] += $r; + } } } From bcd5c207cf7e57917116cac98091bc848891652d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 20:25:53 +0100 Subject: [PATCH 086/370] Debug v17 - Fix the report on custom groups, column previous period --- .../class/accountancycategory.class.php | 47 ++++-- htdocs/compta/resultat/result.php | 147 ++++++++---------- 2 files changed, 100 insertions(+), 94 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 68662ccb610..300ccff9c09 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -678,6 +678,22 @@ class AccountancyCategory // extends CommonObject $this->sdc = 0; $this->sdcpermonth = array(); + if (is_array($cpt)) { + $listofaccount = ''; + foreach ($cpt as $cptcursor) { + if (! is_null($cptcursor)) { + if ($listofaccount) { + $listofaccount .= ","; + } + $listofaccount .= "'".$cptcursor."'"; + } + } + if (empty($listofaccount)) { + // List of account is empty, so we do no try sql request, we can say result is empty. + return 0; + } + } + $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; if (is_array($cpt)) { $sql .= ", t.numero_compte as accountancy_account"; @@ -686,13 +702,6 @@ class AccountancyCategory // extends CommonObject //if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date'; $sql .= " WHERE t.entity = ".$conf->entity; if (is_array($cpt)) { - $listofaccount = ''; - foreach ($cpt as $cptcursor) { - if ($listofaccount) { - $listofaccount .= ","; - } - $listofaccount .= "'".$cptcursor."'"; - } $sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")"; } else { $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'"; @@ -709,22 +718,28 @@ class AccountancyCategory // extends CommonObject if (is_array($cpt)) { $sql .= " GROUP BY t.numero_compte"; } - //print $sql; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); if ($num) { - $obj = $this->db->fetch_object($resql); - if ($sens == 1) { - $this->sdc = $obj->debit - $obj->credit; - } else { - $this->sdc = $obj->credit - $obj->debit; - } - if (is_array($cpt)) { - $this->sdcperaccount[$obj->accountancy_account] = $this->sdc; + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + if ($obj) { + if ($sens == 1) { + $this->sdc = $obj->debit - $obj->credit; + } else { + $this->sdc = $obj->credit - $obj->debit; + } + if (is_array($cpt)) { + $this->sdcperaccount[$obj->accountancy_account] = $this->sdc; + } + } + $i++; } } + return $num; } else { $this->error = "Error ".$this->db->lasterror(); diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 856eb8a5fe8..8615e595200 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -184,8 +184,8 @@ llxheader('', $langs->trans('ReportInOut')); $formaccounting = new FormAccounting($db); $form = new Form($db); -$textprevyear = ''.img_previous().''; -$textnextyear = ' '.img_next().''; +$textprevyear = ''.img_previous().''; +$textnextyear = '   '.img_next().''; @@ -309,8 +309,8 @@ if ($modecompta == 'CREANCES-DETTES') { if (!is_array($cats) && $cats < 0) { setEventMessages(null, $AccCat->errors, 'errors'); } elseif (is_array($cats) && count($cats) > 0) { + // Loop on each custom group of accounts foreach ($cats as $cat) { - // Loop on each group if (!empty($cat['category_type'])) { // category calculed // When we enter here, $sommes was filled by group of accounts @@ -319,10 +319,10 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; - // Year NP - print ''; @@ -345,83 +345,71 @@ if ($modecompta == 'CREANCES-DETTES') { $r = 'Error bad formula: '.$result; $rshort = 'Err'; print ''; - print ''; - // Detail by month - foreach ($months as $k => $v) { - if (($k + 1) >= $date_startmonth) { - print ''; - } - } - foreach ($months as $k => $v) { - if (($k + 1) < $date_startmonth) { - print ''; - } - } } else { //var_dump($result); //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, '1'); - //var_dump($r); print ''; + } - // Year N - $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) - $sommes[$code]['NP'] += $r; + // Year N + $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) + $sommes[$code]['NP'] += $r; - // Current fiscal year (N) - if (is_array($sommes) && !empty($sommes)) { + // Current fiscal year (N) + if (is_array($sommes) && !empty($sommes)) { + foreach ($sommes as $code => $det) { + $vars[$code] = $det['N']; + } + } + + $result = strtr($formula, $vars); + $result = str_replace('--', '+', $result); + + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); + + print ''; + $sommes[$code]['N'] += $r; + + // Detail by month + foreach ($months as $k => $v) { + if (($k + 1) >= $date_startmonth) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['N']; + $vars[$code] = $det['M'][$k]; } + $result = strtr($formula, $vars); + $result = str_replace('--', '+', $result); + + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); + + print ''; + $sommes[$code]['M'][$k] += $r; } + } - $result = strtr($formula, $vars); - - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, 1); - - print ''; - $sommes[$code]['N'] += $r; - - // Detail by month - foreach ($months as $k => $v) { - if (($k + 1) >= $date_startmonth) { - foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; - } - $result = strtr($formula, $vars); - - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, 1); - - print ''; - $sommes[$code]['M'][$k] += $r; + foreach ($months as $k => $v) { + if (($k + 1) < $date_startmonth) { + foreach ($sommes as $code => $det) { + $vars[$code] = $det['M'][$k]; } - } + $result = strtr($formula, $vars); + $result = str_replace('--', '+', $result); + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); - foreach ($months as $k => $v) { - if (($k + 1) < $date_startmonth) { - foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; - } - $result = strtr($formula, $vars); - - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, 1); - - print ''; - $sommes[$code]['M'][$k] += $r; - } + print ''; + $sommes[$code]['M'][$k] += $r; } } print "\n"; //var_dump($sommes); - } else // normal category - { + } else { // normal category $code = $cat['code']; // Category code we process $totCat = array(); @@ -435,23 +423,25 @@ if ($modecompta == 'CREANCES-DETTES') { // Set $cpts with array of accounts in the category/group $cpts = $AccCat->getCptsCat($cat['rowid']); // We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number. - if (empty($cpts)) $cpts[] = array(); - + if (empty($cpts)) { + $cpts[] = array(); + } $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) { // Loop on each account. - $arrayofaccountforfilter[] = $cpt['account_number']; + if (!is_null($cpt['account_number'])) { + $arrayofaccountforfilter[] = $cpt['account_number']; + } } // N-1 if (!empty($arrayofaccountforfilter)) { $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc'] ? $cat['dc'] : 0); - if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultNP = 0; } else { - foreach ($cpts as $i => $cpt) { // Loop on each account. + foreach ($cpts as $i => $cpt) { // Loop on each account found $resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']]) ? 0 : $AccCat->sdcperaccount[$cpt['account_number']]; $totCat['NP'] += $resultNP; @@ -499,37 +489,38 @@ if ($modecompta == 'CREANCES-DETTES') { // Now output columns for row $code ('VTE', 'MAR', ...) - print ""; + print ''; // Column group - print ''; // Label of group - print ''; print ''; @@ -558,7 +549,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($showaccountdetail == 'all' || $resultN != 0) { print ''; print ''; - print ''; @@ -370,7 +370,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, '1'); - print ''; + print ''; $sommes[$code]['N'] += $r; // Detail by month @@ -519,12 +519,12 @@ if ($modecompta == 'CREANCES-DETTES') { } else { $labeltoshow .= ' - '.$langs->trans("GroupIsEmptyCheckSetup").''; } - print ''; print ''; - print ''; + print ''; // Each month foreach ($totCat['M'] as $k => $v) { @@ -549,13 +549,13 @@ if ($modecompta == 'CREANCES-DETTES') { if ($showaccountdetail == 'all' || $resultN != 0) { print ''; print ''; - print ''; print ''; - print ''; + print ''; // Make one call for each month foreach ($months as $k => $v) { From 9d777497db1f0cc7729303dd8d6e059d89d4ed1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 22:07:26 +0100 Subject: [PATCH 088/370] NEW dol_sort_array can sort on alphabetical order even if val is num --- htdocs/accountancy/admin/categories.php | 2 +- htdocs/core/lib/functions.lib.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 2a15921243f..7b660419daf 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -182,7 +182,7 @@ if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > } if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) { - $accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, 1, 0, 1); + $accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, -1, 0, 1); foreach ($accountingcategory->lines_display as $cpt) { print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cc32224ff2b..85cb8a9cdfe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8671,7 +8671,8 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe * @param array $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects) * @param string $index Key in array to use for sorting criteria * @param int $order Sort order ('asc' or 'desc') - * @param int $natsort 1=use "natural" sort (natsort) for a search criteria thats is strings or unknown, 0=use "standard" sort (asort) for numbers + * @param int $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort) + * If values are numeric (I said value not type): 0=Use numeric order (even if type is string) so use a "natural" sort, 1=use "natural" sort too (same than 0), -1=Force alphabetical order * @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive * @param int $keepindex If 0 and index key of array to sort is a numeric, than index will be rewrote. If 1 or index key is not numeric, key for index is kept after sorting. * @return array Sorted array @@ -8691,9 +8692,12 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen } else { $temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index]; } + if ($natsort == -1) { + $temp[$key] = '___'.$temp[$key]; // We add a string at begin of value to force an alpha order when using asort. + } } - if (!$natsort) { + if (empty($natsort) || $natsort == -1) { if ($order == 'asc') { asort($temp); } else { From 400a1686873fbc06ea924e8c321f522f5c7e8c73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 23:20:46 +0100 Subject: [PATCH 089/370] NEW Can modify the date of payment of a salary (if not reconciled) --- htdocs/compta/paiement/card.php | 11 +-- htdocs/compta/payment_sc/card.php | 12 +++- htdocs/salaries/class/paymentsalary.class.php | 68 +++++++++++++++++-- htdocs/salaries/paiement_salary.php | 2 +- htdocs/salaries/payment_salary/card.php | 37 +++++++--- 5 files changed, 105 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index cc39a790527..073365fa876 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -84,7 +84,7 @@ if ($action == 'setnote' && $user->hasRight('facture', 'paiement')) { } } -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->paiement) { +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('facture', 'paiement')) { $db->begin(); $result = $object->delete(); @@ -105,7 +105,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> } } -if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture->paiement) { +if ($action == 'confirm_validate' && $confirm == 'yes' && $user->hasRight('facture', 'paiement')) { $db->begin(); if ($object->validate($user) > 0) { @@ -175,7 +175,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture } } -if ($action == 'setnum_paiement' && GETPOST('num_paiement')) { +if ($action == 'setnum_paiement' && GETPOST('num_paiement') && $user->hasRight('facture', 'paiement')) { $res = $object->update_num(GETPOST('num_paiement')); if ($res === 0) { setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); @@ -184,7 +184,7 @@ if ($action == 'setnum_paiement' && GETPOST('num_paiement')) { } } -if ($action == 'setdatep' && GETPOST('datepday')) { +if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('facture', 'paiement')) { $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); $res = $object->update_date($datepaye); if ($res === 0) { @@ -193,7 +193,8 @@ if ($action == 'setdatep' && GETPOST('datepday')) { setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); } } -if ($action == 'createbankpayment' && !empty($user->rights->facture->paiement)) { + +if ($action == 'createbankpayment' && $user->hasRight('facture', 'paiement')) { $db->begin(); // Create the record into bank for the amount of payment $object diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 39bac75ba0c..7d7742c3f01 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -63,7 +63,7 @@ if ($id > 0) { */ // Delete payment -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer) { +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('tax', 'charges', 'supprimer')) { $db->begin(); $result = $object->delete($user); @@ -77,6 +77,16 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char } } +if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('tax', 'charges', 'creer')) { + $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); + $res = $object->update_date($datepaye); + if ($res === 0) { + setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); + } else { + setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); + } +} + /* * View diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 029e5732f9b..a2de50aeed4 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -602,12 +602,66 @@ class PaymentSalary extends CommonObject } } + /** + * Updates the payment date. + * Old name of function is update_date() + * + * @param int $date New date + * @return int <0 if KO, 0 if OK + */ + public function updatePaymentDate($date) + { + $error = 0; + + if (!empty($date)) { + $this->db->begin(); + + dol_syslog(get_class($this)."::updatePaymentDate with date = ".$date, LOG_DEBUG); + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET datep = '".$this->db->idate($date)."'"; + $sql .= " WHERE rowid = ".((int) $this->id); + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = 'Error -1 '.$this->db->error(); + } + + $type = $this->element; + + $sql = "UPDATE ".MAIN_DB_PREFIX.'bank'; + $sql .= " SET dateo = '".$this->db->idate($date)."', datev = '".$this->db->idate($date)."'"; + $sql .= " WHERE rowid IN (SELECT fk_bank FROM ".MAIN_DB_PREFIX."bank_url WHERE type = '".$this->db->escape($type)."' AND url_id = ".((int) $this->id).")"; + $sql .= " AND rappro = 0"; + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = 'Error -1 '.$this->db->error(); + } + + if (!$error) { + } + + if (!$error) { + $this->datep = $date; + + $this->db->commit(); + return 0; + } else { + $this->db->rollback(); + return -2; + } + } + return -1; //no date given or already validated + } /** - * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) + * Return the label of the status * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Libelle + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status */ public function getLibStatut($mode = 0) { @@ -616,11 +670,11 @@ class PaymentSalary extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoi le libelle d'un statut donne + * Return the status * - * @param int $status Statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Libelle du statut + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status */ public function LibStatut($status, $mode = 0) { diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 30279ee3538..9f90e4c9ac9 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -57,7 +57,7 @@ restrictedArea($user, 'salaries', $object->id, 'salary', ''); * Actions */ -if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes')) { +if (($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $user->hasRight('salaries', 'write')) { $error = 0; if ($cancel) { diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index c9f0a151901..c6d73c5ec7f 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -20,10 +20,10 @@ */ /** - * \file htdocs/compta/payment_sc/card.php - * \ingroup facture - * \brief Onglet payment of a salary - * \remarks Fichier presque identique a fournisseur/paiement/card.php + * \file htdocs/salaries/payment_salary/card.php + * \ingroup salary + * \brief Tab to pay a salary + * \remarks File very similar with fournisseur/paiement/card.php */ // Load Dolibarr environment @@ -56,7 +56,7 @@ restrictedArea($user, 'salaries', $object->fk_salary, 'salary', ''); // $object */ // Delete payment -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->salaries->delete) { +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('salaries', 'delete')) { $db->begin(); $result = $object->delete($user); @@ -70,6 +70,16 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->salaries- } } +if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('salaries', 'write')) { + $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'), 'tzuserrel'); + $res = $object->updatePaymentDate($datepaye); + if ($res === 0) { + setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); + } else { + setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); + } +} + /* * View @@ -127,7 +137,7 @@ dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', ''); print '
'; print '
'; -print '
'; @@ -822,7 +830,7 @@ if ($resql) { } // Link to setup the group - print ''; + print ''; if (empty($obj->formula)) { print ''; print $langs->trans("ListOfAccounts"); diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 4bbb20b18a1..07a82fc92ac 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -477,7 +477,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Now output columns for row $code ('VTE', 'MAR', ...) - print '
'; From 6db9425657e51e27c23a31066e71bc7bc7d058c0 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 29 Dec 2022 17:54:15 +0100 Subject: [PATCH 084/370] Fixed some grammar in the French error translation file --- htdocs/langs/fr_FR/errors.lang | 85 ++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index d407d7c91b8..0a2cde05bb8 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -14,6 +14,7 @@ ErrorLoginAlreadyExists=L'identifiant %s existe déjà. ErrorGroupAlreadyExists=Le groupe %s existe déjà. ErrorEmailAlreadyExists=L'e-mail %s existe déjà. ErrorRecordNotFound=Enregistrement non trouvé. +ErrorRecordNotFoundShort=Non trouvé ErrorFailToCopyFile=Echec de la copie du fichier '%s' en '%s'. ErrorFailToCopyDir=Echec de copie du répertoire '%s' vers '%s'. ErrorFailToRenameFile=Echec du renommage du fichier '%s' en '%s'. @@ -32,28 +33,28 @@ ForbiddenBySetupRules=Interdit par les règles de configuration ErrorProdIdIsMandatory=Le %s est obligatoire ErrorAccountancyCodeCustomerIsMandatory=Le code comptable du client %s est obligatoire ErrorBadCustomerCodeSyntax=La syntaxe du code client est incorrecte -ErrorBadBarCodeSyntax=Mauvaise syntaxe pour le code barre. Peut être que vous avez défini un mauvais type de code-barres ou que vous avez défini un masque de code à barres pour la numérotation qui ne correspond pas à la valeur scannée. +ErrorBadBarCodeSyntax=Mauvaise syntaxe pour le code-barres. Peut être que vous avez défini un mauvais type de code-barres ou que vous avez défini un masque de code à barres pour la numérotation qui ne correspond pas à la valeur scannée. ErrorCustomerCodeRequired=Code client obligatoire -ErrorBarCodeRequired=Code-barre requis +ErrorBarCodeRequired=Code-barres requis ErrorCustomerCodeAlreadyUsed=Code client déjà utilisé -ErrorBarCodeAlreadyUsed=Code-barre déjà utilisé -ErrorPrefixRequired=Préfix obligatoire +ErrorBarCodeAlreadyUsed=Code-barres déjà utilisé +ErrorPrefixRequired=Préfixe obligatoire ErrorBadSupplierCodeSyntax=Mauvaise syntaxe pour le code fournisseur ErrorSupplierCodeRequired=Code fournisseur obligatoire ErrorSupplierCodeAlreadyUsed=Code fournisseur déjà utilisé ErrorBadParameters=Paramètres incorrects ErrorWrongParameters=Paramètres incorrects ou manquants ErrorBadValueForParameter=Valeur '%s' incorrecte pour le paramètre '%s' -ErrorBadImageFormat=Cet image est dans un format non pris en charge (Votre PHP ne prend pas en charge les fonctions de conversion de ce format d'image). +ErrorBadImageFormat=Cette image est dans un format non pris en charge (Votre PHP ne prend pas en charge les fonctions de conversion de ce format d'image). ErrorBadDateFormat=La valeur '%s' a un format de date non reconnu -ErrorWrongDate=La date est incorrecte +ErrorWrongDate=La date est incorrecte ! ErrorFailedToWriteInDir=Impossible d'écrire dans le répertoire %s ErrorFailedToBuildArchive=Échec de la création du fichier d'archive %s ErrorFoundBadEmailInFile=Syntaxe d'email incorrecte trouvée pour %s lignes dans le fichier (exemple ligne %s avec email=%s) ErrorUserCannotBeDelete=L'utilisateur ne peut pas être supprimé. Peut-être est-il associé à des éléments de Dolibarr. ErrorFieldsRequired=Des champs obligatoire n'ont pas été remplis. ErrorSubjectIsRequired=L'objet de l'e-mail est obligatoire -ErrorFailedToCreateDir=Echec à la création d'un répertoire. Vérifiez que le user du serveur Web ait bien les droits d'écriture dans les répertoires documents de Dolibarr. Si le paramètre safe_mode a été activé sur ce PHP, vérifiez que les fichiers php dolibarr appartiennent à l'utilisateur du serveur Web. +ErrorFailedToCreateDir=Echec à la création d'un répertoire. Vérifiez que l'utilisateur du serveur Web ait bien les droits d'écriture dans les répertoires documents de Dolibarr. Si le paramètre safe_mode a été activé sur ce PHP, vérifiez que les fichiers php dolibarr appartiennent à l'utilisateur du serveur Web. ErrorNoMailDefinedForThisUser=Email non défini pour cet utilisateur ErrorSetupOfEmailsNotComplete=La configuration de l'envoi des e-mails n'est pas terminée ErrorFeatureNeedJavascript=Cette fonctionnalité a besoin de javascript activé pour fonctionner. Modifiez dans configuration - affichage. @@ -65,7 +66,7 @@ ErrorFunctionNotAvailableInPHP=La fonction %s est requise pour cette fonc ErrorDirAlreadyExists=Un répertoire portant ce nom existe déjà. ErrorFileAlreadyExists=Un fichier portant ce nom existe déjà. ErrorDestinationAlreadyExists=Un fichier portant le nom %s existe déjà. -ErrorPartialFile=Fichier non reçu intégralement par le serveur. +ErrorPartialFile=Fichier incomplet reçu par le serveur. ErrorNoTmpDir=Répertoire temporaire de réception %s inexistant. ErrorUploadBlockedByAddon=Upload bloqué par un plugin PHP/Apache. ErrorFileSizeTooLarge=La taille du fichier est trop grande ou le fichier n'est pas fourni. @@ -96,6 +97,7 @@ ErrorWrongValueForField=Champ %s: '%s' ne respecte pas la règle < ErrorHtmlInjectionForField=Champ %s : La valeur ' %s ' contient une donnée malveillante non autorisée ErrorFieldValueNotIn=Champ %s: '%s' n'est pas une valeur disponible dans le champ %s de la table %s ErrorFieldRefNotIn=Champ %s: '%s' n'est pas une référence existante comme %s +ErrorMultipleRecordFoundFromRef=Plusieurs enregistrements ont été trouvés en recherchant la référence %s. Il nous est impossible de déterminer quel ID utiliser. ErrorsOnXLines=Erreurs sur %s enregistrement(s) source ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est probablement infecté par un virus) ! ErrorNumRefModel=Une référence existe en base (%s) et est incompatible avec cette numérotation. Supprimez la ligne ou renommez la référence pour activer ce module. @@ -106,7 +108,7 @@ ErrorBadMask=Erreur sur le masque ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro ErrorMaxNumberReachForThisMask=Nombre maximum atteint pour ce masque -ErrorCounterMustHaveMoreThan3Digits=Le compteur doit avoir au moins 3 positions +ErrorCounterMustHaveMoreThan3Digits=Le compteur doit posséder au moins 3 chiffres ErrorSelectAtLeastOne=Erreur, sélectionnez au moins une entrée. ErrorDeleteNotPossibleLineIsConsolidated=Suppression impossible car l'enregistrement porte sur au moins une transaction bancaire rapprochée ErrorProdIdAlreadyExist=%s est attribué à un autre tiers @@ -130,9 +132,9 @@ ErrorLoginHasNoEmail=Cet utilisateur n'a pas d'email. Impossible de continuer. ErrorBadValueForCode=Mauvaise valeur saisie pour le code. Réessayez avec une nouvelle valeur... ErrorBothFieldCantBeNegative=Les champs %s et %s ne peuvent être tous deux négatifs ErrorFieldCantBeNegativeOnInvoice=Le champ %s ne peut pas être négatif sur ce type de facture. Si vous devez ajouter une ligne de remise, créez d'abord la remise (à partir du champ '%s' dans la fiche du tiers) et appliquez-la à la facture. -ErrorLinesCantBeNegativeForOneVATRate=Le total des lignes (HT) ne peut pas être négatif pour un taux de TVA non null donné (Un total négatif pour le taux de %s%% a été trouvé). +ErrorLinesCantBeNegativeForOneVATRate=Le total des lignes (HT) ne peut pas être négatif pour un taux de TVA non nul donné (Un total négatif pour le taux de %s%% a été trouvé). ErrorLinesCantBeNegativeOnDeposits=Les lignes ne peuvent pas être négatives dans un acompte. Si vous le faites, vous rencontrerez des problèmes lorsque vous devrez consommer l'acompte dans la facture finale. -ErrorQtyForCustomerInvoiceCantBeNegative=La quantité d'une ligne ne peut pas être négative dans les factures clients +ErrorQtyForCustomerInvoiceCantBeNegative=La quantité d'une ligne ne peut pas être négative dans les factures clients ErrorWebServerUserHasNotPermission=Le compte d'exécution du serveur web %s n'a pas les permissions pour cela ErrorNoActivatedBarcode=Aucun type de code-barres activé ErrUnzipFails=Impossible de décompresser le fichier %s avec ZipArchive @@ -152,8 +154,8 @@ ErrorPaymentModeDefinedToWithoutSetup=Un mode de paiement a été défini de typ ErrorPHPNeedModule=Erreur, votre PHP doit avoir le module %s installé pour utiliser cette fonctionnalité. ErrorOpenIDSetupNotComplete=Vous avez configuré Dolibarr pour accepter l'authentication OpenID, mais l'URL du service OpenID n'est pas défini dans la constante %s ErrorWarehouseMustDiffers=Les entrepôts source et destination doivent être différents -ErrorBadFormat=Mauvais format -ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Erreur, cet adhérent n'ait pas encore lié à un tiers. Lier le tier à un tiers existant ou créer un nouveau tiers avant de créer une adhésion avec facture. +ErrorBadFormat=Mauvais format ! +ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Erreur, cet adhérent n'est pas encore lié à un tiers. Liez le tiers à un tiers existant ou créez un nouveau tiers avant de créer une adhésion avec facture. ErrorThereIsSomeDeliveries=Erreur, il y a des bordereaux de réception liées à ces expéditions. La suppression est refusée. ErrorCantDeletePaymentReconciliated=Impossible d'effacer un paiement qui a généré une écriture sur le compte bancaire et qui a été rapprochée. ErrorCantDeletePaymentSharedWithPayedInvoice=Impossible d'effacer un paiement qui porte sur au moins une facture qui est à l'état payée. @@ -161,11 +163,11 @@ ErrorPriceExpression1=Ne peut assigner la constante '%s' ErrorPriceExpression2=Ne peut redéfinir la fonction '%s' ErrorPriceExpression3=Variable '%s' non définie dans la définition de fonction ErrorPriceExpression4=Caractère illégal '%s' -ErrorPriceExpression5=Unexpected '%s' +ErrorPriceExpression5='%s' inattendu. ErrorPriceExpression6=Nombre incorrect d'arguments (%s donné,%s attendu) ErrorPriceExpression8=Operateur '%s' non attendu ErrorPriceExpression9=Une erreur inattendue s'est produite -ErrorPriceExpression10=Il manque l'opérande à l'opérateur '%s' +ErrorPriceExpression10=Il manque l'opérande à l'opérateur '%s' ErrorPriceExpression11=Attendu '%s' ErrorPriceExpression14=Division par zéro ErrorPriceExpression17=Variable '%s' non définie @@ -187,16 +189,16 @@ ErrorGlobalVariableUpdater2=Paramètre manquant '%s' ErrorGlobalVariableUpdater3=La donnée recherché n'a pas été trouvée ErrorGlobalVariableUpdater4=Le client SOAP a échoué avec l'erreur '%s' ErrorGlobalVariableUpdater5=Pas de variable globale -ErrorFieldMustBeANumeric=Le champ %s doit être un numérique -ErrorMandatoryParametersNotProvided=Paramètre(s) obligatoire(s) non fournis -ErrorOppStatusRequiredIfAmount=Vous avez fixé un montant estimé pour cette opportunité. Aussi, vous devez également entrer son statut +ErrorFieldMustBeANumeric=Le champ %s doit être une valeur numérique +ErrorMandatoryParametersNotProvided=Paramètre(s) obligatoire(s) non fourni(s) +ErrorOppStatusRequiredIfAmount=Vous avez fixé un montant estimé pour cette opportunité. De plus, vous devez également entrer son statut ErrorFailedToLoadModuleDescriptorForXXX=Échec de changement de la classe descripteur du module %s ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Mauvaise définition du tableau Menu dans le descripteur de module (mauvaise valeur pour la clé fk_menu) ErrorSavingChanges=Une erreur est survenue lors de la sauvegarde des modifications ErrorWarehouseRequiredIntoShipmentLine=L'entrepôt est requis sur la ligne de l'expédition ErrorFileMustHaveFormat=Le fichier doit avoir le format %s ErrorFilenameCantStartWithDot=Le nom de fichier ne peut pas commencer par un '.' -ErrorSupplierCountryIsNotDefined=Le pays pour ce fournisseur n'est pas défini. Corriger cela. +ErrorSupplierCountryIsNotDefined=Le pays pour ce fournisseur n'est pas défini. Corrigez cela. ErrorsThirdpartyMerge=Echec de la fusion de 2 enregistrements. Demande annulée. ErrorStockIsNotEnoughToAddProductOnOrder=Le stock du produit %s est insuffisant pour permettre un ajout dans une nouvelle commande. ErrorStockIsNotEnoughToAddProductOnInvoice=Le stock du produit %s est insuffisant pour permettre un ajout dans une nouvelle facture. @@ -214,7 +216,7 @@ ErrorTaskAlreadyAssigned=Tâche déjà assignée à l'utilisateur ErrorModuleFileSeemsToHaveAWrongFormat=Le package du module semble avoir un mauvais format. ErrorModuleFileSeemsToHaveAWrongFormat2=Au moins un dossier obligatoire doit être présent dans l'archive zip du module : %s ou %s ErrorFilenameDosNotMatchDolibarrPackageRules=Le nom du package du module (%s) ne correspond pas à la syntaxe attendue: %s -ErrorDuplicateTrigger=Erreur, doublon du trigger nommé %s. Déjà chargé à partir de %s. +ErrorDuplicateTrigger=Erreur, doublon du déclencheur nommé %s. Déjà chargé à partir de %s. ErrorNoWarehouseDefined=Erreur, aucun entrepôts défini. ErrorBadLinkSourceSetButBadValueForRef=Le lien que vous utilisez n'est pas valide. Une 'source' pour le paiement est définie, mais la valeur pour 'ref' n'est pas valide. ErrorTooManyErrorsProcessStopped=Trop d'erreurs, Le processus a été arrêté. @@ -223,12 +225,12 @@ ErrorObjectMustHaveStatusDraftToBeValidated=L'objet %s doit être au statut 'Bro ErrorObjectMustHaveLinesToBeValidated=L'objet %s doit contenir des lignes ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Seules les factures validées peuvent être envoyées à l'aide de l'action de masse "Envoyer par courrier électronique". ErrorChooseBetweenFreeEntryOrPredefinedProduct=Vous devez choisir si l'article est un produit prédéfini ou non -ErrorDiscountLargerThanRemainToPaySplitItBefore=La réduction que vous essayez d'appliquer est supérieure au montant du paiement. Auparavant, divisez le rabais en 2 rabais plus petits. +ErrorDiscountLargerThanRemainToPaySplitItBefore=La réduction que vous essayez d'appliquer est supérieure au montant du paiement. Auparavant, divisez la remise en 2 rabais plus petits. ErrorFileNotFoundWithSharedLink=Fichier non trouvé. Peut être que la clé de partage a été modifiée ou le fichier a été récemment supprimé. -ErrorProductBarCodeAlreadyExists=Le code-barre du produit %s existe déjà sur une autre référence de produit +ErrorProductBarCodeAlreadyExists=Le code-barres du produit %s existe déjà sur une autre référence de produit ErrorNoteAlsoThatSubProductCantBeFollowedByLot=Notez également que l'utilisation d'un kit pour augmenter ou réduire automatiquement les sous-produits n'est pas possible lorsqu'au moins un sous-produit (ou sous-produit de sous-produits) a besoin d'un numéro de série/lot. ErrorDescRequiredForFreeProductLines=La description est obligatoire pour les lignes avec un produit non prédéfini -ErrorAPageWithThisNameOrAliasAlreadyExists=La page / container %s a le même nom ou un autre alias que celui que vous tentez d'utiliser. +ErrorAPageWithThisNameOrAliasAlreadyExists=La page/container %s a le même nom ou un autre alias que celui que vous tentez d'utiliser. ErrorDuringChartLoad=Erreur lors du chargement du tableau de compte. Si certains comptes n'ont pas été chargés, vous pouvez toujours les entrer manuellement. ErrorBadSyntaxForParamKeyForContent=Mauvaise syntaxe pour le paramètre keyforcontent. La valeur doit commencer par %s ou %s ErrorVariableKeyForContentMustBeSet=Erreur, la constante nommée %s (avec le contenu de texte à afficher) ou %s (avec l'adresse externe à afficher) doit être fixée. @@ -237,11 +239,12 @@ ErrorURLMustStartWithHttp=L'URL %s doit commencer par http:// ou https:// ErrorHostMustNotStartWithHttp=L'URL %s ne doit PAS commencer par http:// ou https:// ErrorNewRefIsAlreadyUsed=Erreur, la nouvelle référence est déjà utilisée ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible=Erreur, supprimer le paiement lié à une facture clôturée n'est pas possible. -ErrorSearchCriteriaTooSmall=Critère de recherche trop petit. -ErrorObjectMustHaveStatusActiveToBeDisabled=Les objets doivent avoir le statut 'Actif' pour être désactivés -ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated=Les objets doivent avoir le statut 'Brouillon' ou 'Désactivé' pour être activés +ErrorSearchCriteriaTooSmall=Critère de recherche trop court. +ErrorObjectMustHaveStatusActiveToBeDisabled=Les objets doivent avoir le statut 'Actif' pour pouvoir être désactivés +ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated=Les objets doivent avoir le statut 'Brouillon' ou 'Désactivé' pour pouvoir être activés ErrorNoFieldWithAttributeShowoncombobox=Aucun champ n'a la propriété 'showoncombobox' dans la définition de l'objet '%s'. Pas moyen d'afficher la liste de cases à cocher ErrorFieldRequiredForProduct=Le champ '%s' est obligatoire pour le produit %s +AlreadyTooMuchPostOnThisIPAdress=Trop de requêtes ont déjà été envoyées depuis cette adresse IP. ProblemIsInSetupOfTerminal=Le problème est dans la configuration du terminal %s. ErrorAddAtLeastOneLineFirst=Ajouter d'abord au moins une ligne ErrorRecordAlreadyInAccountingDeletionNotPossible=Erreur, l'enregistrement est déjà transféré dans la comptabilité, la suppression n'est pas possible. @@ -283,7 +286,7 @@ ErrorNotApproverForHoliday=Vous n'êtes pas l'approbateur du congé %s ErrorAttributeIsUsedIntoProduct=Cet attribut est utilisé dans une ou plusieurs variantes de produit ErrorAttributeValueIsUsedIntoProduct=Cette valeur d'attribut est utilisée dans une ou plusieurs variantes de produit ErrorPaymentInBothCurrency=Erreur, tous les montants doivent être entrés dans la même colonne. -ErrorYouTryToPayInvoicesInACurrencyFromBankWithAnotherCurrency=Vous essayez de payer une facture en monnaie %s depuis un compte en %s +ErrorYouTryToPayInvoicesInACurrencyFromBankWithAnotherCurrency=Vous essayez de payer une facture en devise %s depuis un compte en %s ErrorInvoiceLoadThirdParty=Impossible de charger l'objet tiers pour la facture "%s" ErrorInvoiceLoadThirdPartyKey=Clé tiers "%s" non définie pour la facture "%s" ErrorDeleteLineNotAllowedByObjectStatus=Supprimer une ligne n'est pas autorisée par l'état actuel de l'objet @@ -298,10 +301,12 @@ ErrorCharPlusNotSupportedByImapForSearch=La recherche IMAP n'est pas en mesure d ErrorTableNotFound=Table %s introuvable ErrorValueForTooLow=La valeur pour %s est trop faible ErrorValueCantBeNull=La valeur pour %s ne peut pas être nulle +ErrorDateOfMovementLowerThanDateOfFileTransmission=La date de la transaction bancaire ne peut êtse inférieure à la date d'envoi du fichier +ErrorTooMuchFileInForm=Trop de fichier dans ce formulaire. Le nombre maximal de fichier est de %s fichier(s) # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Votre paramètre PHP upload_max_filesize (%s) est supérieur au paramètre PHP post_max_size (%s). Ceci n'est pas une configuration cohérente. -WarningPasswordSetWithNoAccount=Un mot de passe a été fixé pour cet adhérent. Cependant, aucun compte d'utilisateur n'a été créé. Donc, ce mot de passe est stocké, mais ne peut être utilisé pour accéder à Dolibarr. Il peut être utilisé par un module/interface externe, mais si vous n'avez pas besoin de définir ni login ni mot de passe pour un adhérent, vous pouvez désactiver l'option «Gérer un login pour chaque adhérent" depuis la configuration du module Adhérents. Si vous avez besoin de gérer un login, mais pas de mot de passe, vous pouvez laisser ce champ vide pour éviter cet avertissement. Remarque: L'email peut également être utilisé comme login si l'adhérent est lié à un utilisateur. +WarningPasswordSetWithNoAccount=Un mot de passe a défini pour cet adhérent. Cependant, aucun compte d'utilisateur n'a été créé. Ce mot de passe a donc été stocké, mais ne peut être utilisé pour accéder à Dolibarr. Il peut être utilisé par un module/interface externe, mais si vous n'avez pas besoin de définir ni login ni mot de passe pour un adhérent, vous pouvez désactiver l'option «Gérer un login pour chaque adhérent" depuis la configuration du module Adhérents. Si vous avez besoin de gérer un login, mais pas de mot de passe, vous pouvez laisser ce champ vide pour éviter cet avertissement. Remarque: L'email peut également être utilisé comme login si l'adhérent est lié à un utilisateur. WarningMandatorySetupNotComplete=Cliquez ici pour configurer les paramètres principaux WarningEnableYourModulesApplications=Cliquez ici pour activer vos modules et applications WarningSafeModeOnCheckExecDir=Attention, l'option PHP safe_mode est active, la commande doit dont être dans un répertoire déclaré dans le paramètre php safe_mode_exec_dir. @@ -315,11 +320,11 @@ WarningUntilDirRemoved=Les alertes de sécurité sont visibles par les administr WarningCloseAlways=Attention, la fermeture se fait même lorsque le montant diffère. N'activez cette fonctionnalité qu'en connaissance de cause. WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boîte provoque de sérieux ralentissements des pages affichant cette boîte. WarningClickToDialUserSetupNotComplete=La configuration ClickToDial pour votre compte utilisateur n'est pas complète (voir l'onglet ClickToDial sur votre fiche utilisateur) -WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Fonction désactivée quand l'affichage est en mode optimisé pour les personnes aveugles ou les navigateurs textes. +WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Fonction désactivée quand l'affichage est en mode optimisé pour les personnes malvoyantes ou les navigateurs textes. WarningPaymentDateLowerThanInvoiceDate=La date de paiement (%s) est inférieure à la date de facturation (%s) de la facture %s. WarningTooManyDataPleaseUseMoreFilters=Trop de données (plus de %s lignes). Utilisez davantage de filtres ou régler la constante %s pour augmenter la limite à une valeur plus élevée. WarningSomeLinesWithNullHourlyRate=Des temps ont été enregistrés par des utilisateurs lorsque leur taux horaire n'était défini. Une valeur de 0 %s a été utilisée, mais cela peut entraîner une mauvaise évaluation du temps passé. -WarningYourLoginWasModifiedPleaseLogin=Votre identifiant a été modifié. Par sécurité, vous devrez vous identifier avec votre nouvel identifiant avant l'action suivante. +WarningYourLoginWasModifiedPleaseLogin=Votre identifiant a été modifié. Par sécurité, vous devrez vous identifier avec votre nouvel identifiant avant la prochaine action. WarningAnEntryAlreadyExistForTransKey=Une donnée identique existe déjà pour la traduction du code dans cette langue WarningNumberOfRecipientIsRestrictedInMassAction=Attention, le nombre de destinataires différents est limité à %s lorsque vous utilisez les actions en masse sur les listes WarningDateOfLineMustBeInExpenseReportRange=Attention, la date de la ligne n'est pas dans la plage de la note de frais @@ -338,20 +343,20 @@ WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal=La validation automati # Validate RequireValidValue = Valeur non valide -RequireAtLeastXString = Requiert au moins %s caractère(s) -RequireXStringMax = Requiert %s caractère(s) maximum -RequireAtLeastXDigits = Requiert au moins %s caractère(s) -RequireXDigitsMax = Requiert %scaractère(s) maximum +RequireAtLeastXString = Nécessite au moins %s caractère(s) +RequireXStringMax = Nécessite %s caractère(s) maximum +RequireAtLeastXDigits = Nécessite au moins %s caractère(s) +RequireXDigitsMax = Nécessite %scaractère(s) maximum RequireValidNumeric = Nécessite une valeur numérique RequireValidEmail = L'adresse email n'est pas valide RequireMaxLength = La longueur doit être inférieure à %s caractères RequireMinLength = La longueur doit être supérieure à %s caractère(s) -RequireValidUrl = Une URL valide est requise -RequireValidDate = Date valide requise -RequireANotEmptyValue = Est requis -RequireValidDuration = Une durée valide est requise -RequireValidExistingElement = Une valeur existante est requise -RequireValidBool = Un booléen valide est requis +RequireValidUrl = Une URL valide est demandée +RequireValidDate = Une date valide est nécessaire +RequireANotEmptyValue = Est nécessaire +RequireValidDuration = Une durée valide est nécessaire +RequireValidExistingElement = Une valeur existante est nécessaire +RequireValidBool = Un booléen valide est nécessaire BadSetupOfField = Erreur mauvaise configuration du champ BadSetupOfFieldClassNotFoundForValidation = Erreur mauvaise configuration du champ : Classe introuvable pour validation BadSetupOfFieldFileNotFound = Erreur mauvaise configuration du champ : Fichier introuvable pour l'inclusion From f4476b905c7d65c3289ffa923938c84cd5fd1030 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 18:11:57 +0100 Subject: [PATCH 085/370] Debug v17 --- htdocs/compta/resultat/result.php | 117 ++++++++++++++++++------------ 1 file changed, 69 insertions(+), 48 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 3f3e14e2d61..856eb8a5fe8 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -339,60 +339,81 @@ if ($modecompta == 'CREANCES-DETTES') { } $result = strtr($formula, $vars); + $result = str_replace('--', '+', $result); - //var_dump($result); - //$r = $AccCat->calculate($result); - $r = dol_eval($result, 1, 1, '1'); - //var_dump($r); - - print ''.price($r).''.price($r).''.$rshort.''.$rshort.''.$rshort.''.price($r).''.$rshort.''.price($r).''.price($r).''.price($r).''.price($r).''.price($r).'
'; + // Code and Label + print ''; print dol_escape_htmltag($cat['code']); - print ''; + print ''; print dol_escape_htmltag($cat['label']); print ''.$rshort.''.$rshort.''.$rshort.''.$rshort.''.price($r).''.price($r).''.price($r).''.price($r).''.price($r).''.price($r).''.price($r).'
'; + print ''; print dol_escape_htmltag($cat['code']); print ''; - print dol_escape_htmltag($cat['label']); + $labeltoshow = dol_escape_htmltag($cat['label']); if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts $i = 0; foreach ($cpts as $cpt) { if ($i > 5) { - print '...)'; + $labeltoshow .= '...)'; break; } if ($i > 0) { - print ', '; + $labeltoshow .= ', '; } else { - print ' ('; + $labeltoshow .= ' ('; } - print dol_escape_htmltag($cpt['account_number']); + $labeltoshow .= dol_escape_htmltag($cpt['account_number']); $i++; } if ($i <= 5) { - print ')'; + $labeltoshow .= ')'; } } else { - print ' - '.$langs->trans("GroupIsEmptyCheckSetup").''; + $labeltoshow .= ' - '.$langs->trans("GroupIsEmptyCheckSetup").''; } + print ''; + print $labeltoshow; print ''.price($totCat['NP']).'
'; + print ''; print '     '.length_accountg($cpt['account_number']); print ' - '; print $cpt['account_label']; From 34c2b20f7705b0d44352d9c7ae0bec3537276542 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 20:45:08 +0100 Subject: [PATCH 087/370] css --- htdocs/compta/resultat/result.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 8615e595200..743fd4c0506 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -322,7 +322,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Code and Label print ''; print dol_escape_htmltag($cat['code']); - print ''; + print ''; print dol_escape_htmltag($cat['label']); print ''.price($r).''.price($r).''; + print ''; print $labeltoshow; print ''.price($totCat['NP']).''.price($totCat['N']).''.price($totCat['N']).'
'; + print ''; print '     '.length_accountg($cpt['account_number']); print ' - '; print $cpt['account_label']; print ''.price($resultNP).''.price($resultN).''.price($resultN).'
'; +print '
'; // Ref /*print ''; @@ -136,21 +146,26 @@ print $form->showrefnav($object,'id','',1,'rowid','id'); print '';*/ // Date -print ''; +print '"; +print ''; // Mode -print ''; // Numero -print ''; +print ''; // Montant -print ''; +print ''; // Note -print ''; +print ''; // Bank account if (isModEnabled("banque")) { From 3cf90352bf20c4ec88870b7970fc484cd06294dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2022 23:51:47 +0100 Subject: [PATCH 090/370] Fix date timezone --- htdocs/salaries/class/paymentsalary.class.php | 1 + htdocs/salaries/payment_salary/card.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index a2de50aeed4..ca4df1df4f9 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -266,6 +266,7 @@ class PaymentSalary extends CommonObject $this->num_paiement = $obj->num_payment; $this->num_payment = $obj->num_payment; $this->note = $obj->note; + $this->note_private = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index c6d73c5ec7f..25d28932a40 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -43,6 +43,8 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); if ($user->socid) $socid = $user->socid; +$salary = new Salary($db); + $object = new PaymentSalary($db); if ($id > 0) { $result = $object->fetch($id); @@ -71,7 +73,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('salarie } if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('salaries', 'write')) { - $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'), 'tzuserrel'); + $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); // field is a date in database, not a datetime, so we must use 'gmt' not 'tzuserrel' $res = $object->updatePaymentDate($datepaye); if ($res === 0) { setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); @@ -85,12 +87,10 @@ if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('salaries', * View */ -llxHeader(); - -$salary = new Salary($db); - $form = new Form($db); +llxHeader('', $langs->trans("SalaryPayment")); + $h = 0; $head = array(); From 41f35d5947758b4f1f61907ea24601e8a2170c4d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 00:04:47 +0100 Subject: [PATCH 091/370] NEW Date for salary payment includes the hour/min --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_payment_salary.sql | 2 +- htdocs/salaries/payment_salary/card.php | 6 +++--- htdocs/salaries/payments.php | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9c193b90776..d766c74cde1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -96,7 +96,7 @@ class Form * @param string $preselected Value to show/edit (not used in this function) * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) * @param string $moreparam More param to add on a href URL. * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' @@ -192,7 +192,7 @@ class Form * @param string $value Value to show/edit * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') @@ -200,7 +200,7 @@ class Form * @param int $notabletag Do no output table tags * @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email') * @param string $paramid Key of parameter for id ('id', 'socid') - * @param string $gm 'auto' or 'tzuser' or 'tzserver' (when $typeofdata is a date) + * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date) * @return string HTML edit field */ public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id', $gm = 'auto') diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 2910ccee23b..ae7d51a20dd 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -42,3 +42,6 @@ ALTER TABLE llx_facture DROP COLUMN amount; ALTER TABLE llx_socpeople CHANGE fk_prospectcontactlevel fk_prospectlevel varchar(12); ALTER TABLE llx_facture ADD COLUMN prorata_discount real DEFAULT NULL; + +ALTER TABLE llx_payment_salary MODIFY COLUMN datep datetime; + diff --git a/htdocs/install/mysql/tables/llx_payment_salary.sql b/htdocs/install/mysql/tables/llx_payment_salary.sql index 308e70effc2..0dd24eb199d 100644 --- a/htdocs/install/mysql/tables/llx_payment_salary.sql +++ b/htdocs/install/mysql/tables/llx_payment_salary.sql @@ -23,7 +23,7 @@ create table llx_payment_salary tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer DEFAULT NULL, - datep date, -- payment date + datep datetime, -- payment date datev date, -- value date (this field should not be here, only into bank tables) salary double(24,8), -- salary of user when payment was done amount double(24,8) NOT NULL DEFAULT 0, diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 25d28932a40..8e48dfb0d08 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -73,7 +73,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('salarie } if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('salaries', 'write')) { - $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); // field is a date in database, not a datetime, so we must use 'gmt' not 'tzuserrel' + $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'), 'tzuserrel'); $res = $object->updatePaymentDate($datepaye); if ($res === 0) { setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); @@ -147,9 +147,9 @@ print '';*/ // Date print '"; print ''; diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 8fcc7183dae..75a18621ea1 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -575,7 +575,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Date payment - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } From e6035fee1cbb32c34ba00ebd9a17dd7523244758 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 00:12:48 +0100 Subject: [PATCH 092/370] NEW Can add the add now link on date into addfieldvalue() --- htdocs/core/class/html.form.class.php | 13 ++++++++----- htdocs/salaries/payment_salary/card.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d766c74cde1..678f34c52ad 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -194,16 +194,17 @@ class Form * @param boolean $perm Permission to allow button to edit parameter * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value - * @param object $extObject External object + * @param object $extObject External object ??? * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') - * @param string $moreparam More param to add on the form action href URL + * @param string $moreparam More param to add on the form on action href URL parameter * @param int $notabletag Do no output table tags * @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email') * @param string $paramid Key of parameter for id ('id', 'socid') * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date) + * @param array $moreoptions Array with more options. For example array('addnowlink'=>1) * @return string HTML edit field */ - public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id', $gm = 'auto') + public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id', $gm = 'auto', $moreoptions = array()) { global $conf, $langs; @@ -276,9 +277,11 @@ class Form $ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea')); $ret .= ''; } elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { - $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, 0, 0, '', '', '', '', 1, '', '', $gm); + $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; + $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', '', '', 1, '', '', $gm); } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { - $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, 0, 0, '', '', '', '', 1, '', '', $gm); + $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; + $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', '', '', 1, '', '', $gm); } elseif (preg_match('/^select;/', $typeofdata)) { $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); $arraylist = array(); diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 8e48dfb0d08..b35469ab27e 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -149,7 +149,7 @@ print '';*/ print '"; print ''; From fff3a492d5847b3eb6c27a6278f26b5902e31359 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 00:27:00 +0100 Subject: [PATCH 093/370] Fix date --- htdocs/salaries/card.php | 11 +++++++---- htdocs/salaries/paiement_salary.php | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 974407ff42d..0c4f3e57ff5 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -957,9 +957,12 @@ if ($id > 0) { while ($i < $num) { $objp = $db->fetch_object($resql); - print ''; + // Date + print ''; - print '\n"; + // Date + print '\n"; $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; print "\n"; if (isModEnabled("banque")) { @@ -993,8 +996,8 @@ if ($id > 0) { print ''; } - print '\n"; - print '\n"; + print '\n"; + print '\n"; $resteapayer = $object->amount - $totalpaid; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 9f90e4c9ac9..0c2c757e2dc 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -66,7 +66,7 @@ if (($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == ' exit; } - $datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int')); + $datepaye = dol_mktime(GETPOST("rehour", 'int'), GETPOST("remin", 'int'), GETPOST("resec", 'int'), GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'), 'tzuserrel'); if (!(GETPOST("paiementtype", 'int') > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors'); @@ -210,9 +210,9 @@ if ($action == 'create') { print '';*/ print '"; print ''; From f99fa791b2c9404317cf1fd49515389ca955640d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:24:24 +0100 Subject: [PATCH 094/370] Fix rounding --- .../accountancy/bookkeeping/listbyaccount.php | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index c24e509ff60..00626b2558c 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -962,8 +962,8 @@ while ($i < min($num, $limit)) { } else { print ''; } - print ''; - print ''; + print ''; + print ''; print ''; print ''; // Show balance of last shown account @@ -972,13 +972,13 @@ while ($i < min($num, $limit)) { print ''; if ($balance > 0) { print ''; print ''; } else { print ''; print ''; } print ''; @@ -1233,8 +1233,8 @@ while ($i < min($num, $limit)) { if ($num > 0 && $colspan > 0) { print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; // Show balance of last shown account @@ -1243,19 +1243,29 @@ if ($num > 0 && $colspan > 0) { print ''; if ($balance > 0) { print ''; print ''; } else { print ''; print ''; } print ''; print ''; } + +// Clean total values to round them +if (!empty($totalarray['val']['totaldebit'])) { + $totalarray['val']['totaldebit'] = price2num($totalarray['val']['totaldebit'], 'MT'); +} +if (!empty($totalarray['val']['totalcredit'])) { + $totalarray['val']['totalcredit'] = price2num($totalarray['val']['totalcredit'], 'MT'); +} + + // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From dd4810aef62901c33fbbba13dd49e13f1ffcc516 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:40:09 +0100 Subject: [PATCH 095/370] Fix escape --- htdocs/accountancy/bookkeeping/list.php | 4 ++-- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ac1cc93cba7..eca5a1beadc 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -346,7 +346,7 @@ if (empty($reshook)) { $listofaccountsforgroup2 = array(); if (is_array($listofaccountsforgroup)) { foreach ($listofaccountsforgroup as $tmpval) { - $listofaccountsforgroup2[] = $tmpval['id']; + $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'"; } } $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); @@ -698,7 +698,7 @@ if (count($filter) > 0) { $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); } } elseif ($key == 't.search_accounting_code_in' && !empty($value)) { - $sqlwhere[] = 't.numero_compte IN ('.$value.')'; + $sqlwhere[] = 't.numero_compte IN ('.$db->sanitize($value, 1).')'; } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 00626b2558c..2e434550c25 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -291,7 +291,7 @@ if (empty($reshook)) { $listofaccountsforgroup2 = array(); if (is_array($listofaccountsforgroup)) { foreach ($listofaccountsforgroup as $tmpval) { - $listofaccountsforgroup2[] = $tmpval['id']; + $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'"; } } $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0458250489f..bb5a6e472b1 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -903,7 +903,7 @@ class BookKeeping extends CommonObject $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); } } elseif ($key == 't.search_accounting_code_in' && !empty($value)) { - $sqlwhere[] = 't.numero_compte IN ('.$value.')'; + $sqlwhere[] = 't.numero_compte IN ('.$this->db->sanitize($value, 1).')'; } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } From 8d64f8617cfb86748874ef27ec861a10a0968df7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:52:41 +0100 Subject: [PATCH 096/370] Clean code --- .../class/accountingjournal.class.php | 22 +------------------ htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 4accf66e154..f56932d4985 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -454,27 +454,12 @@ class AccountingJournal extends CommonObject } $sql = ""; - - // FIXME sql error with Mysql 5.7 - /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { - $sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS ("; - $sql .= " SELECT DISTINCT fk_docdet"; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; - $sql .= " WHERE doc_type = 'asset'"; - $sql .= ") "; - }*/ - $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; - // FIXME sql error with Mysql 5.7 - /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { - $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; - }*/ $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing - // Compatibility with Mysql 5.7 if ($in_bookkeeping == 'already') { $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; } elseif ($in_bookkeeping == 'notyet') { @@ -488,11 +473,6 @@ class AccountingJournal extends CommonObject if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; } - // Already in bookkeeping or not - // FIXME sql error with Mysql 5.7 - /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { - $sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL"; - }*/ $sql .= " ORDER BY ad.depreciation_date"; dol_syslog(__METHOD__, LOG_DEBUG); @@ -755,7 +735,7 @@ class AccountingJournal extends CommonObject } } - $journal_data[$pre_data_id] = $element; + $journal_data[(int) $pre_data_id] = $element; } unset($pre_data); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index efe9374a748..244b3df9405 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -477,8 +477,8 @@ class ActionComm extends CommonObject $this->elementtype = 'contract'; } - if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead fo array - $tmpid = $this->userassigned; + if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead of an array + $tmpid = (int) $this->userassigned; $this->userassigned = array(); $this->userassigned[$tmpid] = array('id'=>$tmpid, 'transparency'=>$this->transparency); } From 8e82bb71482f12e28de447b7c01179d8d021e4a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 02:00:31 +0100 Subject: [PATCH 097/370] Clean code --- htdocs/adherents/card.php | 2 +- htdocs/product/card.php | 4 ++-- htdocs/societe/card.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 56e7868ec5a..9d0677a2fc9 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -565,7 +565,7 @@ if (empty($reshook)) { } if (!empty($object->url) && !isValidUrl($object->url)) { $langs->load("errors"); - setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors'); + setEventMessages($langs->trans("ErrorBadUrl", $object->url), null, 'errors'); } $public = 0; if (isset($public)) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 173c96fd297..2bfe94f418a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -541,7 +541,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; $mesg = 'Failed to get bar code type information '; - setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors'); + setEventMessages($mesg.$stdobject->error, $stdobject->errors, 'errors'); } $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; @@ -780,7 +780,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; $mesg = 'Failed to get bar code type information '; - setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors'); + setEventMessages($mesg.$stdobject->error, $stdobject->errors, 'errors'); } $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a7389c8949c..cb2b101307b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -570,11 +570,11 @@ if (empty($reshook)) { if (!empty($object->email) && !isValidEMail($object->email)) { $langs->load("errors"); $error++; - setEventMessages('', $langs->trans("ErrorBadEMail", $object->email), 'errors'); + setEventMessages($langs->trans("ErrorBadEMail", $object->email), null, 'errors'); } if (!empty($object->url) && !isValidUrl($object->url)) { $langs->load("errors"); - setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors'); + setEventMessages($langs->trans("ErrorBadUrl", $object->url), null, 'errors'); } if (!empty($object->webservices_url)) { //Check if has transport, without any the soap client will give error From 1afa3b4f81cbd195eca973e527c5f7c8627551f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:58:13 +0100 Subject: [PATCH 098/370] Fix doxygen --- htdocs/core/class/ldap.class.php | 8 ++++---- .../core/modules/stocktransfer/doc/pdf_eagle.modules.php | 2 +- .../mymodule/doc/pdf_standard_myobject.modules.php | 2 +- .../doc/pdf_standard_recruitmentjobposition.modules.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 011d8a380ef..3dc45c753bc 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1239,10 +1239,10 @@ class Ldap /** * Load all attribute of a LDAP user * - * @param User $user User to search for. Not used if a filter is provided. - * @param string $filter Filter for search. Must start with &. - * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) - * @return int >0 if OK, <0 if KO + * @param User|string $user Not used. + * @param string $filter Filter for search. Must start with &. + * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) + * @return int >0 if OK, <0 if KO */ public function fetch($user, $filter) { diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 22601d93dae..35a52f35bd8 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -895,7 +895,7 @@ class pdf_eagle extends ModelePdfStockTransfer /** * Show top header of page. * - * @param PDF $pdf Object PDF + * @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 diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 5c277b85ae4..b78a2a5f4d7 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -879,7 +879,7 @@ class pdf_standard_myobject extends ModelePDFMyObject /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @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 diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 1a58085d8c9..61c2eb3ff20 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -798,7 +798,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @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 From 6c223eafc90994a95992102fd5c6b351d792bc2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:58:13 +0100 Subject: [PATCH 099/370] Fix doxygen and warnings --- htdocs/admin/modules.php | 4 ++-- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/core/class/ldap.class.php | 8 ++++---- htdocs/core/modules/modHoliday.class.php | 4 ---- .../core/modules/stocktransfer/doc/pdf_eagle.modules.php | 2 +- htdocs/fourn/commande/list.php | 2 +- .../class/api_knowledgemanagement.class.php | 2 +- .../mymodule/doc/pdf_standard_myobject.modules.php | 2 +- htdocs/product/class/api_products.class.php | 6 +++--- .../doc/pdf_standard_recruitmentjobposition.modules.php | 2 +- 10 files changed, 16 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 8c9230d190c..45534aa66f5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -844,10 +844,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } } - } elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) { + } elseif (preg_match('/^([^@]+)@([^@]+)$/i', (string) $objMod->config_page_url, $regs)) { $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } else { - $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; + $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } } else { $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 678f34c52ad..f3a566b6014 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7755,7 +7755,7 @@ class Form } } if (!is_object($objecttmp)) { - dol_syslog('Error bad setup of type for field '.$InfoFieldList, LOG_WARNING); + dol_syslog('Error bad setup of type for field '.join(',', $InfoFieldList), LOG_WARNING); return 'Error bad setup of type for field '.join(',', $InfoFieldList); } @@ -9905,7 +9905,7 @@ class Form method: "POST", dataType: "json", data: { fk_c_exp_tax_cat: $(this).val(), token: \''.currentToken().'\' }, - url: "'.(DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.$params).'", + url: "'.(DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.join('&', $params)).'", }).done(function( data, textStatus, jqXHR ) { console.log(data); if (typeof data.up != "undefined") { diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 011d8a380ef..3dc45c753bc 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1239,10 +1239,10 @@ class Ldap /** * Load all attribute of a LDAP user * - * @param User $user User to search for. Not used if a filter is provided. - * @param string $filter Filter for search. Must start with &. - * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) - * @return int >0 if OK, <0 if KO + * @param User|string $user Not used. + * @param string $filter Filter for search. Must start with &. + * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) + * @return int >0 if OK, <0 if KO */ public function fetch($user, $filter) { diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 61bdc0e8f98..57ffe62e005 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -78,10 +78,6 @@ class modHoliday extends DolibarrModules // Config pages $this->config_page_url = array("holiday.php"); - - // Config pages. Put here list of php page names stored in admmin directory used to setup module. - // $this->config_page_url = array("holiday.php?leftmenu=setup@holiday"); - // Dependencies $this->hidden = false; // A condition to hide module $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 22601d93dae..35a52f35bd8 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -895,7 +895,7 @@ class pdf_eagle extends ModelePdfStockTransfer /** * Show top header of page. * - * @param PDF $pdf Object PDF + * @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 diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3d458247bcf..3080a184abb 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1208,7 +1208,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'prevalidate') { - print $form->formconfirm($_SERVER["PHP_SELF"].$fieldstosearchall, $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); } if ($massaction == 'createbills') { diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index ccf54b1d6d9..8232287b23b 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -114,7 +114,7 @@ class KnowledgeManagement extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); + throw new RestException(503, 'Error when retrieve category list : '.join(',', array_merge(array($categories->error), $categories->errors))); } return $result; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 5c277b85ae4..b78a2a5f4d7 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -879,7 +879,7 @@ class pdf_standard_myobject extends ModelePDFMyObject /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @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 diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 76ee11f727e..7a10293d7e4 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -595,7 +595,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); + throw new RestException(503, 'Error when retrieve category list : '.join(',', array_merge(array($categories->error), $categories->errors))); } return $result; @@ -628,7 +628,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); + throw new RestException(503, 'Error when retrieve prices list : '.join(',', array_merge(array($this->product->error), $this->product->errors))); } return array( @@ -719,7 +719,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); + throw new RestException(503, 'Error when retrieve prices list : '.join(',', array_merge(array($this->product->error), $this->product->errors))); } return array( diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 1a58085d8c9..61c2eb3ff20 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -798,7 +798,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @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 From 3dfe09d1fee35d1de40411f6023d4b6d4b72c869 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:58:13 +0100 Subject: [PATCH 100/370] Fix doxygen --- htdocs/core/class/ldap.class.php | 8 ++++---- .../core/modules/stocktransfer/doc/pdf_eagle.modules.php | 2 +- .../mymodule/doc/pdf_standard_myobject.modules.php | 2 +- .../doc/pdf_standard_recruitmentjobposition.modules.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 011d8a380ef..3dc45c753bc 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1239,10 +1239,10 @@ class Ldap /** * Load all attribute of a LDAP user * - * @param User $user User to search for. Not used if a filter is provided. - * @param string $filter Filter for search. Must start with &. - * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) - * @return int >0 if OK, <0 if KO + * @param User|string $user Not used. + * @param string $filter Filter for search. Must start with &. + * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) + * @return int >0 if OK, <0 if KO */ public function fetch($user, $filter) { diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 22601d93dae..35a52f35bd8 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -895,7 +895,7 @@ class pdf_eagle extends ModelePdfStockTransfer /** * Show top header of page. * - * @param PDF $pdf Object PDF + * @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 diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index bd5348b1566..05486989e1d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -879,7 +879,7 @@ class pdf_standard_myobject extends ModelePDFMyObject /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @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 diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 94e93c87baa..f4d2226d51d 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -798,7 +798,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @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 From b8092f1eae50f0bd987426564e6ad1930ca4ed77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 01:58:13 +0100 Subject: [PATCH 101/370] Fix doxygen and warnings --- htdocs/admin/modules.php | 4 ++-- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/core/modules/modHoliday.class.php | 4 ---- htdocs/fourn/commande/list.php | 2 +- .../class/api_knowledgemanagement.class.php | 2 +- htdocs/product/class/api_products.class.php | 6 +++--- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 93eb5524a1d..46b711875b8 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -844,10 +844,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } } - } elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) { + } elseif (preg_match('/^([^@]+)@([^@]+)$/i', (string) $objMod->config_page_url, $regs)) { $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } else { - $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; + $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } } else { $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a9c17a2edba..3f4579340d0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7720,7 +7720,7 @@ class Form } } if (!is_object($objecttmp)) { - dol_syslog('Error bad setup of type for field '.$InfoFieldList, LOG_WARNING); + dol_syslog('Error bad setup of type for field '.join(',', $InfoFieldList), LOG_WARNING); return 'Error bad setup of type for field '.join(',', $InfoFieldList); } @@ -9870,7 +9870,7 @@ class Form method: "POST", dataType: "json", data: { fk_c_exp_tax_cat: $(this).val(), token: \''.currentToken().'\' }, - url: "'.(DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.$params).'", + url: "'.(DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.join('&', $params)).'", }).done(function( data, textStatus, jqXHR ) { console.log(data); if (typeof data.up != "undefined") { diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 61bdc0e8f98..57ffe62e005 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -78,10 +78,6 @@ class modHoliday extends DolibarrModules // Config pages $this->config_page_url = array("holiday.php"); - - // Config pages. Put here list of php page names stored in admmin directory used to setup module. - // $this->config_page_url = array("holiday.php?leftmenu=setup@holiday"); - // Dependencies $this->hidden = false; // A condition to hide module $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3d458247bcf..3080a184abb 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1208,7 +1208,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'prevalidate') { - print $form->formconfirm($_SERVER["PHP_SELF"].$fieldstosearchall, $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); } if ($massaction == 'createbills') { diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index ccf54b1d6d9..8232287b23b 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -114,7 +114,7 @@ class KnowledgeManagement extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); + throw new RestException(503, 'Error when retrieve category list : '.join(',', array_merge(array($categories->error), $categories->errors))); } return $result; diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 76ee11f727e..7a10293d7e4 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -595,7 +595,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); + throw new RestException(503, 'Error when retrieve category list : '.join(',', array_merge(array($categories->error), $categories->errors))); } return $result; @@ -628,7 +628,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); + throw new RestException(503, 'Error when retrieve prices list : '.join(',', array_merge(array($this->product->error), $this->product->errors))); } return array( @@ -719,7 +719,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); + throw new RestException(503, 'Error when retrieve prices list : '.join(',', array_merge(array($this->product->error), $this->product->errors))); } return array( From 9319f56599dec6a4686833e9f2d6ec5dcf1e04e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 03:10:37 +0100 Subject: [PATCH 102/370] Fix css --- htdocs/asset/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/bom/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/comm/propal/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/commande/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 2 +- .../facture/tpl/linkedobjectblockForRec.tpl.php | 2 +- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 12 ++++++------ htdocs/reception/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 4 +++- htdocs/ticket/tpl/linkedobjectblock.tpl.php | 4 ++-- 11 files changed, 26 insertions(+), 21 deletions(-) diff --git a/htdocs/asset/tpl/linkedobjectblock.tpl.php b/htdocs/asset/tpl/linkedobjectblock.tpl.php index aef30995432..11d94714db8 100644 --- a/htdocs/asset/tpl/linkedobjectblock.tpl.php +++ b/htdocs/asset/tpl/linkedobjectblock.tpl.php @@ -46,12 +46,12 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; - print ''; - print ''; + print ''; print ''; print ''; print ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; - print ''; + print ''; print ''; print ''; print ' - + '; - echo ''; + echo ''; - echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; - print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index 009534b91b5..341e30e3784 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -50,12 +50,12 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?> - - + - - + Date: Fri, 30 Dec 2022 04:15:10 +0100 Subject: [PATCH 103/370] Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 --- htdocs/core/class/commonobject.class.php | 17 ++++++++++++++++- ...ace_20_modWorkflow_WorkflowManager.class.php | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 92fa8eff40b..b8cae867d71 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3789,7 +3789,7 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Add objects linked in llx_element_element. + * Add an object link into llx_element_element. * * @param string $origin Linked element type * @param int $origin_id Linked element id @@ -4111,6 +4111,21 @@ abstract class CommonObject } } + /** + * Clear the cache saying that all linked object were already loaded. So next fetchObjectLinked will reload all links. + * + * @return int <0 if KO, >0 if OK + * @see fetchObjectLinked() + */ + public function clearObjectLinkedCache() + { + if ($this->id > 0 && !empty($this->linkedObjectsFullLoaded[$this->id])) { + unset($this->linkedObjectsFullLoaded[$this->id]); + } + + return 1; + } + /** * Update object linked of a current object * diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 884790c990e..2fa476c25d8 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -90,6 +90,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers $this->error = $newobject->error; $this->errors[] = $newobject->error; } + + $object->clearObjectLinkedCache(); + return $ret; } } @@ -111,6 +114,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers $this->error = $newobject->error; $this->errors[] = $newobject->error; } + + $object->clearObjectLinkedCache(); + return $ret; } } From ed1c0897edf2f341acf6941c107fc5482fc9e3f0 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 30 Dec 2022 10:59:45 +0100 Subject: [PATCH 104/370] NEW copyrights --- htdocs/accountancy/class/accountancyexport.class.php | 3 ++- htdocs/accountancy/tpl/export_journal.tpl.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index e101c09abd3..a421d26eb70 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,7 +5,8 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2022 Open-DSI + * Copyright (C) 2016-2022 Alexandre Spangaro + * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index f57d54fcfbd..8e3c914a6f5 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015-2022 Alexandre Spangaro + * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016 Charlie Benke * Copyright (C) 2022 Progiseize * From 44215be43443062881c48b645563ed00149e0083 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 30 Dec 2022 11:10:11 +0100 Subject: [PATCH 105/370] FIX reload stickler-ci From 5b94ee35daaf680089adf90b20db405c4cfaaacd Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:04:55 +0100 Subject: [PATCH 106/370] update code toward php8 compliance --- htdocs/bom/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index e644c7813e7..96a179b93f3 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -73,7 +73,7 @@ if ($nolinesbefore) { print ''; if ($filtertype != 1) { - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; From e5f08f69840a22e4a7cdd9e4a02a97f089b355e8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:07:05 +0100 Subject: [PATCH 107/370] update code toward php8 compliance --- htdocs/bom/tpl/objectline_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 88463996ebc..969b210e89b 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -126,7 +126,7 @@ if (($line->info_bits & 2) != 2) { print ''; if ($filtertype != 1) { - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $coldisplay++; print ''; From 32c161e576f40ab4100f9d35200528a7ed7ab486 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 12:10:23 +0100 Subject: [PATCH 108/370] Fix warnings --- htdocs/accountancy/class/accountancycategory.class.php | 4 ++-- htdocs/api/index.php | 4 ++-- htdocs/blockedlog/class/authority.class.php | 2 +- htdocs/core/class/dolgeoip.class.php | 4 ++-- htdocs/emailcollector/class/emailcollector.class.php | 2 +- htdocs/mailmanspip/class/mailmanspip.class.php | 8 +++----- htdocs/product/class/html.formproduct.class.php | 6 ++---- htdocs/webservices/server_productorservice.php | 2 +- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 300ccff9c09..e6c4ff45922 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -446,7 +446,7 @@ class AccountancyCategory // extends CommonObject } else { $this->error = "Error ".$this->db->lasterror(); $this->errors[] = $this->error; - dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR); + dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR); return -1; } @@ -488,7 +488,7 @@ class AccountancyCategory // extends CommonObject } else { $this->error = "Error ".$this->db->lasterror(); $this->errors[] = $this->error; - dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR); + dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR); return -1; } diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 085dd338e69..ba195b82c08 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -413,9 +413,9 @@ $result = $api->r->handle(); if (Luracast\Restler\Defaults::$returnResponse) { // We try to compress the data received data - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress') && defined('BROTLI_TEXT')) { header('Content-Encoding: br'); - $result = brotli_compress($result, 11, BROTLI_TEXT); + $result = brotli_compress($result, 11, constant('BROTLI_TEXT')); } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) { header('Content-Encoding: bz'); $result = bzcompress($result, 9); diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 7240aaf0151..0b665fedc3e 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -304,7 +304,7 @@ class BlockedLogAuthority $url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature; $res = getURLContent($url); - echo $block->signature.' '.$url.' '.$res.'
'; + echo $block->signature.' '.$url.' '.$res['content'].'
'; if ($res === 'blockalreadyadded' || $res === 'blockadded') { $block->setCertified(); } else { diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index b4218bbfd40..24726fec7c3 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -86,8 +86,8 @@ class DolGeoIP dol_syslog('DolGeoIP '.$this->errorlabel, LOG_ERR); return 0; } - } elseif (function_exists('geoip_open')) { - $this->gi = geoip_open($datfile, GEOIP_STANDARD); + } elseif (function_exists('geoip_open') && defined('GEOIP_STANDARD')) { + $this->gi = geoip_open($datfile, constant('GEOIP_STANDARD')); } elseif (function_exists('geoip_country_code_by_name')) { $this->gi = 'NOGI'; // We are using embedded php geoip functions //print 'function_exists(geoip_country_code_by_name))='.function_exists('geoip_country_code_by_name'); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 8d72666ad53..4d7ef042e69 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2305,7 +2305,7 @@ class EmailCollector extends CommonObject 'class' => 'compta/facture/class/facture.class.php', 'object' => 'Facture'), 'fournisseur/facture' => array('table' => 'facture_fourn', - 'fields' => array('ref', ref_client), + 'fields' => array('ref', 'ref_client'), 'class' => 'fourn/class/fournisseur.facture.class.php', 'object' => 'FactureFournisseur'), 'produit' => array('table' => 'product', diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index bcfb1b83d6e..46701a459a6 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -77,7 +77,7 @@ class MailmanSpip */ public function isSpipEnabled() { - if (defined("ADHERENT_USE_SPIP") && (ADHERENT_USE_SPIP == 1)) { + if (getDolGlobalInt("ADHERENT_USE_SPIP") == 1) { return true; } @@ -91,10 +91,8 @@ class MailmanSpip */ public function checkSpipConfig() { - if (defined('ADHERENT_SPIP_SERVEUR') && defined('ADHERENT_SPIP_USER') && defined('ADHERENT_SPIP_PASS') && defined('ADHERENT_SPIP_DB')) { - if (ADHERENT_SPIP_SERVEUR != '' && ADHERENT_SPIP_USER != '' && ADHERENT_SPIP_PASS != '' && ADHERENT_SPIP_DB != '') { - return true; - } + if (getDolGlobalString('ADHERENT_SPIP_SERVEUR') != '' && getDolGlobalString('ADHERENT_SPIP_USER') != '' && getDolGlobalString('ADHERENT_SPIP_PASS') != '' && getDolGlobalString('ADHERENT_SPIP_DB') != '') { + return true; } return false; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 75a929f53e5..b4da53f4635 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -781,9 +781,7 @@ class FormProduct */ public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array()) { - global $conf, $langs; - - dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot,$objectLines", LOG_DEBUG); + dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot", LOG_DEBUG); $out = ''; $productIdArray = array(); @@ -817,7 +815,7 @@ class FormProduct if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) { $label = $arraytypes['entrepot_label'] . ' - '; $label .= $arraytypes['batch']; - $out .= ''; + $out .= ''; } } } diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 25eeec6430f..bf46b063e64 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -962,7 +962,7 @@ function getListOfProductsOrServices($authentication, $filterproduct) * Get list of products for a category * * @param array $authentication Array of authentication information - * @param array $id Category id + * @param int $id Category id * @param Translate $lang Force lang * @return array Array result */ From 8abde17e954f17ff94d84a32865cfa566c407aac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 12:15:18 +0100 Subject: [PATCH 109/370] Fix warning --- htdocs/core/modules/DolibarrModules.class.php | 4 ++-- htdocs/product/card.php | 4 ++-- qodana.yaml | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 7297b17a6b7..afc19a12e92 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -299,10 +299,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $picto; /** - * @var string[] List of config pages + * @var string[]|string List of config pages (Old modules uses a string. New one must use an array) * * Name of php pages stored into module/admin directory, used to setup module. - * e.g.: "admin.php@module" + * e.g.: array("setup.php@mymodule") */ public $config_page_url; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5574984b5fd..031dccadc53 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -541,7 +541,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; $mesg = 'Failed to get bar code type information '; - setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors'); + setEventMessages($mesg.$stdobject->error, $stdobject->errors, 'errors'); } $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; @@ -780,7 +780,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; $mesg = 'Failed to get bar code type information '; - setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors'); + setEventMessages($mesg.$stdobject->error, $stdobject->errors, 'errors'); } $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; diff --git a/qodana.yaml b/qodana.yaml index 08dc6c18395..b1a76747a5b 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -61,4 +61,5 @@ exclude: - name: PhpClassConstantAccessedViaChildClassInspection - name: RegExpUnnecessaryNonCapturingGroup - name: PhpPregMatchReplaceWithComparisonInspection - - name: PhpArrayWriteIsNotUsedInspection \ No newline at end of file + - name: PhpArrayWriteIsNotUsedInspection + - name: PhpUndefinedNamespaceInspection \ No newline at end of file From c6dc5989445d78e9e47998ff3b4694799abedd10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 12:39:09 +0100 Subject: [PATCH 110/370] Add qodana as github action --- .github/workflows/code_quality.yml | 18 ++++++++++++++++++ .../{exakat.yml => exakat.yml.disabled} | 0 2 files changed, 18 insertions(+) create mode 100644 .github/workflows/code_quality.yml rename .github/workflows/{exakat.yml => exakat.yml.disabled} (100%) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml new file mode 100644 index 00000000000..ef097e161e7 --- /dev/null +++ b/.github/workflows/code_quality.yml @@ -0,0 +1,18 @@ +name: Qodana +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + - 'releases/*' + +jobs: + qodana: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2022.3.0 diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml.disabled similarity index 100% rename from .github/workflows/exakat.yml rename to .github/workflows/exakat.yml.disabled From 218f1c8cc3968c43f2a3a04dee05263c3c9bd160 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 12:40:01 +0100 Subject: [PATCH 111/370] Fix qodana script --- .github/workflows/code_quality.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index ef097e161e7..e39ffc4fa12 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -4,8 +4,7 @@ on: pull_request: push: branches: - - main - - 'releases/*' + - develop jobs: qodana: From 081cfcc137aadfe986b0e31ce291b8c198c9a566 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 12:42:45 +0100 Subject: [PATCH 112/370] Add missing secret key --- .github/workflows/code_quality.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index e39ffc4fa12..b27b64428e7 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -15,3 +15,5 @@ jobs: fetch-depth: 0 - name: 'Qodana Scan' uses: JetBrains/qodana-action@v2022.3.0 + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} \ No newline at end of file From f6765fcd982c1d65849fb79f1875c0d5a5ac913f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:43:12 +0100 Subject: [PATCH 113/370] update code toward php8 compliance --- htdocs/bom/tpl/objectline_title.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index 5252baf61ca..0ede4190279 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -67,7 +67,7 @@ print ''; print '
'; if ($filtertype != 1) { - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } From 4c51b2bb6bdca3d1ae70d720d569a9fbec117c49 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:43:57 +0100 Subject: [PATCH 114/370] update code toward php8 compliance --- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index b7087b27288..d20692ac99a 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -119,7 +119,7 @@ echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but print ''; if ($filtertype != 1) { - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; //} print ''; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } print ''; @@ -1594,7 +1594,7 @@ if ($action == 'create') { // Quantity print ''; // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } // Discount @@ -1739,7 +1739,7 @@ if ($action == 'create') { print ''; // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; @@ -1765,7 +1765,7 @@ if ($action == 'create') { if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { $colspan++; } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $colspan++; } From c46e55aaeb503ad5a4d94dfda28eee67073f4ec2 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:45:22 +0100 Subject: [PATCH 116/370] update code toward php8 compliance --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 82012400f68..076a9682ff5 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -651,7 +651,7 @@ abstract class CommonDocGenerator ); // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $resarray['line_unit'] = $outputlangs->trans($line->getLabelOfUnit('long')); $resarray['line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit('short')); } From 5f3cea32f1d2ff8caf29f0d9331a8efd2a27e553 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:45:54 +0100 Subject: [PATCH 117/370] update code toward php8 compliance --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d9b86ae01da..2a7fb703dac 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5100,7 +5100,7 @@ abstract class CommonObject print ''; } print ''; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } print ''; @@ -5238,7 +5238,7 @@ abstract class CommonObject $this->tpl['total_ht'] = price($line->total_ht); $this->tpl['multicurrency_price'] = price($line->multicurrency_subprice); $this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' '; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->tpl['unit'] = $langs->transnoentities($line->getLabelOfUnit('long')); } $this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' '; From 6617d595a6b1ed76e08aebdcfdf7280fee0cb96b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:46:43 +0100 Subject: [PATCH 118/370] update code toward php8 compliance --- htdocs/core/class/html.form.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3a566b6014..d7ce577acb6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2545,7 +2545,7 @@ class Form $outarray = array(); // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $langs->load('other'); } @@ -2589,7 +2589,7 @@ class Form $selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custdefault_vat_code, custref"; } // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units"; $selectFields .= ', unit_long, unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units'; } @@ -2634,7 +2634,7 @@ class Form $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; } // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; } // Multilang : we add translation @@ -2941,7 +2941,7 @@ class Form // Units $outvalUnits = ''; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { if (!empty($objp->unit_short)) { $outvalUnits .= ' - '.$objp->unit_short; } @@ -3277,7 +3277,7 @@ class Form $langs->load('stocks'); // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $langs->load('other'); } @@ -3292,7 +3292,7 @@ class Form $sql .= ", p.description"; } // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units"; } if (isModEnabled('barcode')) { @@ -3305,7 +3305,7 @@ class Form } $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; @@ -3398,7 +3398,7 @@ class Form // Units $outvalUnits = ''; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { if (!empty($objp->unit_short)) { $outvalUnits .= ' - '.$objp->unit_short; } From 19796c9db1da40a0a8ff51aa27e9accfe9b04d20 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:47:18 +0100 Subject: [PATCH 119/370] update code toward php8 compliance --- htdocs/core/modules/modProduct.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 5224f82a2f5..16906c95f86 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -233,7 +233,7 @@ class modProduct extends DolibarrModules if (getDolGlobalInt('MAIN_MULTILANGS')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote')); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; } $this->export_TypeFields_array[$r] = array( @@ -640,7 +640,7 @@ class modProduct extends DolibarrModules if (isModEnabled('barcode')) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode')); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; } @@ -724,7 +724,7 @@ class modProduct extends DolibarrModules if (isModEnabled('barcode')) { $import_sample = array_merge($import_sample, array('p.barcode'=>'')); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $import_sample = array_merge( $import_sample, array( From 7cc97b2b09a11210d3e64906402ebe1418f75fc6 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:47:52 +0100 Subject: [PATCH 120/370] update code toward php8 compliance --- htdocs/core/modules/modService.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 868303c231b..a316c746acb 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -198,7 +198,7 @@ class modService extends DolibarrModules if (getDolGlobalInt('MAIN_MULTILANGS')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote')); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; } $this->export_TypeFields_array[$r] = array( @@ -587,7 +587,7 @@ class modService extends DolibarrModules if (isModEnabled('barcode')) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode')); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; } // Add extra fields @@ -678,7 +678,7 @@ class modService extends DolibarrModules if (isModEnabled('barcode')) { $import_sample = array_merge($import_sample, array('p.barcode'=>'')); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $import_sample = array_merge( $import_sample, array( From 9d5670faa8a2849aed650cce66d25c08caa28be3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:48:27 +0100 Subject: [PATCH 121/370] update code toward php8 compliance --- htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 2bdda4421dc..8ebd1051a06 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -1319,7 +1319,7 @@ class pdf_standard_asset extends ModelePDFAsset ), 'border-left' => true, // add left line separator ); - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } From e8fe061071d0a322d8fa45ff78869993264612a3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:49:02 +0100 Subject: [PATCH 122/370] update code toward php8 compliance --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 4bfb6f93413..6fe07506958 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -173,7 +173,7 @@ class pdf_einstein extends ModelePDFCommandes // Define position of columns $this->posxdesc = $this->marge_gauche + 1; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxtva = 101; $this->posxup = 118; $this->posxqty = 135; @@ -509,7 +509,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -1238,7 +1238,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); From c3d75cb1d4ac561f8e5365b4f1d3994677595e91 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:49:31 +0100 Subject: [PATCH 123/370] update code toward php8 compliance --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 584795d37e6..8614238c2c7 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1866,7 +1866,7 @@ class pdf_eratosthene extends ModelePDFCommandes ), 'border-left' => true, // add left line separator ); - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } From 9ad1f6df196ceff263aca7490c8e4bed32a897fb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:50:17 +0100 Subject: [PATCH 124/370] update code toward php8 compliance --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 20504da255c..f223771900b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -180,7 +180,7 @@ class pdf_crabe extends ModelePDFFactures // Define position of columns $this->posxdesc = $this->marge_gauche + 1; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxtva = 101; $this->posxup = 118; $this->posxqty = 135; @@ -677,7 +677,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -1710,7 +1710,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); From e3b724b6fa5022e4bd074db42a1778e3a806831c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:50:42 +0100 Subject: [PATCH 125/370] update code toward php8 compliance --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5a206410aa7..e61d438c8a5 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2593,7 +2593,7 @@ class pdf_sponge extends ModelePDFFactures ), 'border-left' => true, // add left line separator ); - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } From a990d4df19c3e20749fdd3a31e45209d5d788b02 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:52:20 +0100 Subject: [PATCH 126/370] update code toward php8 compliance --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 6b16ac1c1b0..ff5283e2bb8 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -169,7 +169,7 @@ class pdf_azur extends ModelePDFPropales // Define position of columns $this->posxdesc = $this->marge_gauche + 1; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxtva = 101; $this->posxup = 118; $this->posxqty = 135; @@ -620,7 +620,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -1437,7 +1437,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); From 42e8740a8d9a501c972899dffceb4480309e6b45 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:53:07 +0100 Subject: [PATCH 127/370] update code toward php8 compliance --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 2cf90351cd0..753e1511197 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -2009,7 +2009,7 @@ class pdf_cyan extends ModelePDFPropales ), 'border-left' => true, // add left line separator ); - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } From 5f240db64d6e6adf4729ae9a06c9664d09c2014e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:53:42 +0100 Subject: [PATCH 128/370] update code toward php8 compliance --- .../modules/supplier_invoice/doc/pdf_canelle.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index f81cc03009b..802abd6a184 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -161,7 +161,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->posxdiscount = 162; $this->postotalht = 174; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxtva = 99; $this->posxup = 114; $this->posxqty = 130; @@ -480,7 +480,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -932,7 +932,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); From 44182f6e50dbda98b3fd8a1da15fc9366367286d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:54:28 +0100 Subject: [PATCH 129/370] update code toward php8 compliance --- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index c83863339c2..186ea465568 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1623,7 +1623,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders ), 'border-left' => true, // add left line separator ); - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } From b2f1ac3c73e198d73509df4c18eb8c97b3535534 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:55:00 +0100 Subject: [PATCH 130/370] update code toward php8 compliance --- .../modules/supplier_order/doc/pdf_muscadet.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 5754561c707..226c9dc6efa 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -169,7 +169,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->posxdiscount = 162; $this->postotalht = 174; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxtva = 95; $this->posxup = 114; $this->posxqty = 132; @@ -552,7 +552,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -1097,7 +1097,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); From 5256f30c3d3dbbbb9d4a3c4733c024c5ecd965be Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:55:28 +0100 Subject: [PATCH 131/370] update code toward php8 compliance --- .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index c844aec2c61..8e25a227ad7 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -167,7 +167,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxdiscount = 162; $this->postotalht = 174; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxup = 112; $this->posxqty = 135; $this->posxunit = 151; @@ -527,7 +527,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -1200,7 +1200,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); From b407712e5aae4996e12e6fca56ea6ffb90eb022c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:55:53 +0100 Subject: [PATCH 132/370] update code toward php8 compliance --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f008aacc10e..8c6cf1b9b7a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -127,7 +127,7 @@ if ($nolinesbefore) { global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print 'global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $coldisplay++; print ''; } diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 965566c3a74..deb4b0da346 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -473,14 +473,14 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type']== 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -500,7 +500,7 @@ if ($action == 'edit') { $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; } } - print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1); } elseif (preg_match('/category:/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -508,11 +508,11 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); } elseif (preg_match('/thirdparty_type/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $formcompany = new FormCompany($db); - print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); + print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname); } elseif ($val['type'] == 'securekey') { print ''; if (!empty($conf->use_javascript_ajax)) { @@ -524,11 +524,11 @@ if ($action == 'edit') { print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); } elseif ($val['type'] == 'product') { if (isModEnabled("product") || isModEnabled("service")) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); $form->select_produits($selected, $constname, '', 0); } } elseif ($val['type'] == 'accountancy_code') { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $formaccounting = new FormAccounting($db); @@ -537,7 +537,7 @@ if ($action == 'edit') { print ''; } } elseif ($val['type'] == 'accountancy_category') { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); if (isModEnabled('accounting')) { print ''; // autosuggest from existing account types if found @@ -587,9 +587,9 @@ if ($action == 'edit') { print '"; if ($tmpobj->total_ttc < 0) { print '"; - }; + } if ($tmpobj->total_ttc >= 0) { print '"; - }; + } print ''; print ""; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e28e5427c0b..14f82abe1a4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3357,7 +3357,7 @@ if ($action == 'create') { jQuery(".checkforselect").prop("disabled", false); jQuery(".checkforselect").prop("checked", true); } - }; + } }); '; @@ -3780,7 +3780,7 @@ if ($action == 'create') { if ($soc->fetch_optionals() > 0) { $object->array_options = array_merge($object->array_options, $soc->array_options); } - }; + } print $object->showOptionals($extrafields, 'create', $parameters); } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index e7c7678b818..1cd655603bc 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -405,7 +405,7 @@ if ($action == 'create') { $("#label_type_payment").removeClass("fieldrequired"); $(".hide_if_no_auto_create_payment").hide(); } - }; + } $("#radiopayment").click(function() { $("#label").val($(this).data("label")); }); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 82012400f68..88ee43fd713 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -687,7 +687,7 @@ abstract class CommonDocGenerator $resql = $this->db->fetch_object($resql); foreach ($extralabels as $key => $label) { - $resarray['line_product_supplier_'.$key] = $resql->{$key}; + $resarray['line_product_supplier_'.$key] = $resql->$key; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 686d500875a..a6eac03cadc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8228,7 +8228,7 @@ class Form return { q: params.term, // search term page: params.page - }; + } }, processResults: function (data) { // parse the results into the format expected by Select2. @@ -8480,14 +8480,14 @@ class Form $out .= 'function formatResult(record, container) {'."\n"; $out .= ' if ($(record.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(record.element).attr("data-html")); // If property html set, we decode html entities and use this'."\n"; $out .= ' return record.text;'; - $out .= '};'."\n"; + $out .= '}'."\n"; $out .= 'function formatSelection(record) {'."\n"; if ($elemtype == 'category') { $out .= 'return \' \'+record.text+\'\';'; } else { $out .= 'return record.text;'; } - $out .= '};'."\n"; + $out .= '}'."\n"; $out .= '$(document).ready(function () { $(\'#'.$htmlname.'\').'.$tmpplugin.'({'; if ($placeholder) { diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 364a638e13f..90c9857992a 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -115,7 +115,7 @@ class FormActions $('.hideifna').show(); } else { - if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) }; + if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50); } percentage.removeAttr('disabled'); $('.hideifna').show(); } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 5f27cbf3477..82ab8031155 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -690,7 +690,7 @@ class FormCompany extends Form } } ); - }; + } }); '; } diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index c57ee0c5106..eb389454f82 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -662,7 +662,7 @@ class FormSetupItem { global $conf; if (isset($conf->global->{$this->confKey})) { - $this->fieldValue = $conf->global->{$this->confKey}; + $this->fieldValue = getDolGlobalString($this->confKey); return true; } else { $this->fieldValue = null; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index eb0c7668d8c..0aa2c39de91 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -362,7 +362,7 @@ class FormTicket print ''; } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e1699660acc..f204acd4747 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -1039,4 +1039,4 @@ class ImportCsv extends ModeleImports function cleansep($value) { return str_replace(array(',', ';'), '/', $value); -}; +} diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f008aacc10e..69e5795a881 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -511,7 +511,7 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); print ' '.$langs->trans('to').' '; print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); - }; + } if ($prefillDates) { echo ' '.$langs->trans('FillWithLastServiceDates').''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b193048047a..43262e4f3e3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2212,7 +2212,7 @@ if ($action == 'create') { jQuery(".checkforselect").prop("disabled", false); jQuery(".checkforselect").prop("checked", true); } - }; + } }); '; diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index 686d5820695..d1dde23a63c 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -319,11 +319,11 @@ function rate(&$TMergedSkills, $field) foreach ($TMergedSkills as $id => &$sk) { $class = "note"; $how_many = 0; - if (empty($sk->{$field})) { + if (empty($sk->$field)) { $note = 'x'; $class .= ' none'; } else { - $note = $sk->{$field}; + $note = $sk->$field; $how_many = ($field === 'rate1') ? $sk->how_many_max1 : $sk->how_many_max2; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 9a33bd25c05..579fdb74c4a 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1354,7 +1354,7 @@ if ($step == 4 && $datatoimport) { print ' $("select.targetselectchange").find(\'option[value="\'+value+\'"]:not(:selected)\').prop("disabled", true);'."\n"; // Set to disabled except if currently selected print ' }'."\n"; print ' });'."\n"; - print '};'."\n"; + print '}'."\n"; // Function to save the selection in database print 'function saveSelection() {'."\n"; @@ -1402,7 +1402,7 @@ if ($step == 4 && $datatoimport) { } "; - print '};'."\n"; + print '}'."\n"; // If we make a change on a selectbox print '$(".targetselectchange").change(function(){'."\n"; diff --git a/htdocs/index.php b/htdocs/index.php index 06a829ea4b5..e0001adba5e 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -806,23 +806,15 @@ function getWeatherStatus($totallate) $used_conf = empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_LEVEL' : 'MAIN_METEO_PERCENTAGE_LEVEL'; - $level0 = $offset; $weather->level = 0; - if (!empty($conf->global->{$used_conf.'0'})) { - $level0 = $conf->global->{$used_conf.'0'}; - } + $level0 = $offset; + $level0 = getDolGlobalString($used_conf.'0', $level0); $level1 = $offset + 1 * $factor; - if (!empty($conf->global->{$used_conf.'1'})) { - $level1 = $conf->global->{$used_conf.'1'}; - } + $level1 = getDolGlobalString($used_conf.'1', $level1); $level2 = $offset + 2 * $factor; - if (!empty($conf->global->{$used_conf.'2'})) { - $level2 = $conf->global->{$used_conf.'2'}; - } + $level2 = getDolGlobalString($used_conf.'2', $level2); $level3 = $offset + 3 * $factor; - if (!empty($conf->global->{$used_conf.'3'})) { - $level3 = $conf->global->{$used_conf.'3'}; - } + $level3 = getDolGlobalString($used_conf.'3', $level3); if ($totallate <= $level0) { $weather->picto = 'weather-clear.png'; diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 8f7764ad100..c51bc01376c 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -107,7 +107,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers ); return call_user_func($callback, $action, $object, $user, $langs, $conf); - }; + } // Or you can execute some code here switch ($action) { diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 8b42f7cb25b..4305aed6f3b 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -615,8 +615,8 @@ class MultiCurrency extends CommonObject if ($conf->currency != $conf->global->MULTICURRENCY_APP_SOURCE) { $alternate_source = 'USD'.$conf->currency; - if (!empty($TRate->{$alternate_source})) { - $coef = $TRate->USDUSD / $TRate->{$alternate_source}; + if (!empty($TRate->$alternate_source)) { + $coef = $TRate->USDUSD / $TRate->$alternate_source; foreach ($TRate as $attr => &$rate) { $rate *= $coef; } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 0424ddaf830..788857dfd47 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1529,7 +1529,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { otherPrices.show(); minPrice1.show(); } - }; + } jQuery(document).ready(function () { showHidePriceRules(); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d1644623ce1..2520eb8f559 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -78,12 +78,12 @@ while ($tmpobj = $db->fetch_object($resWar)) { $listofqualifiedwarehousesid .= $tmpobj->rowid; $lastWarehouseID = $tmpobj->rowid; $count++; -}; +} //MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { $fk_entrepot = $lastWarehouseID; -}; +} $texte = ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e7467176c10..96b4aa0b03b 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -968,7 +968,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked")); jQuery(".classuseopportunity").hide(); } - }; + } });'; print ''; print '
'; @@ -994,7 +994,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide task fields "+jQuery("#usage_task").prop("checked")); jQuery(".classusetask").hide(); } - }; + } });'; print ''; print '
'; @@ -1020,7 +1020,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked")); jQuery(".classusebilltime").hide(); } - }; + } });'; print ''; print '
'; @@ -1046,7 +1046,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked")); jQuery(".classuseorganizeevent").hide(); } - }; + } });'; print ''; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 91333c153f8..458921adfc6 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1025,7 +1025,8 @@ class Task extends CommonObjectLine if (!empty($extrafields->attributes['projet']['label'])) { foreach ($extrafields->attributes['projet']['label'] as $key => $val) { if ($extrafields->attributes['projet']['type'][$key] != 'separate') { - $tasks[$i]->{'options_'.$key} = $obj->{'options_'.$key}; + $tmpvar = 'options_'.$key; + $tasks[$i]->{'options_'.$key} = $obj->$tmpvar; } } } @@ -1033,7 +1034,8 @@ class Task extends CommonObjectLine if (!empty($extrafields->attributes['projet_task']['label'])) { foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) { if ($extrafields->attributes['projet_task']['type'][$key] != 'separate') { - $tasks[$i]->{'options_'.$key} = $obj->{'options_'.$key}; + $tmpvar = 'options_'.$key; + $tasks[$i]->{'options_'.$key} = $obj->$tmpvar; } } } diff --git a/htdocs/projet/jsgantt_language.js.php b/htdocs/projet/jsgantt_language.js.php index 35ab1132ae7..93b9ee5505f 100644 --- a/htdocs/projet/jsgantt_language.js.php +++ b/htdocs/projet/jsgantt_language.js.php @@ -67,7 +67,7 @@ var vLangs={'getDefaultLang(1); ?>': 'sunday':'transnoentities('Sunday'); ?>','monday':'transnoentities('Monday'); ?>','tuesday':'transnoentities('Tuesday'); ?>','wednesday':'transnoentities('Wednesday'); ?>','thursday':'transnoentities('Thursday'); ?>','friday':'transnoentities('Friday'); ?>','saturday':'transnoentities('Saturday'); ?>', 'sun':'transnoentities('SundayMin'); ?>','mon':'transnoentities('MondayMin'); ?>','tue':'transnoentities('TuesdayMin'); ?>','wed':'transnoentities('WednesdayMin'); ?>','thu':'transnoentities('ThursdayMin'); ?>','fri':'transnoentities('FridayMin'); ?>','sat':'transnoentities('SaturdayMin'); ?>' } -}; +} var vLang='getDefaultLang(1); ?>'; global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW if (jQuery("#morphy").val() == \'mor\') { jQuery("#trcompany").show(); } - }; + } initmorphy(); jQuery("#morphy").change(function() { initmorphy(); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 79104817e77..e9823f2d0f7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2395,7 +2395,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme color: '#fa755a', iconColor: '#fa755a' } - }; + } var cardElement = elements.create('card', {style: style}); @@ -2435,7 +2435,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme ?> var cardButton = document.getElementById('buttontopay'); var clientSecret = cardButton.dataset.secret; - var options = { clientSecret: clientSecret,}; + var options = { clientSecret: clientSecret }; // Create an instance of Elements var elements = stripe.elements(options); @@ -2465,7 +2465,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme color: '#fa755a', iconColor: '#fa755a' } - }; + } displayCanvasExists($action)) { data: function (params) { return { newcompany: params.term // search term - }; + } }, processResults: function (data, params) { return { results: data - }; + } }, cache: true }, @@ -2150,7 +2150,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { { jQuery(".visibleifsupplier").show(); } - }; + } $("#selectcountry_id").change(function() { document.formsoc.action.value="edit"; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index fe03139c8a3..f93608d20b8 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -268,7 +268,7 @@ if (isModEnabled('stock')) { } print ''; - $disabled = $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}; + $disabled = getDolGlobalString('CASHDESK_NO_DECREASE_STOCK'.$terminal); print ''; // Force warehouse (this is not a default value) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dc2bd8b684a..fb3049715cf 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -956,7 +956,7 @@ $( document ).ready(function() { return { vertical:container.scrollHeight > container.clientHeight, horizontal:container.scrollWidth > container.clientWidth - }; + } } $(window).resize(function(){ diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ccc1fde97eb..ea262a1562f 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -174,12 +174,12 @@ if (empty($reshook)) { $bankaccount = GETPOST('accountid', 'int'); } else { if ($pay == 'LIQ') { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility } elseif ($pay == "CHQ") { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility } else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; - $bankaccount = $conf->global->$accountname; + $bankaccount = getDolGlobalString($accountname); } } @@ -217,13 +217,6 @@ if (empty($reshook)) { $invoice->update($user); } - //$sav_FACTURE_ADDON = ''; - //if (!empty($conf->global->TAKEPOS_ADDON)) { - // $sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON; - // if ($conf->global->TAKEPOS_ADDON == "terminal") $conf->global->FACTURE_ADDON = $conf->global->{'TAKEPOS_ADDON'.$_SESSION["takeposterminal"]}; - // else $conf->global->FACTURE_ADDON = $conf->global->TAKEPOS_ADDON; - //} - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; if ($error) { dol_htmloutput_errors($errormsg, null, 1); diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index 505ec27c1b0..6ce39d39bf0 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -71,7 +71,7 @@ if (GETPOST('smp-status')) { print ''; print "Transaction status registered, you can close this"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 52a9f941cfe..4e90bbb1bd9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3371,24 +3371,36 @@ class User extends CommonObject $socialnetworks = getArrayOfSocialNetworks(); - $this->firstname = $ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME}; - $this->lastname = $ldapuser->{$conf->global->LDAP_FIELD_NAME}; - $this->login = $ldapuser->{$conf->global->LDAP_FIELD_LOGIN}; - $this->pass = $ldapuser->{$conf->global->LDAP_FIELD_PASSWORD}; - $this->pass_indatabase_crypted = $ldapuser->{$conf->global->LDAP_FIELD_PASSWORD_CRYPTED}; + $tmpvar = getDolGlobalString('LDAP_FIELD_FIRSTNAME'); + $this->firstname = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_NAME'); + $this->lastname = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_LOGIN'); + $this->login = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_PASSWORD'); + $this->pass = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED'); + $this->pass_indatabase_crypted = $ldapuser->$tmpvar; - $this->office_phone = $ldapuser->{$conf->global->LDAP_FIELD_PHONE}; - $this->user_mobile = $ldapuser->{$conf->global->LDAP_FIELD_MOBILE}; - $this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX}; - $this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL}; + $tmpvar = getDolGlobalString('LDAP_FIELD_PHONE'); + $this->office_phone = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_MOBILE'); + $this->user_mobile = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_FAX'); + $this->office_fax = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_MAIL'); + $this->email = $ldapuser->$tmpvar; foreach ($socialnetworks as $key => $value) { - $tmpkey = 'LDAP_FIELD_'.strtoupper($value['label']); - $this->socialnetworks[$value['label']] = $ldapuser->{$conf->global->$tmpkey}; + $tmpvar = getDolGlobalString('LDAP_FIELD_'.strtoupper($value['label'])); + $this->socialnetworks[$value['label']] = $ldapuser->$tmpvar; } - $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; + $tmpvar = getDolGlobalString('LDAP_FIELD_SID'); + $this->ldap_sid = $ldapuser->$tmpvar; - $this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE}; - $this->note_public = $ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION}; + $tmpvar = getDolGlobalString('LDAP_FIELD_TITLE'); + $this->job = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_DESCRIPTION'); + $this->note_public = $ldapuser->$tmpvar; $result = $this->update($user); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 800c2e0e2a2..1fe15576860 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -736,7 +736,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { if (isset($obj->{$key})) { - $extrafieldsOptions['options_'.$key] = $obj->{$key}; + $extrafieldsOptions['options_'.$key] = $obj->$key; } } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ae3362ab9d6..2cb775019e6 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3294,7 +3294,7 @@ if (!GETPOST('hide_websitemenu')) { } isEditingEnabled = false; } - }; + } }); '; print $langs->trans("EditInLine"); From 0db5c98941af8e63aa64b2fb67d952f16a8222bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 18:46:36 +0100 Subject: [PATCH 150/370] Clean code --- htdocs/societe/card.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a5b6f21b31b..bb9d2376a47 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3313,11 +3313,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); } - - // Addresses list - if (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) { - $result = show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); - } } } From 67fea77e07023e9c9e3d7c368d3891d536193783 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 18:48:45 +0100 Subject: [PATCH 151/370] Fix warning --- htdocs/takepos/invoice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ccc1fde97eb..4dcd9645350 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -174,12 +174,12 @@ if (empty($reshook)) { $bankaccount = GETPOST('accountid', 'int'); } else { if ($pay == 'LIQ') { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility } elseif ($pay == "CHQ") { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility } else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; - $bankaccount = $conf->global->$accountname; + $bankaccount = getDolGlobalString($accountname); } } From c593d990e458305ca1efc967effa7356befe5d60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 18:52:19 +0100 Subject: [PATCH 152/370] Clean deprecated code for adodbtime --- htdocs/core/lib/functions.lib.php | 102 +++++++----------- .../class/partnershiputils.class.php | 2 +- 2 files changed, 42 insertions(+), 62 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f67a0e3909..de329ee515f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2647,12 +2647,6 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = str_replace('%A', '__A__', $format); } - $useadodb = getDolGlobalInt('MAIN_USE_LEGACY_ADODB_FOR_DATE', 0); - //$useadodb = 1; // To switch to adodb - if (!empty($useadodb)) { - include_once DOL_DOCUMENT_ROOT.'/includes/adodbtime/adodb-time.inc.php'; - } - // Analyze date $reg = array(); if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 @@ -2671,14 +2665,37 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $ssec = (!empty($reg[6]) ? $reg[6] : ''); $time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true); - if (empty($useadodb)) { + + if ($to_gmt) { + $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC + } else { + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server + } + $dtts = new DateTime(); + $dtts->setTimestamp($time); + $dtts->setTimezone($tzo); + $newformat = str_replace( + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + $format); + $ret = $dtts->format($newformat); + $ret = str_replace( + array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('T', 'Z', '__a__', '__A__', '__b__', '__B__'), + $ret + ); + } else { + // Date is a timestamps + if ($time < 100000000000) { // Protection against bad date values + $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring. + if ($to_gmt) { $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC } else { $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server } $dtts = new DateTime(); - $dtts->setTimestamp($time); + $dtts->setTimestamp($timetouse); $dtts->setTimezone($tzo); $newformat = str_replace( array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), @@ -2688,36 +2705,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $ret = str_replace( array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), array('T', 'Z', '__a__', '__A__', '__b__', '__B__'), - $ret); - } else { - $ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt); - } - } else { - // Date is a timestamps - if ($time < 100000000000) { // Protection against bad date values - $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring. - - if (empty($useadodb)) { - if ($to_gmt) { - $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC - } else { - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server - } - $dtts = new DateTime(); - $dtts->setTimestamp($timetouse); - $dtts->setTimezone($tzo); - $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), - $format); - $ret = $dtts->format($newformat); - $ret = str_replace( - array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), - array('T', 'Z', '__a__', '__A__', '__b__', '__B__'), - $ret); - } else { - $ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server - } + $ret + ); //var_dump($ret);exit; } else { $ret = 'Bad value '.$time.' for date'; @@ -2727,20 +2716,15 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = if (preg_match('/__b__/i', $format)) { $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring. - if (empty($useadodb)) { - if ($to_gmt) { - $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC - } else { - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server - } - $dtts = new DateTime(); - $dtts->setTimestamp($timetouse); - $dtts->setTimezone($tzo); - $month = $dtts->format("m"); + if ($to_gmt) { + $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC } else { - // After this ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. - $month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server } + $dtts = new DateTime(); + $dtts->setTimestamp($timetouse); + $dtts->setTimezone($tzo); + $month = $dtts->format("m"); $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. if ($encodetooutput) { $monthtext = $outputlangs->transnoentities('Month'.$month); @@ -2759,19 +2743,15 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = //print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring"; $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - if (empty($useadodb)) { - if ($to_gmt) { - $tzo = new DateTimeZone('UTC'); - } else { - $tzo = new DateTimeZone(date_default_timezone_get()); - } - $dtts = new DateTime(); - $dtts->setTimestamp($timetouse); - $dtts->setTimezone($tzo); - $w = $dtts->format("w"); + if ($to_gmt) { + $tzo = new DateTimeZone('UTC'); } else { - $w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server + $tzo = new DateTimeZone(date_default_timezone_get()); } + $dtts = new DateTime(); + $dtts->setTimestamp($timetouse); + $dtts->setTimezone($tzo); + $w = $dtts->format("w"); $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); $ret = str_replace('__A__', $dayweek, $ret); diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 647d1492ced..86722ed1da2 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -395,7 +395,7 @@ class PartnershipUtils /** * Action to check if Dolibarr backlink not found on partner website * - * @param $website Website Partner's website + * @param string $website Partner's website URL * @return int 0 if KO, 1 if OK */ private function checkDolibarrBacklink($website = null) From 9e235f916f98f1e5ebdad7323e8425c7709bde26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:06:04 +0100 Subject: [PATCH 153/370] Fix var --- htdocs/core/modules/modWorkflow.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index 58da4876d32..1fd6a89e66a 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -95,7 +95,7 @@ class modWorkflow extends DolibarrModules 8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), 10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0), 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0), - 11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) + 12=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) ); // Boxes From c5ca50b5db78fa3298420fefcfac7f7ad9f3d7b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:27:13 +0100 Subject: [PATCH 154/370] Fix warning --- htdocs/compta/facture/class/facture-rec.class.php | 3 +-- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a586dfc3e5..f02850492b5 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -188,13 +188,12 @@ class FactureRec extends CommonInvoice 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125), 'date_when' =>array('type'=>'datetime', 'label'=>'Date when', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'date_last_gen' =>array('type'=>'datetime', 'label'=>'Date last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'nb_gen_done' =>array('type'=>'integer', 'label'=>'Nb gen done', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'nb_gen_max' =>array('type'=>'integer', 'label'=>'Nb gen max', 'enabled'=>1, 'visible'=>-1, 'position'=>145), 'frequency' =>array('type'=>'integer', 'label'=>'Frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'UnitFrequency', 'enabled'=>1, 'visible'=>-1, 'position'=>152), 'usenewprice' =>array('type'=>'integer', 'label'=>'UseNewPrice', 'enabled'=>1, 'visible'=>0, 'position'=>155), 'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1), 'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6763ce02e84..d077ed3e777 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -270,7 +270,7 @@ class Ticket extends CommonObject // BEGIN MODULEBUILDER PROPERTIES public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'', 'showoncombobox'=>1), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), From f816587cfb235040c1c24c3c1489e7271aa73fa4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:28:05 +0100 Subject: [PATCH 155/370] Fix warning --- htdocs/adherents/list.php | 1 - htdocs/core/modules/modCommande.class.php | 4 ++-- htdocs/core/modules/modSociete.class.php | 1 - htdocs/projet/list.php | 2 +- htdocs/user/class/user.class.php | 1 - 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index a1d929ec3e9..0c61f94a93d 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -126,7 +126,6 @@ $fieldstosearchall = array( 'd.login'=>'Login', 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', - 'd.login'=>'Login', 'd.societe'=>"Company", 'd.email'=>'EMail', 'd.address'=>'Address', diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index f0486b5cb58..38b81cdb4fb 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -204,7 +204,7 @@ class modCommande extends DolibarrModules 'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate", 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT", - 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', + 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", @@ -236,7 +236,7 @@ class modCommande extends DolibarrModules 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date", 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric", - 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text', + 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text', 'c.entity'=>'List:entity:label:rowid', diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 70729f5c9dc..d63084ac5b5 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -571,7 +571,6 @@ class modSociete extends DolibarrModules 'dict' => 'DictionaryCompanyType' ), 's.capital' => array('rule' => 'numeric'), - 's.fk_stcomm' => array('rule' => 'zeroifnull'), 's.parent' => array( 'rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 23ff9be793f..411e6d5fcd8 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -210,7 +210,7 @@ $arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1 $arrayfields['s.name_alias'] = array('label'=>"AliasNameShort", 'checked'=>0, 'position'=>22); $arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'position'=>23); $arrayfields['c.assigned'] = array('label'=>$langs->trans("AssignedTo"), 'checked'=>-1, 'position'=>120); -$arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'position'=> 116, 'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1), 'position'=>106); +$arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1), 'position'=>106); $arrayfields['u.login'] = array('label'=>"Author", 'checked'=>1, 'position'=>165); // Force some fields according to search_usage filter... if (GETPOST('search_usage_opportunity')) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4e90bbb1bd9..81739943ae2 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -717,7 +717,6 @@ class User extends CommonObject 'shipping' => 'expedition', 'task' => 'task@projet', 'fichinter' => 'ficheinter', - 'propale' => 'propal', 'inventory' => 'stock', 'invoice' => 'facture', 'invoice_supplier' => 'fournisseur', From 73e776a44167ce0b94c98adc67e3d50dae94ec7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:29:19 +0100 Subject: [PATCH 156/370] Add option to start manually --- .github/workflows/stale-issues-safe.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml index 4ac9fa8f5b9..af04675d48d 100644 --- a/.github/workflows/stale-issues-safe.yml +++ b/.github/workflows/stale-issues-safe.yml @@ -6,7 +6,8 @@ on: - cron: "0 21 * * *" issue_comment: types: [created] - + workflow_dispatch: + permissions: {} # none jobs: From 1fde0a70f5bbb0492f79b0421ce808094f19228e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:39:08 +0100 Subject: [PATCH 157/370] Fix cast bad type --- htdocs/societe/class/companybankaccount.class.php | 2 +- htdocs/user/class/userbankaccount.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index d81a360e7d2..26305bb0013 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -349,7 +349,7 @@ class CompanyBankAccount extends Account $rib = $this->label." : "; } - $rib .= (string) $this; + $rib .= $this->iban; } return $rib; diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 271609139b1..6e9cc8e52af 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -241,7 +241,7 @@ class UserBankAccount extends Account $rib = $this->label." : "; } - $rib .= (string) $this; + $rib .= $this->iban; } return $rib; From 41c3d9da05225e6709362efb8e76a09d06fa8bfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:40:16 +0100 Subject: [PATCH 158/370] Fix warning --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index deff1af567c..88fc7d27eaa 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -367,7 +367,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($features == 'subscription') { $features = 'adherent'; $feature2 = 'cotisation'; - }; + } if ($features == 'websitepage') { $features = 'website'; $tableandshare = 'website_page'; From 8dc89e9a9a57ce678367765b7c8f1049796eb7f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 19:51:07 +0100 Subject: [PATCH 159/370] Fix warning --- htdocs/admin/system/dolibarr.php | 2 +- htdocs/blockedlog/class/authority.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/filemanagerdol/connectors/php/connector.lib.php | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 4a55c1a1160..afe5d4d3520 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -264,7 +264,7 @@ $daylight = round($c - $b); $val = ($a >= 0 ? '+' : '').$a; $val .= ' ('.($a == 'unknown' ? 'unknown' : ($a >= 0 ? '+' : '').($a * 3600)).')'; $val .= '       '.getServerTimeZoneString(); -$val .= '       '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? '     ('.$langs->trans('YesInSummer').')' : ''))); +$val .= '       '.$langs->trans("DaylingSavingTime").': '.(is_null($daylight) ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? '     ('.$langs->trans('YesInSummer').')' : ''))); print $form->textwithtooltip($val, $txt, 2, 1, img_info('')); print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php print ''."\n"; diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 0b665fedc3e..b3dd9b45f47 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -305,7 +305,7 @@ class BlockedLogAuthority $res = getURLContent($url); echo $block->signature.' '.$url.' '.$res['content'].'
'; - if ($res === 'blockalreadyadded' || $res === 'blockadded') { + if ($res['content'] === 'blockalreadyadded' || $res['content'] === 'blockadded') { $block->setCertified(); } else { $this->error = $langs->trans('ImpossibleToContactAuthority ', $url); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 87d28de8756..0a3c1445745 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6264,7 +6264,7 @@ class FactureLigne extends CommonInvoiceLine $sql .= ", total_localtax2=".price2num($this->total_localtax2); } $sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null"); - $sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option) + $sql .= ", buy_price_ht=".(($this->pa_ht || (string) $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option) $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); if (!empty($this->rang)) { $sql .= ", rang=".((int) $this->rang); diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php index 608c2ba4cd6..75c4d1e3e08 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php @@ -343,7 +343,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; //var_dump($sFileName); var_dump(image_format_supported($sFileName));exit; - $isImageValid = (image_format_supported($sFileName) >= 0 ? true : false); + $imgsupported = image_format_supported($sFileName); + $isImageValid = ($imgsupported >= 0 ? true : false); if (!$isImageValid) { $sErrorNumber = '202'; } @@ -387,7 +388,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') if (file_exists($sFilePath)) { //previous checks failed, try once again - if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) { + if (isset($isImageValid) && $imgsupported === -1 && IsImageValid($sFilePath, $sExtension) === false) { dol_syslog("connector.lib.php IsImageValid is ko"); @unlink($sFilePath); $sErrorNumber = '202'; From 15c05d9b7d5c6d953b1d3395fc17130b7e4c29a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 12:39:42 +0100 Subject: [PATCH 160/370] Fix warnings --- htdocs/comm/action/class/actioncomm.class.php | 10 ++++----- htdocs/core/class/extrafields.class.php | 18 ++++++++-------- htdocs/modulebuilder/index.php | 12 +++++------ htdocs/mrp/mo_card.php | 10 ++++----- htdocs/printing/admin/printing.php | 8 +++---- htdocs/product/admin/product.php | 11 +++++----- htdocs/projet/activity/permonth.php | 20 ++++++++++-------- htdocs/projet/activity/perweek.php | 21 ++++++++++--------- qodana.yaml | 1 + 9 files changed, 57 insertions(+), 54 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 244b3df9405..e77052e0690 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -225,22 +225,22 @@ class ActionComm extends CommonObject public $transparency; /** - * @var int (0 By default) + * @var int (0 By default) */ public $priority; /** - * @var int[] Array of user ids + * @var int[] Array of user ids */ public $userassigned = array(); /** - * @var int Id of user owner = fk_user_action into table + * @var int Id of user owner = fk_user_action into table */ public $userownerid; /** - * @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set. + * @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set. */ public $userdoneid; @@ -429,7 +429,7 @@ class ActionComm extends CommonObject $now = dol_now(); // Check parameters - if (!isset($this->userownerid) || $this->userownerid === '') { // $this->userownerid may be 0 (anonymous event) of > 0 + if (!isset($this->userownerid) || (string) $this->userownerid === '') { // $this->userownerid may be 0 (anonymous event) or > 0 dol_syslog("You tried to create an event but mandatory property ownerid was not defined", LOG_WARNING); $this->errors[] = 'ErrorActionCommPropertyUserowneridNotDefined'; return -1; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b0bc0e55c06..e9817a36d6a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1141,24 +1141,24 @@ class ExtraFields $out .= ''; } else { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; print ''.img_delete().''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a6eac03cadc..a8a96fb7c07 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -751,7 +751,7 @@ class Form // If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone) //if (!empty($conf->dol_no_mouse_hover) && !empty($tooltiptrigger)) //{ - //if ($type == 'info' || $type == 'help') return ''.$text.'''; + //if ($type == 'info' || $type == 'help') return ''.$text.''; //} $img = ''; @@ -3041,7 +3041,7 @@ class Form $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. $sql .= " LIMIT 1"; - dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level.'', LOG_DEBUG); + dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); $result2 = $this->db->query($sql); if ($result2) { $objp2 = $this->db->fetch_object($result2); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 25393c6ee56..47525ab5328 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1988,7 +1988,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) { $out .= ''; } elseif ($key == 'type_code') { print ''; } elseif ($key == 'category_code') { print ''; } elseif ($key == 'severity_code') { print ''; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a644880282b..96c8740a006 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1833,7 +1833,8 @@ if ($action == 'create' && $usercancreate) { // Shipping Method if (isModEnabled('expedition')) { print ''; } diff --git a/qodana.yaml b/qodana.yaml index 53cf1a04586..361afb8967f 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -69,5 +69,6 @@ exclude: - name: PhpCoveredCharacterInClassInspection - name: PhpSameParameterValueInspection - name: PhpConditionCheckedByNextConditionInspection + - name: RegExpSingleCharAlternation - name: PhpSuspiciousNameCombinationInspection \ No newline at end of file From 751f79b672a75fa5b99cb1e17f21a50aed3fba10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 14:01:03 +0100 Subject: [PATCH 165/370] Debug v17 --- htdocs/adherents/class/adherent.class.php | 4 +- htdocs/admin/chequereceipts.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 6 +- htdocs/comm/propal/card.php | 4 +- htdocs/commande/card.php | 5 +- htdocs/compta/bank/class/account.class.php | 4 +- htdocs/compta/facture/card-rec.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/contact/class/contact.class.php | 4 +- htdocs/contrat/card.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 12 +- .../browser/default/frmfolders.php | 2 +- htdocs/core/lib/security.lib.php | 6 +- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 4 +- htdocs/core/tpl/passwordreset.tpl.php | 4 +- htdocs/expedition/card.php | 1474 ++++++++--------- htdocs/expedition/shipment.php | 12 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- .../class/knowledgerecord.class.php | 4 +- htdocs/product/class/product.class.php | 4 +- htdocs/product/stock/class/entrepot.class.php | 4 +- htdocs/projet/class/project.class.php | 4 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/supplier_proposal/card.php | 5 +- htdocs/ticket/class/ticket.class.php | 4 +- htdocs/user/class/user.class.php | 4 +- 31 files changed, 798 insertions(+), 794 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4c68b3e91ec..c17a8c1207b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2871,8 +2871,8 @@ class Adherent extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index cf93155b814..ed05180ef24 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -211,7 +211,7 @@ foreach ($dirmodels as $reldir) { print ''; } @@ -2776,7 +2776,7 @@ if ($action == 'create') { } if (!empty($object->lines)) { - $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); } // Form to add new line diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 383cf7581e9..66e673abf2d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1833,7 +1833,8 @@ if ($action == 'create' && $usercancreate) { // Shipping Method if (isModEnabled('expedition')) { print ''; } @@ -2736,7 +2737,7 @@ if ($action == 'create' && $usercancreate) { // Show object lines if (!empty($object->lines)) { - $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); } $numlines = count($object->lines); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index a73fd2b5f2c..4aea92a510e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1060,8 +1060,8 @@ class Account extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 64a37dcbed4..26fb26d4cdb 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1635,7 +1635,7 @@ if ($action == 'create') { // Show object lines if (!empty($object->lines)) { $canchangeproduct = 1; - $ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice } // Form to add new line diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 36c98a495ec..0589ad18c05 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5423,7 +5423,7 @@ if ($action == 'create') { // Show object lines if (!empty($object->lines)) { - $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); } // Form to add new line diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d535da76199..caea7e0c8d5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1700,8 +1700,8 @@ class Contact extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 7aad6ca9c54..38efdb3cca9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1701,7 +1701,7 @@ if ($action == 'create') { if (empty($senderissupplier)) { print $form->select_produits((!empty($object->lines[$cursorline - 1]->fk_product) ? $object->lines[$cursorline - 1]->fk_product : 0), 'idprod'); } else { - print $form->select_produits_fournisseurs((!empty($object->lines[$cursorline - 1]->fk_product) ? $object->lines[$cursorline - 1]->fk_product : 0), 'idprod'); + $form->select_produits_fournisseurs((!empty($object->lines[$cursorline - 1]->fk_product) ? $object->lines[$cursorline - 1]->fk_product : 0), 'idprod'); } } print '
'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 599a7866da4..f1920c74931 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9957,7 +9957,7 @@ abstract class CommonObject * @param int[]|int $categories Category ID or array of Categories IDs * @param string $type_categ Category type ('customer', 'supplier', 'website_page', ...) definied into const class Categorie type * @param boolean $remove_existing True: Remove existings categories from Object if not supplies by $categories, False: let them - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3f4579340d0..c33ffe28551 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3256,7 +3256,7 @@ class Form * @param string $morecss Add more CSS * @param int $showstockinlist Show stock information (slower). * @param string $placeholder Placeholder - * @return array Array of keys for json + * @return array|string Array of keys for json or HTML component */ public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0, $placeholder = '') { @@ -3658,14 +3658,14 @@ class Form include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($htmlname); - - if (empty($outputmode)) { - return $out; - } - return $outarray; } else { dol_print_error($this->db); } + + if (empty($outputmode)) { + return $out; + } + return $outarray; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/filemanagerdol/browser/default/frmfolders.php b/htdocs/core/filemanagerdol/browser/default/frmfolders.php index d8d1fae179a..a1b03693324 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmfolders.php +++ b/htdocs/core/filemanagerdol/browser/default/frmfolders.php @@ -53,7 +53,7 @@ top_httphead(); --> diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index deff1af567c..0a7e9615a70 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -723,7 +723,11 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($mode) { return $ok ? 1 : 0; } else { - return $ok ? 1 : accessforbidden('', 1, 1, 0, $params); + if ($ok) { + return 1; + } else { + accessforbidden('', 1, 1, 0, $params); + } } } diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index eaf2d602571..7f97e751ded 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -98,7 +98,7 @@ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $disablenofollow = 0; } -print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); +top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); $colorbackhmenu1 = '60,70,100'; // topmenu diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index c3b94332909..ef6987e0e6c 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -214,7 +214,7 @@ if ($nolinesbefore) { echo ' '; } } - echo $form->select_type_of_lines(GETPOSTISSET("type") ? GETPOST("type", 'alpha', 2) : -1, 'type', 1, 1, $forceall); + $form->select_type_of_lines(GETPOSTISSET("type") ? GETPOST("type", 'alpha', 2) : -1, 'type', 1, 1, $forceall); echo ''; } // Predefined product/service diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 5520215d89a..dbc8b407fa5 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -120,7 +120,7 @@ $coldisplay++; print ''; } else { if ($senderissupplier) { - print $form->select_produits_fournisseurs(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); + $form->select_produits_fournisseurs(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); } else { print $form->select_produits(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); } diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 3fdbcd14ef3..e9d7de9a1bf 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -76,7 +76,7 @@ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $disablenofollow = 0; } -print top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); +top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); $colorbackhmenu1 = '60,70,100'; // topmenu @@ -253,7 +253,7 @@ if ($mode == 'dolibarr' || !$disabled) { diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 1f35b1a251a..e9d518dba64 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -77,7 +77,7 @@ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $disablenofollow = 0; } -print top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); +top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); $colorbackhmenu1 = '60,70,100'; // topmenu @@ -292,7 +292,7 @@ if ($mode == 'dolibarr' || !$disabled) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index ab8c4a28cbc..3e096bcc55d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1647,7 +1647,7 @@ if ($action == 'create') { dol_print_error($db); } } -} elseif ($id || $ref) { +} elseif ($object->id > 0) { /* *************************************************************************** */ /* */ /* Edit and view mode */ @@ -1657,828 +1657,826 @@ if ($action == 'create') { $num_prod = count($lines); - if ($object->id > 0) { - if (!empty($object->origin) && $object->origin_id > 0) { - $typeobject = $object->origin; - $origin = $object->origin; - $origin_id = $object->origin_id; - $object->fetch_origin(); // Load property $object->commande, $object->propal, ... + if (!empty($object->origin) && $object->origin_id > 0) { + $typeobject = $object->origin; + $origin = $object->origin; + $origin_id = $object->origin_id; + $object->fetch_origin(); // Load property $object->commande, $object->propal, ... + } + + $soc = new Societe($db); + $soc->fetch($object->socid); + + $res = $object->fetch_optionals(); + + $head = shipping_prepare_head($object); + print dol_get_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, $object->picto); + + $formconfirm = ''; + + // Confirm deleteion + if ($action == 'delete') { + $formquestion = array(); + if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + $formquestion = array( + array( + 'label' => $langs->trans('ShipmentIncrementStockOnDelete'), + 'name' => 'alsoUpdateStock', + 'type' => 'checkbox', + 'value' => 0 + ), + ); + } + $formconfirm = $form->formconfirm( + $_SERVER['PHP_SELF'].'?id='.$object->id, + $langs->trans('DeleteSending'), + $langs->trans("ConfirmDeleteSending", $object->ref), + 'confirm_delete', + $formquestion, + 0, + 1 + ); + } + + // Confirmation validation + if ($action == 'valid') { + $objectref = substr($object->ref, 1, 4); + if ($objectref == 'PROV') { + $numref = $object->getNextNumRef($soc); + } else { + $numref = $object->ref; } - $soc = new Societe($db); - $soc->fetch($object->socid); + $text = $langs->trans("ConfirmValidateSending", $numref); - $res = $object->fetch_optionals(); + if (isModEnabled('notification')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('SHIPPING_VALIDATE', $object->socid, $object); + } - $head = shipping_prepare_head($object); - print dol_get_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, $object->picto); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateSending'), $text, 'confirm_valid', '', 0, 1); + } + // Confirm cancelation + if ($action == 'cancel') { + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelSending'), $langs->trans("ConfirmCancelSending", $object->ref), 'confirm_cancel', '', 0, 1); + } - $formconfirm = ''; + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } - // Confirm deleteion - if ($action == 'delete') { - $formquestion = array(); - if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { - $formquestion = array( - array( - 'label' => $langs->trans('ShipmentIncrementStockOnDelete'), - 'name' => 'alsoUpdateStock', - 'type' => 'checkbox', - 'value' => 0 - ), - ); + // Print form confirm + print $formconfirm; + + // Calculate totalWeight and totalVolume for all products + // by adding weight and volume of each product line. + $tmparray = $object->getTotalWeightVolume(); + $totalWeight = $tmparray['weight']; + $totalVolume = $tmparray['volume']; + + + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { + $objectsrc = new Commande($db); + $objectsrc->fetch($object->$typeobject->id); + } + if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { + $objectsrc = new Propal($db); + $objectsrc->fetch($object->$typeobject->id); + } + + // Shipment card + $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer shipment + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); + // Thirdparty + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $formconfirm = $form->formconfirm( - $_SERVER['PHP_SELF'].'?id='.$object->id, - $langs->trans('DeleteSending'), - $langs->trans("ConfirmDeleteSending", $object->ref), - 'confirm_delete', - $formquestion, - 0, - 1 - ); - } - - // Confirmation validation - if ($action == 'valid') { - $objectref = substr($object->ref, 1, 4); - if ($objectref == 'PROV') { - $numref = $object->getNextNumRef($soc); - } else { - $numref = $object->ref; - } - - $text = $langs->trans("ConfirmValidateSending", $numref); - - if (isModEnabled('notification')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; - $notify = new Notify($db); - $text .= '
'; - $text .= $notify->confirmMessage('SHIPPING_VALIDATE', $object->socid, $object); - } - - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateSending'), $text, 'confirm_valid', '', 0, 1); - } - // Confirm cancelation - if ($action == 'cancel') { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelSending'), $langs->trans("ConfirmCancelSending", $object->ref), 'confirm_cancel', '', 0, 1); - } - - // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } - - // Print form confirm - print $formconfirm; - - // Calculate totalWeight and totalVolume for all products - // by adding weight and volume of each product line. - $tmparray = $object->getTotalWeightVolume(); - $totalWeight = $tmparray['weight']; - $totalVolume = $tmparray['volume']; - - - if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { - $objectsrc = new Commande($db); - $objectsrc->fetch($object->$typeobject->id); - } - if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { - $objectsrc = new Propal($db); - $objectsrc->fetch($object->$typeobject->id); - } - - // Shipment card - $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
'; - // Ref customer shipment - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); - // Thirdparty - $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); - // Project - if (isModEnabled('project')) { - $langs->load("projects"); - $morehtmlref .= '
'; - if (0) { // Do not change on shipment - $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; - } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); - } else { - if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { - $proj = new Project($db); - $proj->fetch($objectsrc->fk_project); - $morehtmlref .= $proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); + } else { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { + $proj = new Project($db); + $proj->fetch($objectsrc->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } - $morehtmlref .= '
'; + } + $morehtmlref .= '
'; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print '
'.$langs->trans('Ref').'
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'; +print $form->editfieldkey("Date", 'datep', $object->datep, $object, 1, 'datepicker'); +print ''; +print $form->editfieldval("Date", 'datep', $object->datep, $object, 1, 'datepicker'); +print "
'.$langs->trans('Mode').''; +print '
'.$langs->trans('Mode').''; print $langs->trans("PaymentType".$object->type_code); print '
'.$langs->trans('Numero').''.$object->num_payment.'
'.$langs->trans('Numero').''.dol_escape_htmltag($object->num_payment).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('Note').''.dol_nl2br($object->note).'
'; -print $form->editfieldkey("Date", 'datep', $object->datep, $object, 1, 'datepicker'); +print $form->editfieldkey("Date", 'datep', $object->datep, $object, 1, 'datehourpicker'); print ''; -print $form->editfieldval("Date", 'datep', $object->datep, $object, 1, 'datepicker'); +print $form->editfieldval("Date", 'datep', $object->datep, $object, 1, 'datehourpicker', '', null, null, '', 0, '', 'id', 'tzuserrel'); print "
'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."
'; print $form->editfieldkey("Date", 'datep', $object->datep, $object, 1, 'datehourpicker'); print ''; -print $form->editfieldval("Date", 'datep', $object->datep, $object, 1, 'datehourpicker', '', null, null, '', 0, '', 'id', 'tzuserrel'); +print $form->editfieldval("Date", 'datep', $object->datep, $object, 1, 'datehourpicker', '', null, null, '', 0, '', 'id', 'tzuserrel', array('addnowlink'=>1)); print "
'; + print '
'; print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp), 'day')."'.dol_print_date($db->jdate($objp->dp), 'dayhour', 'tzuserrel')."".$labeltype.' '.$objp->num_payment."
'.$langs->trans("AlreadyPaid")." :".price($totalpaid)."
'.$langs->trans("AmountExpected")." :".price($object->amount)."
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("Date").''; - $datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int')); + $datepaye = dol_mktime(GETPOST("rehour", 'int'), GETPOST("remin", 'int'), GETPOST("resec", 'int'), GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int')); $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOST("remonth") ? $datepaye : -1) : ''; - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', 1, 1, 0, "add_payment", 1, 1); print "
' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit, 'MT')).''.price(price2num($sous_total_credit, 'MT')).'
'.$langs->trans("Balance").':'; - print price($sous_total_debit - $sous_total_credit); + print price(price2num($sous_total_debit - $sous_total_credit, 'MT')); print ''; - print price($sous_total_credit - $sous_total_debit); + print price(price2num($sous_total_credit - $sous_total_debit, 'MT')); print '
'.$langs->trans("TotalForAccount").' '.$accountg.':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit, 'MT')).''.price(price2num($sous_total_credit, 'MT')).'
'.$langs->trans("Balance").':'; - print price($sous_total_debit - $sous_total_credit); + print price(price2num($sous_total_debit - $sous_total_credit, 'MT')); print ''; - print price($sous_total_credit - $sous_total_debit); + print price(price2num($sous_total_credit - $sous_total_debit, 'MT')); print '
'.$langs->trans("Asset"); + echo ''.$langs->trans("Asset"); if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) { print ' '; - echo ''.$objectlink->getNomUrl(1).''.$objectlink->getNomUrl(1).''.$objectlink->label.''.dol_print_date($objectlink->date_start, 'day').''; diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index 8a98c078bc5..1765e9a84c1 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -47,12 +47,12 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } echo '
'.$langs->trans("Bom"); + echo ''.$langs->trans("Bom"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { print ' '; - echo ''.$objectlink->getNomUrl(1).''.$objectlink->getNomUrl(1).''; $result = $product_static->fetch($objectlink->fk_product); diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 613f06a6feb..6539efd6a27 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -52,13 +52,13 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } print '
'.$langs->trans("Proposal"); + print ''.$langs->trans("Proposal"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id; print ' '; } print ''.$objectlink->getNomUrl(1).''.$objectlink->getNomUrl(1).''.$objectlink->ref_client.''.dol_print_date($objectlink->date, 'day').''; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 819a6ecb74f..a6a1fde3851 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -46,12 +46,12 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } echo '
'.$langs->trans("CustomerOrder"); + echo ''.$langs->trans("CustomerOrder"); if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) { print ' '; - echo ''.$objectlink->getNomUrl(1).''.$objectlink->getNomUrl(1).''.$objectlink->ref_client.''.dol_print_date($objectlink->date, 'day').''; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 92204520b35..71cb16ec818 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -67,7 +67,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { break; } print ''.$objectlink->getNomUrl(1).''.$objectlink->getNomUrl(1).''.$objectlink->ref_client.''.dol_print_date($objectlink->date, 'day').''; diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index d7e68e274fa..c3c774b79e7 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { ?>
trans("RepeatableInvoice"); ?>getNomUrl(1); ?>getNomUrl(1); ?> date_when, 'day'); ?> element == 'mo') { $trclass = 'oddeven'; echo '
' . $langs->trans("ManufacturingOrder"); + echo '' . $langs->trans("ManufacturingOrder"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { print ' '; - echo '' . $objectlink->getNomUrl(1) . '' . $objectlink->getNomUrl(1) . ''; + echo ''; // $result = $product_static->fetch($objectlink->fk_product); print '' . dol_print_date($objectlink->date_creation, 'day') . '' . dol_print_date($objectlink->date_creation, 'day') . '-' . $objectlink->getLibStatut(3) . ''; @@ -93,14 +93,14 @@ if ($object->element == 'mo') { $trclass .= ' liste_sub_total'; } print '
'.$langs->trans("ManufacturingOrder"); + print ''.$langs->trans("ManufacturingOrder"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { $url = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$objectlink->id; print ' '; } print ''.$objectlink->getNomUrl(1).''.$objectlink->getNomUrl(1).''.$objectlink->ref_client.''.dol_print_date($objectlink->date_start_planned, 'day').'-
trans("Reception"); ?> + trans("Reception"); ?> global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { print ' getNomUrl(1); ?>getNomUrl(1); ?> ref_supplier); ?> date_delivery, 'day'); ?> $objectlink) { } ?>
trans("Ticket"); ?> + trans("Ticket"); ?> global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { print ' getNomUrl(1); ?>getNomUrl(1); ?> ref_client; ?> datec, 'day'); ?> '.$langs->trans('Qty').''; print ''; print $langs->trans('Unit'); @@ -145,7 +145,7 @@ print ''; print ''; print ''.$form->textwithpicto($langs->trans('Qty'), ($filtertype != 1) ? $langs->trans("QtyRequiredIfNoLoss") : '').'' . $langs->trans('Unit') . ''; $label = $tmpproduct->getLabelOfUnit('long'); if ($label !== '') { From 0710031b32afc9804980c99f80c371423663b7cc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 30 Dec 2022 12:44:36 +0100 Subject: [PATCH 115/370] update code toward php8 compliance --- htdocs/contrat/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 220356310fa..ae2302b55f5 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1513,7 +1513,7 @@ if ($action == 'create') { // print ''.$langs->trans("PriceUHTCurrency").''.$langs->trans("Qty").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").''.$objp->qty.''.$langs->trans($object->lines[$cursorline - 1]->getLabelOfUnit()).''; print $form->selectUnits($objp->fk_unit, "unit"); print ''.$langs->trans('PriceUHTCurrency').''.$langs->trans('Qty').''.$langs->trans('Unit').''.$langs->trans('ReductionShort').'trans('Qty'); ?> '; print ''; print $langs->trans('Unit'); @@ -424,7 +424,7 @@ if ($nolinesbefore) { "> '; print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units"); From 2df271f76c6014c655b60cec349b1fb0fdbaa300 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 12:58:08 +0100 Subject: [PATCH 133/370] Fix qodana by cron only --- .github/workflows/code_quality.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index b27b64428e7..2b01a676db1 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -1,10 +1,11 @@ name: Qodana on: - workflow_dispatch: - pull_request: - push: - branches: - - develop + schedule: + - cron: "0 20 * * *" +# workflow_dispatch: +# push: +# branches: +# - develop jobs: qodana: From b4e76da867051167d26b392badf9eeb687f81df7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 13:41:12 +0100 Subject: [PATCH 134/370] Fix warning --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- qodana.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 5f577421cae..12531a57c5e 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1518,7 +1518,7 @@ class EmailCollector extends CommonObject $trackidfoundintorecipientid = 0; $reg = array(); // See also later list of all supported tags... - if (preg_match('/\+(thi|ctc|use|mem|sub|proj|tas|con|tic|job|pro|ord|inv|spro|sor|sin|leav|stockinv|job|surv|salary)([0-9]+)@/', $emailto, $reg)) { + if (preg_match('/\+(thi|ctc|use|mem|sub|proj|tas|con|tic|pro|ord|inv|spro|sor|sin|leav|stockinv|job|surv|salary)([0-9]+)@/', $emailto, $reg)) { $trackidfoundintorecipienttype = $reg[1]; $trackidfoundintorecipientid = $reg[2]; } elseif (preg_match('/\+emailing-(\w+)@/', $emailto, $reg)) { // Can be 'emailing-test' or 'emailing-IdMailing-IdRecipient' diff --git a/qodana.yaml b/qodana.yaml index b1a76747a5b..9de5ffc19de 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -1,6 +1,6 @@ version: "1.0" linter: jetbrains/qodana-php:2022.3-eap -failThreshold: 0 +failThreshold: 20000 profile: name: qodana.recommended exclude: From e8ea213503be7bd550b40ec9c0774bf7c6dfa411 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 13:51:58 +0100 Subject: [PATCH 135/370] Fix warning --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 85cb8a9cdfe..9f67a0e3909 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5058,7 +5058,7 @@ function dol_print_error($db = '', $error = '', $errors = null) } elseif (is_array($errors)) { $errors = array_merge(array($error), $errors); } else { - $errors = array_merge(array($error)); + $errors = array_merge(array($error), array($errors)); } foreach ($errors as $msg) { From db877b0bcb0997ca68de67f6e257e4523e3e7976 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 14:23:24 +0100 Subject: [PATCH 136/370] Fix warning --- .../compta/prelevement/class/bonprelevement.class.php | 10 ++++++++++ htdocs/opensurvey/class/opensurveysondage.class.php | 2 ++ htdocs/website/class/websitepage.class.php | 2 ++ 3 files changed, 14 insertions(+) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 959630a5538..373615ecdfb 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -72,6 +72,7 @@ class BonPrelevement extends CommonObject public $date_trans; public $user_trans; + public $method_trans; public $total; public $fetched; @@ -83,6 +84,15 @@ class BonPrelevement extends CommonObject public $invoice_in_error = array(); public $thirdparty_in_error = array(); + public $amount; + public $note; + public $datec; + + public $date_credit; + public $user_credit; + + public $type; + const STATUS_DRAFT = 0; const STATUS_TRANSFERED = 1; const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 2014e57f629..f5dadd90f2e 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -83,6 +83,8 @@ class Opensurveysondage extends CommonObject public $date_fin = ''; + public $date_m; + /** * @var int status */ diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 8660ca0b0c1..55916fc4fe2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -56,6 +56,8 @@ class WebsitePage extends CommonObject */ public $fk_website; + public $fk_page; // If translation of another page + public $pageurl; public $aliasalt; public $type_container; From 24e3e278ed2ac65fd0a530466e5f141359f2b1b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 13:51:58 +0100 Subject: [PATCH 137/370] Fix warning --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 10eb7b389a8..5b791594fea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5058,7 +5058,7 @@ function dol_print_error($db = '', $error = '', $errors = null) } elseif (is_array($errors)) { $errors = array_merge(array($error), $errors); } else { - $errors = array_merge(array($error)); + $errors = array_merge(array($error), array($errors)); } foreach ($errors as $msg) { From 5d840843965974ac65e85e5157afb1c08fe43d6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 14:23:24 +0100 Subject: [PATCH 138/370] Fix warning --- .../compta/prelevement/class/bonprelevement.class.php | 10 ++++++++++ htdocs/opensurvey/class/opensurveysondage.class.php | 2 ++ htdocs/website/class/websitepage.class.php | 2 ++ 3 files changed, 14 insertions(+) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 959630a5538..373615ecdfb 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -72,6 +72,7 @@ class BonPrelevement extends CommonObject public $date_trans; public $user_trans; + public $method_trans; public $total; public $fetched; @@ -83,6 +84,15 @@ class BonPrelevement extends CommonObject public $invoice_in_error = array(); public $thirdparty_in_error = array(); + public $amount; + public $note; + public $datec; + + public $date_credit; + public $user_credit; + + public $type; + const STATUS_DRAFT = 0; const STATUS_TRANSFERED = 1; const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 2014e57f629..f5dadd90f2e 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -83,6 +83,8 @@ class Opensurveysondage extends CommonObject public $date_fin = ''; + public $date_m; + /** * @var int status */ diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 8660ca0b0c1..55916fc4fe2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -56,6 +56,8 @@ class WebsitePage extends CommonObject */ public $fk_website; + public $fk_page; // If translation of another page + public $pageurl; public $aliasalt; public $type_container; From 95986647b411827fa05496533c85f0753ad0ab13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 14:56:55 +0100 Subject: [PATCH 139/370] Fix php8 compatibility --- .../actions_adherentcard_default.class.php | 25 ---- .../actions_contactcard_default.class.php | 25 ---- htdocs/core/class/canvas.class.php | 1 + .../product/actions_card_product.class.php | 139 ------------------ .../service/actions_card_service.class.php | 100 ------------- htdocs/product/card.php | 1 - 6 files changed, 1 insertion(+), 290 deletions(-) diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index c79143ab345..d5465abfcdd 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -116,30 +116,5 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); } } - - if ($action == 'list') { - $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); - } - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Fetch datas list and save into ->list_datas - * - * @param int $limit Limit number of responses - * @param int $offset Offset for first response - * @param string $sortfield Sort field - * @param string $sortorder Sort order ('ASC' or 'DESC') - * @return void - */ - public function LoadListDatas($limit, $offset, $sortfield, $sortorder) - { - // phpcs:enable - global $conf, $langs; - - //$this->getFieldList(); - - $this->list_datas = array(); } } diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 846f7440f97..f126b8c32a0 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -115,30 +115,5 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1); } } - - if ($action == 'list') { - $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); - } - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Fetch datas list and save into ->list_datas - * - * @param int $limit Limit number of responses - * @param int $offset Offset for first response - * @param string $sortfield Sort field - * @param string $sortorder Sort order ('ASC' or 'DESC') - * @return void - */ - public function LoadListDatas($limit, $offset, $sortfield, $sortorder) - { - // phpcs:enable - global $conf, $langs; - - //$this->getFieldList(); - - $this->list_datas = array(); } } diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 67443a7bdb8..b40f086a1aa 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -164,6 +164,7 @@ class Canvas */ public function displayCanvasExists($action) { + // template_dir should be '/'.$this->dirmodule.'/canvas/'.$this->canvas.'/tpl/', for example '/mymodule/canvas/product/tpl' if (empty($this->template_dir)) { return 0; } diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 9e6db35754e..56ebab13344 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -39,7 +39,6 @@ class ActionsCardProduct // List of fiels for action=list public $field_list = array(); - public $list_datas = array(); /** @@ -88,8 +87,6 @@ class ActionsCardProduct } $this->object = $tmpobject; - //parent::assign_values($action); - foreach ($this->object as $key => $value) { $this->tpl[$key] = $value; } @@ -227,10 +224,6 @@ class ActionsCardProduct $this->tpl['fiche_end'] = dol_get_fiche_end(); } - - if ($action == 'list') { - $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); - } } @@ -281,136 +274,4 @@ class ActionsCardProduct dol_print_error($this->db, $sql); } } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Fetch datas list and save into ->list_datas - * - * @param int $limit Limit number of responses - * @param int $offset Offset for first response - * @param string $sortfield Sort field - * @param string $sortorder Sort order ('ASC' or 'DESC') - * @return void - */ - public function LoadListDatas($limit, $offset, $sortfield, $sortorder) - { - // phpcs:enable - global $conf, $langs; - - $this->getFieldListCanvas(); - - $this->list_datas = array(); - - // Clean parameters - $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); - - foreach ($this->field_list as $field) { - if ($field['enabled']) { - $fieldname = "s".$field['alias']; - $$fieldname = GETPOST($fieldname); - } - } - - $sql = 'SELECT DISTINCT '; - - // Fields requiered - $sql .= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte, p.entity'; - - // Fields not requiered - foreach ($this->field_list as $field) { - if ($field['enabled']) { - $sql .= ", ".$field['name']." as ".$field['alias']; - } - } - - $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; - $sql .= " WHERE p.entity IN (".getEntity('product').")"; - - if ($sall) { - $clause = ''; - $sql .= " AND ("; - foreach ($this->field_list as $field) { - if ($field['enabled']) { - $sql .= $clause." ".$field['name']." LIKE '%".$this->db->escape($sall)."%'"; - if ($clause == '') { - $clause = ' OR'; - } - } - } - $sql .= ")"; - } - - // Search fields - foreach ($this->field_list as $field) { - if ($field['enabled']) { - $fieldname = "s".$field['alias']; - if (${$fieldname}) { - $sql .= " AND ".$field['name']." LIKE '%".$this->db->escape(${$fieldname})."%'"; - } - } - } - - if (GETPOSTISSET("tosell")) { - $sql .= " AND p.tosell = ".((int) GETPOST("tosell", "int")); - } - if (GETPOSTISSET("canvas")) { - $sql .= " AND p.canvas = '".$this->db->escape(GETPOST("canvas"))."'"; - } - $sql .= $this->db->order($sortfield, $sortorder); - $sql .= $this->db->plimit($limit + 1, $offset); - //print $sql; - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - - $i = 0; - while ($i < min($num, $limit)) { - $datas = array(); - - $obj = $this->db->fetch_object($resql); - - $datas["id"] = $obj->rowid; - - foreach ($this->field_list as $field) { - if ($field['enabled']) { - $alias = $field['alias']; - - if ($alias == 'ref') { - $this->id = $obj->rowid; - $this->ref = $obj->$alias; - $this->type = $obj->fk_product_type; - $this->entity = $obj->entity; - $datas[$alias] = $this->getNomUrl(1, '', 24); - } elseif ($alias == 'stock') { - $this->load_stock(); - if ($this->stock_reel < $obj->seuil_stock_alerte) { - $datas[$alias] = $this->stock_reel.' '.img_warning($langs->trans("StockTooLow")); - } else { - $datas[$alias] = $this->stock_reel; - } - } elseif ($alias == 'label') { - $datas[$alias] = dol_trunc($obj->$alias, 40); - } elseif (preg_match('/price/i', $alias)) { - $datas[$alias] = price($obj->$alias); - } elseif ($alias == 'datem') { - $datas[$alias] = dol_print_date($this->db->jdate($obj->$alias), 'day'); - } elseif ($alias == 'status') { - $datas[$alias] = $this->LibStatut($obj->$alias, 5); - } else { - $datas[$alias] = $obj->$alias; - } - } - } - - array_push($this->list_datas, $datas); - - $i++; - } - $this->db->free($resql); - } else { - dol_print_error($this->db); - } - } } diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index b07c3d96a52..021de9b215e 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -37,7 +37,6 @@ class ActionsCardService // List of fiels for action=list public $field_list = array(); - public $list_datas = array(); public $id; public $ref; @@ -92,8 +91,6 @@ class ActionsCardService } $this->object = $tmpobject; - //parent::assign_values($action); - foreach ($this->object as $key => $value) { $this->tpl[$key] = $value; } @@ -213,10 +210,6 @@ class ActionsCardService $this->tpl['fiche_end'] = dol_get_fiche_end(); } - - if ($action == 'list') { - $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); - } } @@ -267,97 +260,4 @@ class ActionsCardService dol_print_error($this->db, $sql); } } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Fetch datas list and save into ->list_datas - * - * @param int $limit Limit number of responses - * @param int $offset Offset for first response - * @param string $sortfield Sort field - * @param string $sortorder Sort order ('ASC' or 'DESC') - * @return void - */ - public function LoadListDatas($limit, $offset, $sortfield, $sortorder) - { - // phpcs:enable - global $conf; - global $search_categ, $sall, $sref, $search_barcode, $snom, $catid; - - $this->getFieldListCanvas(); - - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; - $sql .= ' p.fk_product_type, p.tms as datem,'; - $sql .= ' p.duration, p.tosell as statut, p.seuil_stock_alerte'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; - // We'll need this table joined to the select in order to filter by categ - if ($search_categ) { - $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; - } - $fourn_id = 0; - if (GETPOST("fourn_id", 'int') > 0) { - $fourn_id = GETPOST("fourn_id", 'int'); - $sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; - } - $sql .= " WHERE p.entity IN (".getEntity('product').")"; - if ($search_categ) { - $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ - } - if ($sall) { - $sql .= " AND (p.ref LIKE '%".$this->db->escape($sall)."%' OR p.label LIKE '%".$this->db->escape($sall)."%' OR p.description LIKE '%".$this->db->escape($sall)."%' OR p.note LIKE '%".$this->db->escape($sall)."%')"; - } - if ($sref) { - $sql .= " AND p.ref LIKE '%".$this->db->escape($sref)."%'"; - } - if ($search_barcode) { - $sql .= " AND p.barcode LIKE '%".$this->db->escape($search_barcode)."%'"; - } - if ($snom) { - $sql .= " AND p.label LIKE '%".$this->db->escape($snom)."%'"; - } - if (GETPOSTISSET("tosell")) { - $sql .= " AND p.tosell = ".((int) GETPOST("tosell", 'int')); - } - if (GETPOSTISSET("canvas")) { - $sql .= " AND p.canvas = '".$this->db->escape(GETPOST("canvas"))."'"; - } - if ($catid) { - $sql .= " AND cp.fk_categorie = ".((int) $catid); - } - if ($fourn_id > 0) { - $sql .= " AND p.rowid = pfp.fk_product AND pfp.fk_soc = ".((int) $fourn_id); - } - // Insert categ filter - if ($search_categ) { - $sql .= " AND cp.fk_categorie = ".((int) $search_categ); - } - $sql .= $this->db->order($sortfield, $sortorder); - $sql .= $this->db->plimit($limit + 1, $offset); - - $this->list_datas = array(); - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - - $i = 0; - while ($i < min($num, $limit)) { - $datas = array(); - $obj = $this->db->fetch_object($resql); - - $datas["id"] = $obj->rowid; - $datas["ref"] = $obj->ref; - $datas["label"] = $obj->label; - $datas["barcode"] = $obj->barcode; - $datas["statut"] = $obj->statut; - - array_push($this->list_datas, $datas); - - $i++; - } - $this->db->free($resql); - } else { - print $sql; - } - } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2bfe94f418a..a7b3c1958b5 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1250,7 +1250,6 @@ if (isModEnabled('barcode') && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) } } - if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used with CANVAS From 65e465fefbb3cbd919dd063fde8896470e560b16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 14:59:20 +0100 Subject: [PATCH 140/370] Fix threshold --- qodana.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qodana.yaml b/qodana.yaml index 79ca8d5af59..d63f7b16999 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -1,6 +1,6 @@ version: "1.0" linter: jetbrains/qodana-php:2022.3-eap -failThreshold: 20000 +failThreshold: 0 profile: name: qodana.recommended exclude: From 10445b1e987c3beb437ea660c9b09fa5e3079521 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 14:59:32 +0100 Subject: [PATCH 141/370] Doc --- htdocs/core/class/canvas.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 67443a7bdb8..a0f5a5f1fe4 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -157,7 +157,7 @@ class Canvas } /** - * Return the template to display canvas (if it exists) + * Return if a template exists to display as canvas (if it exists) * * @param string $action Action code * @return int 0=Canvas template file does not exist, 1=Canvas template file exists From 2130587613a51674f6be8a83ee3995a3a4af2bf8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 15:14:01 +0100 Subject: [PATCH 142/370] Fix warnings --- htdocs/core/class/html.form.class.php | 2 +- htdocs/emailcollector/class/emailcollector.class.php | 5 +++-- htdocs/societe/class/companybankaccount.class.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3a566b6014..686d500875a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4203,7 +4203,7 @@ class Form if ($deposit_percent >= 0) { $out .= ' '; $out .= ' '."\n"; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 8cd1ad3d597..fd983a10924 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -113,7 +113,8 @@ if (!count($listofvars) && !count($listofstatus)) { if ($key != $param) { continue; } - $val2 = ${$val['var']}; + $tmpvar = $val['var']; + $val2 = ${$tmpvar}; $text = 'Should be in line with value of param '.$val['var'].' thas is '.($val2 ? $val2 : "'' (=".$val['valifempty'].")").''; $show = 1; } diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index b589eac4079..6ba932c007b 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -293,14 +293,14 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type']== 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -382,9 +382,9 @@ if ($action == 'edit') { print ''; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { @@ -393,14 +393,14 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template<0) { setEventMessages(null, $formmail->errors, 'errors'); } print $langs->trans($template->label); } elseif (preg_match('/category:/', $val['type'])) { $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); + $result = $c->fetch(getDolGlobalString($constname)); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); } elseif ($result > 0 ) { @@ -412,25 +412,25 @@ if ($action == 'edit') { print '
    ' . implode(' ', $toprint) . '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { + if (getDolGlobalInt($constname)==2) { print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { + } elseif (getDolGlobalInt($constname)==3) { print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { + } elseif (getDolGlobalInt($constname)==1) { print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { + } elseif (getDolGlobalInt($constname)==0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); + $resprod = $product->fetch(getDolGlobalInt($constname)); if ($resprod > 0) { print $product->ref; } elseif ($resprod < 0) { setEventMessages(null, $object->errors, "errors"); } } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } print '
'; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { @@ -598,14 +598,14 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template<0) { setEventMessages(null, $formmail->errors, 'errors'); } print $langs->trans($template->label); } elseif (preg_match('/category:/', $val['type'])) { $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); + $result = $c->fetch(getDolGlobalInt($constname)); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); } elseif ($result > 0 ) { @@ -617,18 +617,18 @@ if ($action == 'edit') { print '
    ' . implode(' ', $toprint) . '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { + if (getDolGlobalInt($constname)==2) { print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { + } elseif (getDolGlobalInt($constname)==3) { print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { + } elseif (getDolGlobalInt($constname)==1) { print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { + } elseif (getDolGlobalInt($constname)==0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); + $resprod = $product->fetch(getDolGlobalInt($constname)); if ($resprod > 0) { print $product->ref; } elseif ($resprod < 0) { @@ -638,11 +638,11 @@ if ($action == 'edit') { if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $conf->global->{$constname}, 1); + $accountingaccount->fetch('', getDolGlobalString($constname), 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } } else { print $conf->global->{$constname}; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f0399fa6350..d1329e40454 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1602,7 +1602,7 @@ if ($action == 'create') { $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { $("#select_actioncommsendmodel_mail").closest("tr").hide(); - }; + } }); })'; print ''."\n"; @@ -2104,7 +2104,7 @@ if ($id > 0) { $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { $("#select_actioncommsendmodel_mail").closest("tr").hide(); - }; + } }); })'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 383cf7581e9..a644880282b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1898,7 +1898,7 @@ if ($action == 'create' && $usercancreate) { if ($soc->fetch_optionals() > 0) { $object->array_options = array_merge($object->array_options, $soc->array_options); } - }; + } print $object->showOptionals($extrafields, 'create', $parameters); } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index d3e573f21bf..e75402ba429 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -353,10 +353,10 @@ if (GETPOST("account") || GETPOST("ref")) { print "
".$refcomp."'.price(abs($total_ttc))."  '.price($total_ttc)."'.price($solde).'
'.$langs->trans("CashDeskIdWareHouse").'
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'
'; $contact = new Contact($db); - foreach ($histo[$key]['socpeopleassigned'] as $cid => $value) { + foreach ($histo[$key]['socpeopleassigned'] as $cid => $cvalue) { $result = $contact->fetch($cid); if ($result < 0) { diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 7078d7488ad..ccce2ec7f94 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -128,7 +128,7 @@ function dol_print_cron_urls() $pathtoscript = $conf->global->MAIN_DOL_SCRIPTS_ROOT; } - $file = $pathtoscript.'/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; + $file = $pathtoscript.'/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY).' '.$logintouse.' [cronjobid]'; print '
\n"; print '
'; @@ -145,7 +145,7 @@ function dol_print_cron_urls() if ($linuxlike) { print $langs->trans("CronExplainHowToRunUnix"); print '
'; - print '
'; + print '
'; } else { print $langs->trans("CronExplainHowToRunWin"); } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index b6932c2cf09..9928b8af33b 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -568,13 +568,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } - print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=edit&token='.newToken().'', '', $permissiontoadd); + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=edit&token='.newToken(), '', $permissiontoadd); // Clone print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd); // Delete (need delete permission, or if draft, just need create/modify permission) - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&action=delete&token='.newToken().'', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print ''."\n"; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0125becd21c..81da058b919 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1470,7 +1470,7 @@ class Holiday extends CommonObject $sql .= " value = '".$this->db->escape($value)."'"; $sql .= " WHERE name = '".$this->db->escape($name)."'"; - dol_syslog(get_class($this).'::updateConfCP name='.$name.'', LOG_DEBUG); + dol_syslog(get_class($this).'::updateConfCP name='.$name, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { return true; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index a14467c0184..b804f3d9c8f 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -281,7 +281,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { // Delete dir and files that can be generated in sub tabs later if we need them (we want a minimal module first) dol_delete_dir_recursive($destdir.'/build/doxygen'); dol_delete_dir_recursive($destdir.'/core/modules/mailings'); - dol_delete_dir_recursive($destdir.'/core/modules/'.strtolower($modulename).''); + dol_delete_dir_recursive($destdir.'/core/modules/'.strtolower($modulename)); dol_delete_dir_recursive($destdir.'/core/tpl'); dol_delete_dir_recursive($destdir.'/core/triggers'); dol_delete_dir_recursive($destdir.'/doc'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ac5d612394b..43760d808b2 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -834,7 +834,7 @@ class MouvementStock extends CommonObject $sql .= " WHERE fk_product = ".((int) $productidselected); $sql .= " AND datem < '".$this->db->idate($datebefore)."'"; - dol_syslog(get_class($this).__METHOD__.'', LOG_DEBUG); + dol_syslog(get_class($this).__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ffe59b01d61..1f9ad46cdb0 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -279,9 +279,9 @@ class Stripe extends CommonObject global $stripearrayofkeysbyenv; \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); if (empty($key)) { // If the Stripe connect account not set, we use common API usage - $stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.''); + $stripepaymentmethod = \Stripe\PaymentMethod::retrieve((string) $paymentmethod->id); } else { - $stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key)); + $stripepaymentmethod = \Stripe\PaymentMethod::retrieve((string) $paymentmethod->id, array("stripe_account" => $key)); } } catch (Exception $e) { $this->error = $e->getMessage(); @@ -307,9 +307,9 @@ class Stripe extends CommonObject global $stripearrayofkeysbyenv; \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); if (empty($key)) { // If the Stripe connect account not set, we use common API usage - $selectedreader = \Stripe\Terminal\Reader::retrieve(''.$reader.''); + $selectedreader = \Stripe\Terminal\Reader::retrieve((string) $reader); } else { - $stripepaymentmethod = \Stripe\Terminal\Reader::retrieve(''.$reader.'', array("stripe_account" => $key)); + $stripepaymentmethod = \Stripe\Terminal\Reader::retrieve((string) $reader, array("stripe_account" => $key)); } } catch (Exception $e) { $this->error = $e->getMessage(); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ea262a1562f..27b340249c3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1424,7 +1424,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">'; if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '
'; - $htmlforlines .= $row->label.''.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency); + $htmlforlines .= $row->label.' '.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency); $htmlforlines .= ''."\n"; } else { $htmlforlines .= '
'; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 4c4dce5a428..79db9e0e73e 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -836,15 +836,15 @@ foreach ($object->fields as $key => $val) { print ''; - $formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'), 1); + $formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key, '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'), 1); print ''; - $formTicket->selectGroupTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); + $formTicket->selectGroupTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key, '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); print ''; - $formTicket->selectSeveritiesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); + $formTicket->selectSeveritiesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key, '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); print ''; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 65357174019..0f0eb79d10e 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -741,9 +741,9 @@ function createOrder($authentication, $order) $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { - foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { - $key = 'options_'.$key; - $newline->array_options[$key] = $line[$key]; + foreach ($extrafields->attributes[$elementtype]['label'] as $tmpkey => $tmplabel) { + $tmpkey = 'options_'.$tmpkey; + $newline->array_options[$tmpkey] = $line[$tmpkey]; } } diff --git a/qodana.yaml b/qodana.yaml index 5ed80e029f3..853ee69fab5 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -64,4 +64,6 @@ exclude: - name: PhpArrayWriteIsNotUsedInspection - name: PhpUndefinedNamespaceInspection - name: PhpArraySearchInBooleanContextInspection - - name: PhpPropertyOnlyWrittenInspection \ No newline at end of file + - name: PhpLoopCanBeReplacedWithStrRepeatInspection + - name: PhpPropertyOnlyWrittenInspection + - name: PhpCoveredCharacterInClassInspection \ No newline at end of file diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 67c14a4ee5d..2fe89b92ccb 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -176,17 +176,17 @@ if ($result >= 0) { // 1 - Association des utilisateurs du groupe LDAP au groupe Dolibarr $userList = array(); $userIdList = array(); - foreach ($ldapgroup[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] as $key => $userdn) { - if ($key === 'count') { + foreach ($ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS')] as $tmpkey => $userdn) { + if ($tmpkey === 'count') { continue; } if (empty($userList[$userdn])) { // Récupération de l'utilisateur // Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement - if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS === 'memberUid') { + if (getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS') === 'memberUid') { $userKey = array($userdn); } else { // Pour les autres schémas, les membres sont listés sous forme de DN complets $userFilter = explode(',', $userdn); - $userKey = $ldap->getAttributeValues('('.$userFilter[0].')', $conf->global->LDAP_KEY_USERS); + $userKey = $ldap->getAttributeValues('('.$userFilter[0].')', getDolGlobalString('LDAP_KEY_USERS')); } if (!is_array($userKey)) { continue; @@ -194,9 +194,9 @@ if ($result >= 0) { $fuser = new User($db); - if ($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) { + if (getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SID')) { $fuser->fetch('', '', $userKey[0]); // Chargement du user concerné par le SID - } elseif ($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { + } elseif (getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN')) { $fuser->fetch('', $userKey[0]); // Chargement du user concerné par le login } From cef9a8e8d48e525ab63e561ceace90ca24b2ab7d Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 31 Dec 2022 13:36:31 +0100 Subject: [PATCH 162/370] Fix Price by qty for multiprices --- htdocs/core/lib/ajax.lib.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index a6d269a6bb2..63d4605b8fb 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -187,7 +187,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen $("#'.$htmlnamejquery.'").attr("data-ref-customer", ui.item.ref_customer); $("#'.$htmlnamejquery.'").attr("data-tvatx", ui.item.tva_tx); '; - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { $script .= ' // For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on $("#'.$htmlnamejquery.'").attr("data-pbq", ui.item.pbq); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5ce4ab76448..f4e83192ac4 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -911,7 +911,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { ?> global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {?> + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {?> /* To process customer price per quantity (PRODUIT_CUSTOMER_PRICES_BY_QTY works only if combo product is not an ajax after x key pressed) */ var pbq = parseInt($('option:selected', this).attr('data-pbq')); // When select is done from HTML select if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } // When select is done from HTML input with autocomplete From 8774f4f092021d4cd548bec6cc683e9dad199dc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 13:44:11 +0100 Subject: [PATCH 163/370] Fix warning qodana --- htdocs/core/lib/functions.lib.php | 14 +++++++------- htdocs/core/lib/project.lib.php | 6 ++++-- .../asset/doc/doc_generic_asset_odt.modules.php | 2 +- .../bom/doc/doc_generic_bom_odt.modules.php | 2 +- .../commande/doc/doc_generic_order_odt.modules.php | 2 +- .../doc/doc_generic_contract_odt.modules.php | 2 +- .../doc/doc_generic_shipment_odt.modules.php | 2 +- .../doc/doc_generic_invoice_odt.modules.php | 2 +- .../member/doc/doc_generic_member_odt.class.php | 2 +- .../modules/mrp/doc/doc_generic_mo_odt.modules.php | 2 +- .../doc/doc_generic_product_odt.modules.php | 2 +- .../doc/doc_generic_project_odt.modules.php | 2 +- .../doc/doc_generic_proposal_odt.modules.php | 2 +- .../doc/doc_generic_reception_odt.modules.php | 2 +- .../stock/doc/doc_generic_stock_odt.modules.php | 2 +- .../doc_generic_supplier_invoice_odt.modules.php | 2 +- .../doc/doc_generic_supplier_order_odt.modules.php | 2 +- .../doc_generic_supplier_proposal_odt.modules.php | 2 +- .../ticket/doc/doc_generic_ticket_odt.modules.php | 2 +- .../user/doc/doc_generic_user_odt.modules.php | 2 +- .../doc/doc_generic_usergroup_odt.modules.php | 2 +- .../doc/doc_generic_myobject_odt.modules.php | 2 +- ..._generic_recruitmentjobposition_odt.modules.php | 2 +- qodana.yaml | 6 +++++- test/phpunit/FunctionsLibTest.php | 7 +++++++ 25 files changed, 44 insertions(+), 31 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index de329ee515f..6241eaaa8b1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -368,7 +368,7 @@ function getBrowserInfo($user_agent) // MS products at end $name = 'ie'; $version = end($reg); - } elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { + } elseif (preg_match('/l[iy]n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { // MS products at end $name = 'lynxlinks'; $version = $reg[4]; @@ -3804,7 +3804,7 @@ function isValidMXRecord($domain) } } - // function idn_to_ascii or checkdnsrr does not exists + // function idn_to_ascii or checkdnsrr or getmxrr does not exists return -1; } @@ -10208,12 +10208,12 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $imgmime = 'mdb.png'; $famime = 'file-o'; } - if (preg_match('/\.doc(x|m)?$/i', $tmpfile)) { + if (preg_match('/\.doc[xm]?$/i', $tmpfile)) { $mime = 'application/msword'; $imgmime = 'doc.png'; $famime = 'file-word-o'; } - if (preg_match('/\.dot(x|m)?$/i', $tmpfile)) { + if (preg_match('/\.dot[xm]?$/i', $tmpfile)) { $mime = 'application/msword'; $imgmime = 'doc.png'; $famime = 'file-word-o'; @@ -10233,17 +10233,17 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $imgmime = 'xls.png'; $famime = 'file-excel-o'; } - if (preg_match('/\.xls(b|m|x)$/i', $tmpfile)) { + if (preg_match('/\.xls[bmx]$/i', $tmpfile)) { $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; } - if (preg_match('/\.pps(m|x)?$/i', $tmpfile)) { + if (preg_match('/\.pps[mx]?$/i', $tmpfile)) { $mime = 'application/vnd.ms-powerpoint'; $imgmime = 'ppt.png'; $famime = 'file-powerpoint-o'; } - if (preg_match('/\.ppt(m|x)?$/i', $tmpfile)) { + if (preg_match('/\.ppt[mx]?$/i', $tmpfile)) { $mime = 'application/x-mspowerpoint'; $imgmime = 'ppt.png'; $famime = 'file-powerpoint-o'; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7fdb3aecda1..a59ebe658b0 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1624,8 +1624,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr // Duration print ''; - $dayWorkLoad = !empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id] : 0; - if (!isset($totalforeachday[$preselectedday])) $totalforeachday[$preselectedday] = 0; + $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; + if (!isset($totalforeachday[$preselectedday])) { + $totalforeachday[$preselectedday] = 0; + } $totalforeachday[$preselectedday] += $dayWorkLoad; $alreadyspent = ''; diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index 8be86dda944..ba4f39919bf 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -262,7 +262,7 @@ class doc_generic_asset_odt extends ModelePDFAsset if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref.'_'.$newfiletmp; diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index bec28b941aa..ea877432c17 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -273,7 +273,7 @@ class doc_generic_bom_odt extends ModelePDFBom if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 5e94397bc91..bbace838183 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -279,7 +279,7 @@ class doc_generic_order_odt extends ModelePDFCommandes if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index dad1ebc9122..83e8f2551f7 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -276,7 +276,7 @@ class doc_generic_contract_odt extends ModelePDFContract if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 73793c5a757..f8280aab301 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -277,7 +277,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 0b8fa2d4621..f5dcfb86936 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -276,7 +276,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index ed48c93c4de..2d125d2743a 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -266,7 +266,7 @@ class doc_generic_member_odt extends ModelePDFMember if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index b89c4eab2cd..90d1f2f8d6b 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -266,7 +266,7 @@ class doc_generic_mo_odt extends ModelePDFMo if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index d5321b92ceb..6fde0ce16c4 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -274,7 +274,7 @@ class doc_generic_product_odt extends ModelePDFProduct if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 2015da21f61..f08a93b4339 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -557,7 +557,7 @@ class doc_generic_project_odt extends ModelePDFProjects if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 6715b2e39a5..de6554137df 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -307,7 +307,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 4ebc742b4bb..84d95a5036c 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -270,7 +270,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index eb6ba838d7a..358369d1f43 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -277,7 +277,7 @@ class doc_generic_stock_odt extends ModelePDFStock if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 8d1f9713c00..c9e18e7c4ab 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -266,7 +266,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref.'_'.$newfiletmp; diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 12bbcc12edc..ca7d1b3d61b 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -261,7 +261,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 55a7710c5a4..8fca5110896 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -295,7 +295,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 1a2d1e537cc..3ae972fef49 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -264,7 +264,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 1c3e346203b..00edf04fac0 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -295,7 +295,7 @@ class doc_generic_user_odt extends ModelePDFUser if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 4bbb39c0086..a5447260a2f 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -277,7 +277,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index b7dfc374a52..f89360e8774 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -278,7 +278,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index cfbf91463e8..147e8ec3519 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -264,7 +264,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); - $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref.'_'.$newfiletmp; diff --git a/qodana.yaml b/qodana.yaml index 853ee69fab5..53cf1a04586 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -66,4 +66,8 @@ exclude: - name: PhpArraySearchInBooleanContextInspection - name: PhpLoopCanBeReplacedWithStrRepeatInspection - name: PhpPropertyOnlyWrittenInspection - - name: PhpCoveredCharacterInClassInspection \ No newline at end of file + - name: PhpCoveredCharacterInClassInspection + - name: PhpSameParameterValueInspection + - name: PhpConditionCheckedByNextConditionInspection + - name: PhpSuspiciousNameCombinationInspection + \ No newline at end of file diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 12c8683bb8f..ef5507d8601 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -442,6 +442,13 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals('ios', $tmp['browseros']); $this->assertEquals('tablet', $tmp['layout']); $this->assertEquals('iphone', $tmp['phone']); + + //iPad + $user_agent = 'Lynx/2.8.8dev.3 libwww‑FM/2.14 SSL‑MM/1.4.1'; + $tmp=getBrowserInfo($user_agent); + $this->assertEquals('lynxlinks', $tmp['browsername']); + $this->assertEquals('unknown', $tmp['browseros']); + $this->assertEquals('classic', $tmp['layout']); } From 3ca8e8c4935251250c39e01ff4d7b50d103753ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 13:47:09 +0100 Subject: [PATCH 164/370] Fix warning --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 3 ++- qodana.yaml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a21e227d822..a3896f7de3c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1830,7 +1830,7 @@ if ($action == 'create') { } print '
'.$langs->trans('SendingMethod').''; print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"'); - print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('SendingMethod').''; - print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); + $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print '
'; print $form->textwithpicto('', $htmltooltip, 1, 0); - if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) { // If module is the one used, we show existing errors + if (getDolGlobalString('CHEQUERECEIPTS_ADDON').'.php' == $file) { // If module is the one used, we show existing errors if (!empty($module->error)) { dol_htmloutput_mesg($module->error, '', 'error', 1); } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 64d01817c85..cc43d0fb818 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1800,8 +1800,8 @@ class ActionComm extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { @@ -1835,7 +1835,7 @@ class ActionComm extends CommonObject $c->add_type($this, Categorie::TYPE_ACTIONCOMM); } } - return; + return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 07729fd55de..e4cd4f9491f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1830,7 +1830,7 @@ if ($action == 'create') { } print '
'.$langs->trans('SendingMethod').''; print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"'); - print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('SendingMethod').''; - print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); + $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print '
'; + print '
'; - // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { - print ''; - print '\n"; - print ''; - } - if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { - print ''; - print '\n"; - print ''; - } - - // Date creation - print ''; - print '\n"; - print ''; - - // Delivery date planned - print ''; - print ''; - - // Weight + // Linked documents + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { print ''; - - // Width - print ''; - - // Height - print ''; - - // Depth - print ''; - - // Volume - print ''; + print $langs->trans("RefOrder").''; print '\n"; print ''; - - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'; - print $langs->trans("RefOrder").''; - print $objectsrc->getNomUrl(1, 'commande'); - print "
'; - print $langs->trans("RefProposal").''; - print $objectsrc->getNomUrl(1, 'expedition'); - print "
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation, "dayhour")."
'; - print ''; - - if ($action != 'editdate_livraison') { - print ''; - } - print '
'; - print $langs->trans('DateDeliveryPlanned'); - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; - print '
'; - if ($action == 'editdate_livraison') { - print ''; - print ''; - print ''; - print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); - print ''; - print ''; - } else { - print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; - } - print '
'; - print $form->editfieldkey("Weight", 'trueWeight', $object->trueWeight, $object, $user->rights->expedition->creer); - print ''; - - if ($action == 'edittrueWeight') { - print '
'; - print ''; - print ''; - print ''; - print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2); - print ' '; - print ' '; - print '
'; - } else { - print $object->trueWeight; - print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; - } - - // Calculated - if ($totalWeight > 0) { - if (!empty($object->trueWeight)) { - print ' ('.$langs->trans("SumOfProductWeights").': '; - } - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); - if (!empty($object->trueWeight)) { - print ')'; - } - } - print '
'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).''; - print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer); - print ($object->trueWidth && $object->width_units != '') ? ' '.measuringUnitString(0, "size", $object->width_units) : ''; - print '
'.$form->editfieldkey("Height", 'trueHeight', $object->trueHeight, $object, $user->rights->expedition->creer).''; - if ($action == 'edittrueHeight') { - print '
'; - print ''; - print ''; - print ''; - print ''; - print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units, 0, 2); - print ' '; - print ' '; - print '
'; - } else { - print $object->trueHeight; - print ($object->trueHeight && $object->height_units != '') ? ' '.measuringUnitString(0, "size", $object->height_units) : ''; - } - - print '
'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).''; - print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer); - print ($object->trueDepth && $object->depth_units != '') ? ' '.measuringUnitString(0, "size", $object->depth_units) : ''; - print '
'; - print $langs->trans("Volume"); - print ''; - $calculatedVolume = 0; - $volumeUnit = 0; - if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); - $volumeUnit = $object->size_units * 3; - } - // If sending volume not defined we use sum of products - if ($calculatedVolume > 0) { - if ($volumeUnit < 50) { - print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); - } else { - print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); - } - } - if ($totalVolume > 0) { - if ($calculatedVolume) { - print ' ('.$langs->trans("SumOfProductVolumes").': '; - } - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); - //if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')'; - if ($calculatedVolume) { - print ')'; - } - } + print $objectsrc->getNomUrl(1, 'commande'); print "
'; - - print '
'; - print '
'; - print '
'; - - print ''; - - // Sending method - print ''; + } + if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { + print ''; + print '\n"; print ''; + } - // Tracking Number - print ''; + // Date creation + print ''; + print '\n"; + print ''; - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; + // Delivery date planned + print ''; + print ''; + + // Weight + print '
'; - print ''; - - if ($action != 'editshipping_method_id') { - print ''; - } - print '
'; - print $langs->trans('SendingMethod'); - print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).'
'; - print '
'; - if ($action == 'editshipping_method_id') { - print '
'; - print ''; - print ''; - $object->fetch_delivery_methods(); - print $form->selectarray("shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0, "", 1); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - print ''; - print '
'; - } else { - if ($object->shipping_method_id > 0) { - // Get code using getLabelFromKey - $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); - print $langs->trans("SendingMethod".strtoupper($code)); - } - } - print '
'; + print $langs->trans("RefProposal").''; + print $objectsrc->getNomUrl(1, 'expedition'); + print "
'.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).''; - print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'safehtmlstring', $object->tracking_number); - print '
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation, "dayhour")."
'; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($user->rights->expedition->creer) { - print ''.img_edit().''; - } else { - print ' '; - } - print '
'; - print '
'; - if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); - } - print '
'; + print ''; + + if ($action != 'editdate_livraison') { + print ''; + } + print '
'; + print $langs->trans('DateDeliveryPlanned'); + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; + print '
'; + if ($action == 'editdate_livraison') { + print '
'; + print ''; + print ''; + print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print ''; + print '
'; + } else { + print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; + } + print '
'; + print $form->editfieldkey("Weight", 'trueWeight', $object->trueWeight, $object, $user->rights->expedition->creer); + print ''; + + if ($action == 'edittrueWeight') { + print '
'; + print ''; + print ''; + print ''; + print ''; + print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2); + print ' '; + print ' '; + print '
'; + } else { + print $object->trueWeight; + print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; + } + + // Calculated + if ($totalWeight > 0) { + if (!empty($object->trueWeight)) { + print ' ('.$langs->trans("SumOfProductWeights").': '; } - - // Other attributes - $parameters = array('colspan' => ' colspan="3"', 'cols' => '3'); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print "
"; - - print '
'; - print ''; - - print '
'; - - - // Lines of products - - if ($action == 'editline') { - print '
- - - - - '; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); + if (!empty($object->trueWeight)) { + print ')'; } - print '
'; + } + print '
'; - print ''; - print ''; - // Adds a line numbering column - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - // Product/Service - print ''; - // Qty - print ''; - if ($origin && $origin_id > 0) { - print ''; - } - if ($action == 'editline') { - $editColspan = 3; - if (!isModEnabled('stock')) { - $editColspan--; - } - if (empty($conf->productbatch->enabled)) { - $editColspan--; - } - print ''; + // Width + print ''; + + // Height + print ''; + + // Depth + print ''; + + // Volume + print ''; + print ''; - } else { - print ''; - } - if (isModEnabled('stock')) { - print ''; - } - - if (isModEnabled('productbatch')) { - print ''; - } + print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); } - print ''; - print ''; - //print ''; - if ($object->statut == 0) { - print ''; - print ''; + } + if ($totalVolume > 0) { + if ($calculatedVolume) { + print ' ('.$langs->trans("SumOfProductVolumes").': '; } - print "\n"; - print ''; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); + //if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')'; + if ($calculatedVolume) { + print ')'; + } + } + print "\n"; + print ''; - $outputlangs = $langs; + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $object->fetch_thirdparty(); - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { - $newlang = GETPOST('lang_id', 'aZ09'); - } - if (empty($newlang)) { - $newlang = $object->thirdparty->default_lang; - } - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } + print '
 '.$langs->trans("Products").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyInOtherShipments").''; - if ($object->statut <= 1) { - print $langs->trans("QtyToShip").' - '; - } else { - print $langs->trans("QtyShipped").' - '; - } - if (isModEnabled('stock')) { - print $langs->trans("WarehouseSource").' - '; - } - if (isModEnabled('productbatch')) { - print $langs->trans("Batch"); - } - print '
'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).''; + print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer); + print ($object->trueWidth && $object->width_units != '') ? ' '.measuringUnitString(0, "size", $object->width_units) : ''; + print '
'.$form->editfieldkey("Height", 'trueHeight', $object->trueHeight, $object, $user->rights->expedition->creer).''; + if ($action == 'edittrueHeight') { + print ''; + print ''; + print ''; + print ''; + print ''; + print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units, 0, 2); + print ' '; + print ' '; + print ''; + } else { + print $object->trueHeight; + print ($object->trueHeight && $object->height_units != '') ? ' '.measuringUnitString(0, "size", $object->height_units) : ''; + } + + print '
'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).''; + print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer); + print ($object->trueDepth && $object->depth_units != '') ? ' '.measuringUnitString(0, "size", $object->depth_units) : ''; + print '
'; + print $langs->trans("Volume"); + print ''; + $calculatedVolume = 0; + $volumeUnit = 0; + if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { + $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); + $volumeUnit = $object->size_units * 3; + } + // If sending volume not defined we use sum of products + if ($calculatedVolume > 0) { + if ($volumeUnit < 50) { + print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); } else { - if ($object->statut <= 1) { - print ''.$langs->trans("QtyToShip").''.$langs->trans("QtyShipped").''.$langs->trans("WarehouseSource").''.$langs->trans("Batch").''.$langs->trans("CalculatedWeight").''.$langs->trans("CalculatedVolume").''.$langs->trans("Size").'
'; + + print ''; + print '
'; + print '
'; + + print ''; + + // Sending method + print ''; + print ''; + + // Tracking Number + print ''; + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + } + + // Other attributes + $parameters = array('colspan' => ' colspan="3"', 'cols' => '3'); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print "
'; + print ''; + + if ($action != 'editshipping_method_id') { + print ''; + } + print '
'; + print $langs->trans('SendingMethod'); + print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).'
'; + print '
'; + if ($action == 'editshipping_method_id') { + print '
'; + print ''; + print ''; + $object->fetch_delivery_methods(); + print $form->selectarray("shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0, "", 1); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print ''; + print '
'; + } else { + if ($object->shipping_method_id > 0) { + // Get code using getLabelFromKey + $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); + print $langs->trans("SendingMethod".strtoupper($code)); + } + } + print '
'.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).''; + print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'safehtmlstring', $object->tracking_number); + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->expedition->creer) { + print ''.img_edit().''; + } else { + print ' '; + } + print '
'; + print '
'; + if ($action != 'editincoterm') { + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); + } else { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
"; + + print '
'; + print ''; + + print '
'; + + + // Lines of products + + if ($action == 'editline') { + print '
+ + + + + '; + } + print '
'; + + print '
'; + print ''; + print ''; + print ''; + // Adds a line numbering column + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + // Product/Service + print ''; + // Qty + print ''; + if ($origin && $origin_id > 0) { + print ''; + } + if ($action == 'editline') { + $editColspan = 3; + if (!isModEnabled('stock')) { + $editColspan--; + } + if (empty($conf->productbatch->enabled)) { + $editColspan--; + } + print ''; + } else { + if ($object->statut <= 1) { + print ''; + } else { + print ''; + } + if (isModEnabled('stock')) { + print ''; } - // Get list of products already sent for same source object into $alreadysent - $alreadysent = array(); - if ($origin && $origin_id > 0) { - $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end"; - $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; - $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; - //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; - $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch'; - $sql .= ', p.description as product_desc'; - $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; - $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; - $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; - $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; - $sql .= " AND obj.fk_".$origin." = ".((int) $origin_id); - $sql .= " AND obj.rowid = ed.fk_origin_line"; - $sql .= " AND ed.fk_expedition = e.rowid"; - //if ($filter) $sql.= $filter; - $sql .= " ORDER BY obj.fk_product"; + if (isModEnabled('productbatch')) { + print ''; + } + } + print ''; + print ''; + //print ''; + if ($object->statut == 0) { + print ''; + print ''; + } + print "\n"; + print ''; - dol_syslog("expedition/card.php get list of shipment lines", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $outputlangs = $langs; - while ($i < $num) { - $obj = $db->fetch_object($resql); - if ($obj) { - // $obj->rowid is rowid in $origin."det" table - $alreadysent[$obj->rowid][$obj->shipmentline_id] = array( - 'shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, - 'product_tosell'=>$obj->product_tosell, 'product_tobuy'=>$obj->product_tobuy, 'product_tobatch'=>$obj->product_tobatch, - 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); - } - $i++; + if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $object->fetch_thirdparty(); + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if (empty($newlang)) { + $newlang = $object->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + } + + // Get list of products already sent for same source object into $alreadysent + $alreadysent = array(); + if ($origin && $origin_id > 0) { + $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end"; + $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; + $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; + //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch'; + $sql .= ', p.description as product_desc'; + $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; + $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; + $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; + $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; + $sql .= " AND obj.fk_".$origin." = ".((int) $origin_id); + $sql .= " AND obj.rowid = ed.fk_origin_line"; + $sql .= " AND ed.fk_expedition = e.rowid"; + //if ($filter) $sql.= $filter; + $sql .= " ORDER BY obj.fk_product"; + + dol_syslog("expedition/card.php get list of shipment lines", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) { + $obj = $db->fetch_object($resql); + if ($obj) { + // $obj->rowid is rowid in $origin."det" table + $alreadysent[$obj->rowid][$obj->shipmentline_id] = array( + 'shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, + 'product_tosell'=>$obj->product_tosell, 'product_tobuy'=>$obj->product_tobuy, 'product_tobatch'=>$obj->product_tobatch, + 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); } + $i++; } - //var_dump($alreadysent); + } + //var_dump($alreadysent); + } + + print ''; + + // Loop on each product to send/sent + for ($i = 0; $i < $num_prod; $i++) { + $parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => !empty($editColspan) ? $editColspan : 0, 'outputlangs' => $outputlangs); + $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - print ''; + if (empty($reshook)) { + print ''; // id of order line + print ''; - // Loop on each product to send/sent - for ($i = 0; $i < $num_prod; $i++) { - $parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => !empty($editColspan) ? $editColspan : 0, 'outputlangs' => $outputlangs); - $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + // # + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; } - if (empty($reshook)) { - print ''; // id of order line - print ''; - - // # - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - - // Predefined product or service - if ($lines[$i]->fk_product > 0) { - // Define output language - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $prod = new Product($db); - $prod->fetch($lines[$i]->fk_product); - $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; - } else { - $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); - } - - print '\n"; + // Predefined product or service + if ($lines[$i]->fk_product > 0) { + // Define output language + if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $prod = new Product($db); + $prod->fetch($lines[$i]->fk_product); + $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; } else { - print '\n"; + $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); } - $unit_order = ''; - if (!empty($conf->global->PRODUCT_USE_UNITS)) { - $unit_order = measuringUnitString($lines[$i]->fk_unit); + print '\n"; + } else { + print ''; + if (!empty($lines[$i]->label)) { + $text .= ' '.$lines[$i]->label.''; + print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i); + } else { + print $text.' '.nl2br($lines[$i]->description); + } - // Qty in other shipments (with shipment and warehouse used) - if ($origin && $origin_id > 0) { - print '\n"; + } - $j++; - if ($j > 1) { - print '
'; - } - $shipment_static->fetch($shipmentline_var['shipment_id']); - print $shipment_static->getNomUrl(1); - print ' - '.$shipmentline_var['qty_shipped']; - $htmltext = $langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($shipmentline_var['date_valid'], 'dayhour')); - if (isModEnabled('stock') && $shipmentline_var['warehouse'] > 0) { - $warehousestatic->fetch($shipmentline_var['warehouse']); - $htmltext .= '
'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1); - } - print ' '.$form->textwithpicto('', $htmltext, 1); + $unit_order = ''; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + $unit_order = measuringUnitString($lines[$i]->fk_unit); + } + + // Qty ordered + print ''; + + // Qty in other shipments (with shipment and warehouse used) + if ($origin && $origin_id > 0) { + print ''; } + print ''; + } - if ($action == 'editline' && $lines[$i]->id == $line_id) { - // edit mode - print ''; + } else { + // Qty to ship or shipped + print ''; + + // Warehouse source + if (isModEnabled('stock')) { + print ''; + } + + // Batch number managment + if (isModEnabled('productbatch')) { + if (isset($lines[$i]->detail_batch)) { + print ''; + print ''; - } - - // Batch number managment - if (isModEnabled('productbatch')) { - if (isset($lines[$i]->detail_batch)) { - print ''; - print ''; - } else { - print ''; - } - } - } - - // Weight - print ''; - - // Volume - print ''; - - // Size - //print ''; - - if ($action == 'editline' && $lines[$i]->id == $line_id) { - print ''; - } elseif ($object->statut == Expedition::STATUS_DRAFT) { - // edit-delete buttons - print ''; - print ''; - - // Display lines extrafields - if (!empty($rowExtrafieldsStart)) { - print $rowExtrafieldsStart; - print $rowExtrafieldsView; - print $rowEnd; - } - } - print ""; - - // Display lines extrafields. - // $line is a line of shipment - if (!empty($extrafields)) { - $colspan = 6; - if ($origin && $origin_id > 0) { - $colspan++; - } - if (isModEnabled('productbatch')) { - $colspan++; - } - if (isModEnabled('stock')) { - $colspan++; - } - - $line = $lines[$i]; - $line->fetch_optionals(); - - // TODO Show all in same line by setting $display_type = 'line' - if ($action == 'editline' && $line->id == $line_id) { - print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); } else { - print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print ''; } } } + + // Weight + print ''; + + // Volume + print ''; + + // Size + //print ''; + + if ($action == 'editline' && $lines[$i]->id == $line_id) { + print ''; + } elseif ($object->statut == Expedition::STATUS_DRAFT) { + // edit-delete buttons + print ''; + print ''; + + // Display lines extrafields + if (!empty($rowExtrafieldsStart)) { + print $rowExtrafieldsStart; + print $rowExtrafieldsView; + print $rowEnd; + } + } + print ""; + + // Display lines extrafields. + // $line is a line of shipment + if (!empty($extrafields)) { + $colspan = 6; + if ($origin && $origin_id > 0) { + $colspan++; + } + if (isModEnabled('productbatch')) { + $colspan++; + } + if (isModEnabled('stock')) { + $colspan++; + } + + $line = $lines[$i]; + $line->fetch_optionals(); + + // TODO Show all in same line by setting $display_type = 'line' + if ($action == 'editline' && $line->id == $line_id) { + print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + } else { + print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + } + } } - - // TODO Show also lines ordered but not delivered - - print "
 '.$langs->trans("Products").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyInOtherShipments").''; + if ($object->statut <= 1) { + print $langs->trans("QtyToShip").' - '; + } else { + print $langs->trans("QtyShipped").' - '; + } + if (isModEnabled('stock')) { + print $langs->trans("WarehouseSource").' - '; + } + if (isModEnabled('productbatch')) { + print $langs->trans("Batch"); + } + print ''.$langs->trans("QtyToShip").''.$langs->trans("QtyShipped").''.$langs->trans("WarehouseSource").''.$langs->trans("Batch").''.$langs->trans("CalculatedWeight").''.$langs->trans("CalculatedVolume").''.$langs->trans("Size").'
'.($i + 1).'
'.($i + 1).''; - - // Show product and description - $product_static->type = $lines[$i]->fk_product_type; - $product_static->id = $lines[$i]->fk_product; - $product_static->ref = $lines[$i]->ref; - $product_static->status = $lines[$i]->product_tosell; - $product_static->status_buy = $lines[$i]->product_tobuy; - $product_static->status_batch = $lines[$i]->product_tobatch; - - $product_static->weight = $lines[$i]->weight; - $product_static->weight_units = $lines[$i]->weight_units; - $product_static->length = $lines[$i]->length; - $product_static->length_units = $lines[$i]->length_units; - $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0; - $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0; - $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0; - $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0; - $product_static->surface = $lines[$i]->surface; - $product_static->surface_units = $lines[$i]->surface_units; - $product_static->volume = $lines[$i]->volume; - $product_static->volume_units = $lines[$i]->volume_units; - - $text = $product_static->getNomUrl(1); - $text .= ' - '.$label; - $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->description)); - print $form->textwithtooltip($text, $description, 3, '', '', $i); - print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : ''); - if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { - print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; - } - print "
'; - if ($lines[$i]->product_type == Product::TYPE_SERVICE) { - $text = img_object($langs->trans('Service'), 'service'); - } else { - $text = img_object($langs->trans('Product'), 'product'); - } - - if (!empty($lines[$i]->label)) { - $text .= ' '.$lines[$i]->label.''; - print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i); - } else { - print $text.' '.nl2br($lines[$i]->description); - } - - print_date_range($lines[$i]->date_start, $lines[$i]->date_end); - print "'; + + // Show product and description + $product_static->type = $lines[$i]->fk_product_type; + $product_static->id = $lines[$i]->fk_product; + $product_static->ref = $lines[$i]->ref; + $product_static->status = $lines[$i]->product_tosell; + $product_static->status_buy = $lines[$i]->product_tobuy; + $product_static->status_batch = $lines[$i]->product_tobatch; + + $product_static->weight = $lines[$i]->weight; + $product_static->weight_units = $lines[$i]->weight_units; + $product_static->length = $lines[$i]->length; + $product_static->length_units = $lines[$i]->length_units; + $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0; + $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0; + $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0; + $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0; + $product_static->surface = $lines[$i]->surface; + $product_static->surface_units = $lines[$i]->surface_units; + $product_static->volume = $lines[$i]->volume; + $product_static->volume_units = $lines[$i]->volume_units; + + $text = $product_static->getNomUrl(1); + $text .= ' - '.$label; + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->description)); + print $form->textwithtooltip($text, $description, 3, '', '', $i); + print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : ''); + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { + print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; + } + print "
'; + if ($lines[$i]->product_type == Product::TYPE_SERVICE) { + $text = img_object($langs->trans('Service'), 'service'); + } else { + $text = img_object($langs->trans('Product'), 'product'); } - // Qty ordered - print ''.$lines[$i]->qty_asked.' '.$unit_order.''; - foreach ($alreadysent as $key => $val) { - if ($lines[$i]->fk_origin_line == $key) { - $j = 0; - foreach ($val as $shipmentline_id => $shipmentline_var) { - if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) { - continue; // We want to show only "other shipments" - } + print_date_range($lines[$i]->date_start, $lines[$i]->date_end); + print "'.$lines[$i]->qty_asked.' '.$unit_order.''; + foreach ($alreadysent as $key => $val) { + if ($lines[$i]->fk_origin_line == $key) { + $j = 0; + foreach ($val as $shipmentline_id => $shipmentline_var) { + if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) { + continue; // We want to show only "other shipments" } + + $j++; + if ($j > 1) { + print '
'; + } + $shipment_static->fetch($shipmentline_var['shipment_id']); + print $shipment_static->getNomUrl(1); + print ' - '.$shipmentline_var['qty_shipped']; + $htmltext = $langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($shipmentline_var['date_valid'], 'dayhour')); + if (isModEnabled('stock') && $shipmentline_var['warehouse'] > 0) { + $warehousestatic->fetch($shipmentline_var['warehouse']); + $htmltext .= '
'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1); + } + print ' '.$form->textwithpicto('', $htmltext, 1); } } - print '
'; - if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) { - print ''; - $line = new ExpeditionLigne($db); - foreach ($lines[$i]->detail_batch as $detail_batch) { - print ''; - // Qty to ship or shipped - print ''; - // Batch number managment - if ($lines[$i]->entrepot_id == 0) { - // only show lot numbers from src warehouse when shipping from multiple warehouses - $line->fetch($detail_batch->fk_expeditiondet); - } - $entrepot_id = !empty($detail_batch->entrepot_id)?$detail_batch->entrepot_id:$lines[$i]->entrepot_id; - print ''; - print ''; - } - // add a 0 qty lot row to be able to add a lot + if ($action == 'editline' && $lines[$i]->id == $line_id) { + // edit mode + print ''; - } else { + } elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. + print ''; + print ''; // Qty to ship or shipped - print ''; - + print ''; // Warehouse source - if (isModEnabled('stock')) { - print ''; + // Batch number managment + print ''; + print ''; + } + + print '
'.$formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $entrepot_id).'
'; + if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) { + print ''; + $line = new ExpeditionLigne($db); + foreach ($lines[$i]->detail_batch as $detail_batch) { print ''; // Qty to ship or shipped - print ''; + print ''; // Batch number managment - print ''; + if ($lines[$i]->entrepot_id == 0) { + // only show lot numbers from src warehouse when shipping from multiple warehouses + $line->fetch($detail_batch->fk_expeditiondet); + } + $entrepot_id = !empty($detail_batch->entrepot_id)?$detail_batch->entrepot_id:$lines[$i]->entrepot_id; + print ''; print ''; - } elseif (isModEnabled('stock')) { - if ($lines[$i]->fk_product > 0) { - if ($lines[$i]->entrepot_id > 0) { - print ''; - print ''; - // Qty to ship or shipped - print ''; - // Warehouse source - print ''; - // Batch number managment - print ''; - print ''; - } elseif (count($lines[$i]->details_entrepot) > 1) { - print ''; - foreach ($lines[$i]->details_entrepot as $detail_entrepot) { - print ''; - // Qty to ship or shipped - print ''; - // Warehouse source - print ''; - // Batch number managment - print ''; - print ''; - } - } else { - print ''; - print ''; - } - } else { - print ''; + } + // add a 0 qty lot row to be able to add a lot + print ''; + // Qty to ship or shipped + print ''; + // Batch number managment + print ''; + print ''; + } elseif (isModEnabled('stock')) { + if ($lines[$i]->fk_product > 0) { + if ($lines[$i]->entrepot_id > 0) { + print ''; print ''; // Qty to ship or shipped print ''; // Warehouse source - print ''; + print ''; // Batch number managment - print ''; + print ''; print ''; + } elseif (count($lines[$i]->details_entrepot) > 1) { + print ''; + foreach ($lines[$i]->details_entrepot as $detail_entrepot) { + print ''; + // Qty to ship or shipped + print ''; + // Warehouse source + print ''; + // Batch number managment + print ''; + print ''; + } + } else { + print ''; + print ''; } - } elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. - print ''; + } else { + print ''; print ''; // Qty to ship or shipped - print ''; + print ''; // Warehouse source print ''; // Batch number managment print ''; print ''; } - - print '
'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).''.$formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $entrepot_id).'
'.$unit_order.''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").'
'.$unit_order.''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").'
'.$langs->trans("NotEnoughStock").'
'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'
'.$unit_order.''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").'
'.$unit_order.''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").'
'.$langs->trans("NotEnoughStock").'
'.$unit_order.'
'.$lines[$i]->qty_shipped.' '.$unit_order.''; - if ($lines[$i]->entrepot_id > 0) { - $entrepot = new Entrepot($db); - $entrepot->fetch($lines[$i]->entrepot_id); - print $entrepot->getNomUrl(1); - } elseif (count($lines[$i]->details_entrepot) > 1) { - $detail = ''; - foreach ($lines[$i]->details_entrepot as $detail_entrepot) { - if ($detail_entrepot->entrepot_id > 0) { - $entrepot = new Entrepot($db); - $entrepot->fetch($detail_entrepot->entrepot_id); - $detail .= $langs->trans("DetailWarehouseFormat", $entrepot->libelle, $detail_entrepot->qty_shipped).'
'; - } + print '
'.$lines[$i]->qty_shipped.' '.$unit_order.''; + if ($lines[$i]->entrepot_id > 0) { + $entrepot = new Entrepot($db); + $entrepot->fetch($lines[$i]->entrepot_id); + print $entrepot->getNomUrl(1); + } elseif (count($lines[$i]->details_entrepot) > 1) { + $detail = ''; + foreach ($lines[$i]->details_entrepot as $detail_entrepot) { + if ($detail_entrepot->entrepot_id > 0) { + $entrepot = new Entrepot($db); + $entrepot->fetch($detail_entrepot->entrepot_id); + $detail .= $langs->trans("DetailWarehouseFormat", $entrepot->libelle, $detail_entrepot->qty_shipped).'
'; } - print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"), $detail); + } + print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"), $detail); + } + print '
'; + if ($lines[$i]->product_tobatch) { + $detail = ''; + foreach ($lines[$i]->detail_batch as $dbatch) { // $dbatch is instance of ExpeditionLineBatch + $detail .= $langs->trans("Batch").': '.$dbatch->batch; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + } + $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; + $detail .= '
'; + } + print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); + } else { + print $langs->trans("NA"); } print '
'; - if ($lines[$i]->product_tobatch) { - $detail = ''; - foreach ($lines[$i]->detail_batch as $dbatch) { // $dbatch is instance of ExpeditionLineBatch - $detail .= $langs->trans("Batch").': '.$dbatch->batch; - if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); - } - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); - } - $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; - $detail .= '
'; - } - print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); - } else { - print $langs->trans("NA"); - } - print '
'; - if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) { - print $lines[$i]->weight * $lines[$i]->qty_shipped.' '.measuringUnitString(0, "weight", $lines[$i]->weight_units); - } else { - print ' '; - } - print ''; - if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) { - print $lines[$i]->volume * $lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units); - } else { - print ' '; - } - print ''.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units).''; - print '
'; - print '
'; - print '
'; - print 'id.'">'.img_edit().''; - print ''; - print 'id.'">'.img_delete().''; - print '
'; + if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) { + print $lines[$i]->weight * $lines[$i]->qty_shipped.' '.measuringUnitString(0, "weight", $lines[$i]->weight_units); + } else { + print ' '; + } + print ''; + if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) { + print $lines[$i]->volume * $lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units); + } else { + print ' '; + } + print ''.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units).''; + print '
'; + print '
'; + print '
'; + print 'id.'">'.img_edit().''; + print ''; + print 'id.'">'.img_delete().''; + print '
\n"; - print ''; - print '
'; } + // TODO Show also lines ordered but not delivered + + print "\n"; + print ''; + print ''; + print dol_get_fiche_end(); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 9394269a03a..2adf16e4c35 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -329,7 +329,7 @@ if ($id > 0 || !empty($ref)) { $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; } - print ''.$langs->trans('Discounts').''; + print ''.$langs->trans('Discounts').''; $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); @@ -393,7 +393,7 @@ if ($id > 0 || !empty($ref)) { print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).''; } print ''; - print ''; + print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); } else { @@ -450,7 +450,7 @@ if ($id > 0 || !empty($ref)) { print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).''; } print ''; - print ''; + print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { @@ -500,11 +500,11 @@ if ($id > 0 || !empty($ref)) { $totalVolume = $tmparray['volume']; if ($totalWeight || $totalVolume) { print ''.$langs->trans("CalculatedWeight").''; - print ''; + print ''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); print ''; print ''.$langs->trans("CalculatedVolume").''; - print ''; + print ''; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); print ''; } @@ -524,7 +524,7 @@ if ($id > 0 || !empty($ref)) { } print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f559c31a89f..3e61571dea5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2415,7 +2415,7 @@ if ($action == 'create') { // Show object lines if (!empty($object->lines)) { - $ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); + $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); } $num = count($object->lines); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6bc9ae679bb..50e450be105 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3628,7 +3628,7 @@ if ($action == 'create') { // Show object lines if (!empty($object->lines)) { - $ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); + $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); } $num = count($object->lines); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 69e7e40c16b..1d8075c21ea 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -1058,8 +1058,8 @@ class KnowledgeRecord extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f17a128544a..887ef6e1a44 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -6111,8 +6111,8 @@ class Product extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index b47430bffc2..e70c67412ee 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -895,8 +895,8 @@ class Entrepot extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ccefdb4c600..c8d3be0163d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2289,8 +2289,8 @@ class Project extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3643a404863..dd5ccd7ef0b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4886,7 +4886,7 @@ class Societe extends CommonObject * Existing categories are left untouch. * * @param int[]|int $categories Category ID or array of Categories IDs - * @param string $type_categ Category type ('customer' or 'supplier') + * @param string $type_categ Category type ('customer' or 'supplier') * @return int <0 if KO, >0 if OK */ public function setCategories($categories, $type_categ) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 71d9668dc92..4b898a75645 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1322,7 +1322,8 @@ if ($action == 'create') { // Shipping Method if (isModEnabled("expedition")) { print ''.$langs->trans('SendingMethod').''; - print $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : "", 'shipping_method_id', '', 1); + print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"'); + $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : "", 'shipping_method_id', '', 1); print ''; } @@ -1902,7 +1903,7 @@ if ($action == 'create') { } if (!empty($object->lines)) { - $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector); + $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector); } // Form to add new line diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d077ed3e777..27cdf8d164b 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2318,8 +2318,8 @@ class Ticket extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 75c9f1b2bae..dddcaa0ca6a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1390,8 +1390,8 @@ class User extends CommonObject * Adds it to non existing supplied categories. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category or categories IDs + * @return int <0 if KO, >0 if OK */ public function setCategories($categories) { From 1934db2dd103da100c3104d9bba4722d56f11a7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 14:37:33 +0100 Subject: [PATCH 166/370] Debug v17 --- htdocs/core/modules/import/import_csv.modules.php | 2 +- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- htdocs/core/modules/movement/doc/pdf_standard.modules.php | 8 +++++++- htdocs/debugbar/class/TraceableDB.php | 2 +- htdocs/install/upgrade2.php | 4 +++- htdocs/projet/tasks/task.php | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e1699660acc..075de9f0d2a 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -579,7 +579,7 @@ class ImportCsv extends ModeleImports } } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') { if (strtolower($newval) == 'auto') { - $newval = $this->thirdpartyobject->get_codefournisseur(0, 1); + $this->thirdpartyobject->get_codefournisseur(0, 1); $newval = $this->thirdpartyobject->code_fournisseur; //print 'code_fournisseur='.$newval; } diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0e63ea77075..0854a0f56c5 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -624,7 +624,7 @@ class ImportXlsx extends ModeleImports } } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') { if (strtolower($newval) == 'auto') { - $newval = $this->thirdpartyobject->get_codefournisseur(0, 1); + $this->thirdpartyobject->get_codefournisseur(0, 1); $newval = $this->thirdpartyobject->code_fournisseur; //print 'code_fournisseur='.$newval; } diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 094e19a280a..a823eadbc05 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -941,7 +941,7 @@ class pdf_standard extends ModelePDFMovement * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document - * @return void + * @return int Return topshift value */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "") { @@ -1108,8 +1108,13 @@ class pdf_standard extends ModelePDFMovement $posy += 2; + $top_shift = 0; // Show list of linked objects + $current_y = $pdf->getY(); //$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + //if ($current_y < $pdf->getY()) { + // $top_shift = $pdf->getY() - $current_y; + //} if ($showaddress) { /* @@ -1146,6 +1151,7 @@ class pdf_standard extends ModelePDFMovement } $pdf->SetTextColor(0, 0, 0); + return $top_shift; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 0b862f4df70..5863f1d902e 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -661,7 +661,7 @@ class TraceableDB extends DoliDB */ public function free($resultset = null) { - return $this->db->free($resultset); + $this->db->free($resultset); } /** diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index bbb12e8693e..51334eaae21 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4485,7 +4485,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @return void + * @return int <0 if KO, >0 if OK */ function migrate_reload_menu($db, $langs, $conf) { @@ -4515,6 +4515,8 @@ function migrate_reload_menu($db, $langs, $conf) print ''; } + + return 1; } /** diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8b19c8c0519..fccf9d2ffe1 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -467,7 +467,7 @@ if ($id > 0 || !empty($ref)) { // Task parent print ''.$langs->trans("ChildOfProjectTask").''; - print $formother->selectProjectTasks($object->fk_task_parent, $projectstatic->id, 'task_parent', ($user->admin ? 0 : 1), 0, 0, 0, $object->id); + $formother->selectProjectTasks($object->fk_task_parent, $projectstatic->id, 'task_parent', ($user->admin ? 0 : 1), 0, 0, 0, $object->id); print ''; // Date start From 26ef1cb27088c78402779c8fa3b195348079c447 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 14:43:31 +0100 Subject: [PATCH 167/370] Debug v17 --- .../modules/expedition/doc/pdf_espadon.modules.php | 11 ++++++++++- .../modules/expedition/doc/pdf_merou.modules.php | 14 +++++++++++++- .../modules/expedition/doc/pdf_rouget.modules.php | 13 ++++++++++++- .../class/conferenceorbooth.class.php | 5 ++--- htdocs/hrm/class/evaluation.class.php | 4 ++-- htdocs/hrm/class/evaluationdet.class.php | 7 ++++--- htdocs/hrm/class/job.class.php | 4 ++-- htdocs/hrm/class/position.class.php | 4 ++-- htdocs/hrm/class/skill.class.php | 4 ++-- htdocs/hrm/class/skillrank.class.php | 4 ++-- .../class/knowledgerecord.class.php | 4 ++-- htdocs/mrp/class/mo.class.php | 4 ++-- htdocs/partnership/class/partnership.class.php | 4 ++-- .../stocktransfer/class/stocktransfer.class.php | 4 ++-- .../class/stocktransferline.class.php | 4 ++-- .../class/recruitmentcandidature.class.php | 4 ++-- htdocs/webhook/class/target.class.php | 4 ++-- htdocs/workstation/class/workstation.class.php | 4 ++-- 18 files changed, 67 insertions(+), 35 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index b87298d3dd8..d486a56bb08 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -945,7 +945,7 @@ class pdf_espadon extends ModelePdfExpedition * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return int <0 if KO, > if OK */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { @@ -1078,6 +1078,14 @@ class pdf_espadon extends ModelePdfExpedition } } + $top_shift = 0; + // Show list of linked objects + /*$current_y = $pdf->getY(); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); + if ($current_y < $pdf->getY()) { + $top_shift = $pdf->getY() - $current_y; + }*/ + if ($showaddress) { // Sender properties $carac_emetteur = ''; @@ -1183,6 +1191,7 @@ class pdf_espadon extends ModelePdfExpedition } $pdf->SetTextColor(0, 0, 0); + return $top_shift; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index e847dc26fec..2bf6e583826 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -520,7 +520,7 @@ class pdf_merou extends ModelePdfExpedition * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return int <0 if KO, > if OK */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { @@ -700,6 +700,16 @@ class pdf_merou extends ModelePdfExpedition $widthrecbox = $blW; + $top_shift = 0; + // Show list of linked objects + /* + $current_y = $pdf->getY(); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); + if ($current_y < $pdf->getY()) { + $top_shift = $pdf->getY() - $current_y; + } + */ + // Show Recipient frame $pdf->SetFont('', 'B', $default_font_size - 3); $pdf->SetXY($blDestX, $Yoff - 4); @@ -717,5 +727,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetFont('', '', $default_font_size - 3); $pdf->SetXY($blDestX, $posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); + + return $top_shift; } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 71fb4c4c194..2c7af07b32f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -890,7 +890,7 @@ class pdf_rouget extends ModelePdfExpedition * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return int <0 if KO, > if OK */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { @@ -1023,6 +1023,16 @@ class pdf_rouget extends ModelePdfExpedition } } + $top_shift = 0; + // Show list of linked objects + /* + $current_y = $pdf->getY(); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); + if ($current_y < $pdf->getY()) { + $top_shift = $pdf->getY() - $current_y; + } + */ + if ($showaddress) { // Sender properties $carac_emetteur = ''; @@ -1128,6 +1138,7 @@ class pdf_rouget extends ModelePdfExpedition } $pdf->SetTextColor(0, 0, 0); + return $top_shift; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index cdb67a2c37b..556443a25e8 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -217,7 +217,6 @@ class ConferenceOrBooth extends ActionComm $this->socid = $this->fk_soc; $this->datef = $this->datep2; $this->note_private = $this->note; - $this->fk_user_author = $this->fk_user_author; } /** @@ -716,8 +715,8 @@ class ConferenceOrBooth extends ActionComm $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorbooth = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 0125e7f882c..23ccc6c9fd2 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -923,8 +923,8 @@ class Evaluation extends CommonObject $result = $objectline->fetchAll('ASC', '', 0, 0, array('customsql'=>'fk_evaluation = '.$this->id)); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index f9bbde51912..5489065e52d 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -561,7 +561,8 @@ class Evaluationline extends CommonObject $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'evaluationline/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->error = $this->db->lasterror(); + $error++; + $this->error = $this->db->lasterror(); } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments @@ -891,8 +892,8 @@ class Evaluationline extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_evaluationdet = '.$this->id)); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 117878c10c9..a08e8c713ae 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -925,8 +925,8 @@ class Job extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_job = '.$this->id)); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 5d0c04a4f47..b72c11b36f6 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -971,8 +971,8 @@ class Position extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = ' . $this->id)); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 0cdc63ec24e..3f56294a7b2 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -965,8 +965,8 @@ class Skill extends CommonObject $result = $objectline->fetchAll('ASC', 'rankorder', 0, 0, array('customsql'=>'fk_skill = '.$this->id)); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 6db80642bab..2d75425823e 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -919,8 +919,8 @@ class SkillRank extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_skillrank = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 1d8075c21ea..bf2bf38bbef 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -918,8 +918,8 @@ class KnowledgeRecord extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_knowledgerecord = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 13f7cc5ae7b..30d6a3660a3 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1275,8 +1275,8 @@ class Mo extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, $TFilters); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 5908b964f2c..d7242f4e16c 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1158,8 +1158,8 @@ class Partnership extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_partnership = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index 5ffb56ced44..60f13396b80 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -911,8 +911,8 @@ class StockTransfer extends CommonObject $result = $objectline->fetchAll('ASC', 'rang', 0, 0, array('customsql'=>'fk_stocktransfer = '.$this->id)); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index 14febad09d4..4ee2f1db631 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -915,8 +915,8 @@ class StockTransferLine extends CommonObjectLine $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_stocktransferline = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 2ece5dbe217..1690f13da56 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -894,8 +894,8 @@ class RecruitmentCandidature extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_recruitmentcandidature = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index ba33f2b8995..51a2a1beffa 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -911,8 +911,8 @@ class Target extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_target = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 1213929fed9..d3b098784da 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -919,8 +919,8 @@ class Workstation extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_workstation = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } From 169dcba95904584411bc86706c4da4b5241af091 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 14:54:06 +0100 Subject: [PATCH 168/370] Fix qodana --- htdocs/fourn/commande/list.php | 2 +- qodana.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3080a184abb..f02d2df24ca 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1203,7 +1203,7 @@ if ($resql) { $topicmail = "SendOrderRef"; $modelmail = "order_supplier_send"; - $objecttmp = new CommandeFournisseur($db); + $objecttmp = new CommandeFournisseur($db); // in case $object is not the good object $trackid = 'sord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; diff --git a/qodana.yaml b/qodana.yaml index 361afb8967f..36c35ece4c6 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -68,7 +68,10 @@ exclude: - name: PhpPropertyOnlyWrittenInspection - name: PhpCoveredCharacterInClassInspection - name: PhpSameParameterValueInspection + - name: PhpSillyAssignmentInspection - name: PhpConditionCheckedByNextConditionInspection - - name: RegExpSingleCharAlternation + - name: RegExpSingleCharAlternation - name: PhpSuspiciousNameCombinationInspection + - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection + \ No newline at end of file From cbda0e6197d1005ab02dc5506bb745507b830f0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 15:17:37 +0100 Subject: [PATCH 169/370] Fix warnings --- htdocs/comm/action/card.php | 2 +- htdocs/core/boxes/box_activity.php | 32 ++++++++++++++----- htdocs/core/class/commonobject.class.php | 4 +-- .../modules/mrp/doc/pdf_vinci.modules.php | 8 ++--- htdocs/hrm/class/evaluation.class.php | 2 +- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d1329e40454..91eb9f49516 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1353,7 +1353,7 @@ if ($action == 'create') { if (empty($donotclearsession)) { $assignedtouser = GETPOST("assignedtouser") ?GETPOST("assignedtouser") : (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id); if ($assignedtouser) { - $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first + $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0); // Owner first } //$listofuserid[$user->id] = array('id'=>$user->id, 'mandatory'=>0, 'transparency'=>(GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 1)); // 1 by default at first init $listofuserid[$assignedtouser]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 1); // 1 by default at first init diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 4829b32a72a..ea45580e163 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -155,7 +155,7 @@ class box_activity extends ModeleBoxes while ($j < count($data)) { $this->info_box_contents[$line][0] = array( 'td' => 'class="left" width="16"', - 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut, + 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".((int) $data[$j]->fk_statut), 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0), 'logo' => 'object_propal' ); @@ -169,7 +169,7 @@ class box_activity extends ModeleBoxes 'td' => 'class="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0), - 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut, + 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".((int) $data[$j]->fk_statut), ); $totalnb += $data[$j]->nb; @@ -185,6 +185,13 @@ class box_activity extends ModeleBoxes $line++; $j++; } + if (count($data) == 0) { + $this->info_box_contents[$line][0] = array( + 'td' => 'class="center"', + 'text'=>$langs->trans("NoRecordedProposals"), + ); + $line++; + } } } @@ -273,6 +280,13 @@ class box_activity extends ModeleBoxes $line++; $j++; } + if (count($data) == 0) { + $this->info_box_contents[$line][0] = array( + 'td' => 'class="center"', + 'text'=>$langs->trans("NoRecordedOrders"), + ); + $line++; + } } } @@ -329,11 +343,11 @@ class box_activity extends ModeleBoxes if (!empty($data)) { $j = 0; while ($j < count($data)) { - $billurl = "search_status=2&paye=1"; + $billurl = "search_status=2&paye=1"; $this->info_box_contents[$line][0] = array( 'td' => 'class="left" width="16"', 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0), - 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", 'logo' => 'bill', ); @@ -346,7 +360,7 @@ class box_activity extends ModeleBoxes 'td' => 'class="right"', 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0), 'text' => $data[$j]->nb, - 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", ); $this->info_box_contents[$line][3] = array( @@ -369,6 +383,7 @@ class box_activity extends ModeleBoxes 'td' => 'class="center"', 'text'=>$langs->trans("NoRecordedInvoices"), ); + $line++; } } @@ -412,11 +427,11 @@ class box_activity extends ModeleBoxes $j = 0; while ($j < count($data)) { - $billurl = "search_status=".$data[$j]->fk_statut."&paye=0"; + $billurl = "search_status=".$data[$j]->fk_statut."&paye=0"; $this->info_box_contents[$line][0] = array( 'td' => 'class="left" width="16"', 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0), - 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", 'logo' => 'bill', ); @@ -446,8 +461,9 @@ class box_activity extends ModeleBoxes if (count($data) == 0) { $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', - 'text'=>$langs->trans("NoRecordedInvoices"), + 'text'=>$langs->trans("NoRecordedUnpaidInvoices"), ); + $line++; } } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f8a48f49d40..aafed5900d8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6457,9 +6457,9 @@ abstract class CommonObject return -1; } elseif ($value == '') { $new_array_languages[$key] = null; + } else { + $new_array_languages[$key] = $value; } - //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); - $new_array_languages[$key] = $value; break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 1416992e3c5..8e3eeeafa33 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -1405,14 +1405,13 @@ class pdf_vinci extends ModelePDFMo $rank = 0; $this->cols['code'] = array( 'rank' => $rank, - 'status' => false, + 'status' => true, 'width' => 35, // in mm 'title' => array( 'textkey' => 'Ref' ), 'border-left' => true, // add left line separator ); - $this->cols['code']['status'] = true; $rank = 1; // do not use negative rank $this->cols['desc'] = array( @@ -1455,14 +1454,13 @@ class pdf_vinci extends ModelePDFMo $rank = $rank + 10; $this->cols['dim'] = array( 'rank' => $rank, - 'status' => false, + 'status' => true, 'width' => 25, // in mm 'title' => array( 'textkey' => 'Size' ), 'border-left' => true, // add left line separator ); - $this->cols['dim']['status'] = true; $rank = $rank + 10; $this->cols['qty'] = array( @@ -1474,7 +1472,6 @@ class pdf_vinci extends ModelePDFMo ), 'border-left' => true, // add left line separator ); - $this->cols['qty']['status'] = true; $rank = $rank + 10; $this->cols['qtytot'] = array( @@ -1486,7 +1483,6 @@ class pdf_vinci extends ModelePDFMo ), 'border-left' => true, // add left line separator ); - $this->cols['qtytot']['status'] = true; // Add extrafields cols if (!empty($object->lines)) { diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 23ccc6c9fd2..4a41f1c8e0e 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -853,7 +853,7 @@ class Evaluation extends CommonObject $this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Closed'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Closed'); + $this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Closed'); } $statusType = 'status'.$status; From f8451ffc568a7b7666658eb0e06e63c2c46b3857 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 15:52:03 +0100 Subject: [PATCH 170/370] Debug v17 --- htdocs/admin/multicurrency.php | 3 ++- htdocs/hrm/class/job.class.php | 21 ++++++++----------- htdocs/hrm/class/position.class.php | 4 +++- .../class/multicurrency.class.php | 18 ++++++++-------- htdocs/multicurrency/multicurrency_rate.php | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 1cf838c08cb..5945ebfb5d5 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -134,7 +134,8 @@ if ($action == 'add_currency') { dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha')); //dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha')); } else { - $result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); + $multiurrency = new MultiCurrency($db); + $result = $multiurrency->syncRates(getDolGlobalString('MULTICURRENCY_APP_ID')); if ($result > 0) { setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs"); } diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index a08e8c713ae..93950979a1a 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -600,30 +600,27 @@ class Job extends CommonObject } /** - * Get last job for user + * Get the last occupied position for a user * - * @param int $fk_user id of user we need to get last job - * @return mixed|string|null + * @param int $fk_user Id of user we need to get last job + * @return Position|string Last occupied position */ public function getLastJobForUser($fk_user) { - global $db; - - $j = new Job($db); - $Tab = $j->getForUser($fk_user); + $Tab = $this->getForUser($fk_user); if (empty($Tab)) return ''; - $job = array_shift($Tab); + $lastpos = array_shift($Tab); - return $job; + return $lastpos; } /** - * Get jobs for user + * Get array of occupied positions for a user * - * @param int $userid id of user we need to get job list - * @return array of jobs + * @param int $userid Id of user we need to get job list + * @return Position[] Array of occupied positions */ public function getForUser($userid) { diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index b72c11b36f6..98b5fd89be9 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -1036,6 +1036,8 @@ class Position extends CommonObject } /** + * getForUser + * * @param int $userid id of user we need to get position list * @return array|int of positions of user with for each of them the job fetched into that array */ @@ -1049,7 +1051,7 @@ class Position extends CommonObject } /** - * Create a document onto disk according to template module. + * Create a document onto disk according to template module. * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs objet lang a utiliser pour traduction diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 8b42f7cb25b..da1b9f653b3 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -428,7 +428,7 @@ class MultiCurrency extends CommonObject * * @param string $code currency code * @param double $rate new rate - * @return int -1 if KO, 1 if OK, 2 if label found and OK + * @return int -1 if KO, 1 if OK, 2 if label found and OK */ public function addRateFromDolibarr($code, $rate) { @@ -609,14 +609,14 @@ class MultiCurrency extends CommonObject * @param stdClass $TRate Object containing all currencies rates * @return int -1 if KO, 0 if nothing, 1 if OK */ - public static function recalculRates(&$TRate) + public function recalculRates(&$TRate) { global $conf; - if ($conf->currency != $conf->global->MULTICURRENCY_APP_SOURCE) { + if ($conf->currency != getDolGlobalString('MULTICURRENCY_APP_SOURCE')) { $alternate_source = 'USD'.$conf->currency; - if (!empty($TRate->{$alternate_source})) { - $coef = $TRate->USDUSD / $TRate->{$alternate_source}; + if (!empty($TRate->$alternate_source)) { + $coef = $TRate->USDUSD / $TRate->$alternate_source; foreach ($TRate as $attr => &$rate) { $rate *= $coef; } @@ -637,7 +637,7 @@ class MultiCurrency extends CommonObject * @param int $addifnotfound Add if not found * @return int <0 if KO, >0 if OK */ - public static function syncRates($key, $addifnotfound = 0) + public function syncRates($key, $addifnotfound = 0) { global $conf, $db, $langs; @@ -656,16 +656,16 @@ class MultiCurrency extends CommonObject if ($response->success) { $TRate = $response->quotes; - $timestamp = $response->timestamp; + //$timestamp = $response->timestamp; - if (self::recalculRates($TRate) >= 0) { + if ($this->recalculRates($TRate) >= 0) { foreach ($TRate as $currency_code => $rate) { $code = substr($currency_code, 3, 3); $obj = new MultiCurrency($db); if ($obj->fetch(null, $code) > 0) { $obj->updateRate($rate); } elseif ($addifnotfound) { - self::addRateFromDolibarr($code, $rate); + $this->addRateFromDolibarr($code, $rate); } } } diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 03e5e09334a..8b9bbf4eef6 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -271,7 +271,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) { print ' '.$langs->trans('Date').''; print ' '; - print $form->selectDate($dateinput, 'dateinput', 0, 0, 1); + print $form->selectDate($dateinput, 'dateinput', 0, 0, 1, '', 1, 1); print ''; print ' '.$langs->trans('Currency').''; From 7d433e43fac407083b508e98b77ec6e7feaacb16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 16:24:32 +0100 Subject: [PATCH 171/370] Add hooks on payment pages --- htdocs/core/class/hookmanager.class.php | 1 + htdocs/core/lib/payments.lib.php | 11 +++++++++-- htdocs/public/payment/newpayment.php | 8 +------- htdocs/public/payment/paymentok.php | 23 ++++++++++++++++++++--- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 191887e1725..71a92ebb6b1 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -197,6 +197,7 @@ class HookManager 'getFormatedSupplierRef', 'getIdProfUrl', 'getInputIdProf', + 'isPaymentOK', 'menuDropdownQuickaddItems', 'menuLeftMenuItems', 'moveUploadedFile', diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 44691f7c2c4..d5ddb158d6d 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -146,7 +146,7 @@ function payment_supplier_prepare_head(Paiement $object) */ function getValidOnlinePaymentMethods($paymentmethod = '') { - global $conf, $langs; + global $conf, $langs, $hookmanager, $action; $validpaymentmethod = array(); @@ -162,8 +162,15 @@ function getValidOnlinePaymentMethods($paymentmethod = '') $langs->load("stripe"); $validpaymentmethod['stripe'] = 'valid'; } - // TODO Add trigger + // This hook is used to complete the $validpaymentmethod array so an external payment modules + // can add its own key (ie 'payzen' for Payzen, ...) + $parameters = [ + 'paymentmethod' => $paymentmethod, + 'validpaymentmethod' => &$validpaymentmethod + ]; + $tmpobject = new stdClass(); + $hookmanager->executeHooks('doValidatePayment', $parameters, $tmpobject, $action); return $validpaymentmethod; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index e9823f2d0f7..c4b2d502d3d 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -281,15 +281,9 @@ if ((empty($paymentmethod) || $paymentmethod == 'stripe') && isModEnabled('strip } // Initialize $validpaymentmethod +// The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods() $validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); -// This hook is used to push to $validpaymentmethod by external payment modules (ie Payzen, ...) -$parameters = [ - 'paymentmethod' => $paymentmethod, - 'validpaymentmethod' => &$validpaymentmethod -]; -$reshook = $hookmanager->executeHooks('doValidatePayment', $parameters, $object, $action); - // Check security token $tmpsource = $source; if ($tmpsource == 'membersubscription') { diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 6d50d1c8c76..3bfdfc5f089 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -54,13 +54,14 @@ if (is_numeric($entity)) { require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; - if (isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } +// Hook to be used by external payment modules (ie Payzen, ...) +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('newpayment')); $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal")); @@ -337,6 +338,16 @@ if (isModEnabled('stripe')) { } } +// Check status of the object to verify if it is paid by external payment modules +$action = ''; +$parameters = [ + 'paymentmethod' => $paymentmethod, +]; +$reshook = $hookmanager->executeHooks('isPaymentOK', $parameters, $object, $action); +if ($reshook >= 0) { + $ispaymentok = $hookmanager->resArray['ispaymentok']; +} + // If data not provided from back url, search them into the session env if (empty($ipaddress)) { @@ -1142,6 +1153,8 @@ if ($ispaymentok) { // (we need first that the donation module is able to generate a pdf document for the cerfa with pre filled content) } elseif (array_key_exists('ATT', $tmptag) && $tmptag['ATT'] > 0) { // Record payment for registration to an event for an attendee + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); $result = $object->fetch($ref); @@ -1355,6 +1368,8 @@ if ($ispaymentok) { } } elseif (array_key_exists('BOO', $tmptag) && $tmptag['BOO'] > 0) { // Record payment for booth or conference + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); $result = $object->fetch($ref); @@ -1461,6 +1476,8 @@ if ($ispaymentok) { if (!$error) { // Putting the booth to "suggested" state + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; $booth = new ConferenceOrBooth($db); $resultbooth = $booth->fetch((int) $tmptag['BOO']); if ($resultbooth < 0) { From 65a2093cd13c945efe82ecd46df178bb1e998214 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 16:48:40 +0100 Subject: [PATCH 172/370] Fix regression --- htdocs/core/lib/functions.lib.php | 12 ++++++------ test/phpunit/FunctionsLibTest.php | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6241eaaa8b1..977342b1457 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -340,13 +340,13 @@ function getBrowserInfo($user_agent) $reg = array(); if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'firefox'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'edge'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { $name = 'chrome'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/chrome/i', $user_agent, $reg)) { // we can have 'chrome (Mozilla...) chrome x.y' in one string $name = 'chrome'; @@ -356,11 +356,11 @@ function getBrowserInfo($user_agent) $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'safari'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { // Safari is often present in string for mobile but its not. $name = 'opera'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); @@ -371,7 +371,7 @@ function getBrowserInfo($user_agent) } elseif (preg_match('/l[iy]n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { // MS products at end $name = 'lynxlinks'; - $version = $reg[4]; + $version = empty($reg[3]) ? '' : $reg[3]; } if ($tablet) { diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index ef5507d8601..370a498ad3a 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -443,10 +443,11 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals('tablet', $tmp['layout']); $this->assertEquals('iphone', $tmp['phone']); - //iPad + //Lynx $user_agent = 'Lynx/2.8.8dev.3 libwww‑FM/2.14 SSL‑MM/1.4.1'; $tmp=getBrowserInfo($user_agent); $this->assertEquals('lynxlinks', $tmp['browsername']); + $this->assertEquals('2.8.8', $tmp['browserversion']); $this->assertEquals('unknown', $tmp['browseros']); $this->assertEquals('classic', $tmp['layout']); } From 2970f039dd966b2c7d5e5105fd3ec3b38a1edec8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 16:52:23 +0100 Subject: [PATCH 173/370] Fix warning --- htdocs/core/lib/functions.lib.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5b791594fea..4724bf85d50 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -340,13 +340,13 @@ function getBrowserInfo($user_agent) $reg = array(); if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'firefox'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'edge'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { $name = 'chrome'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/chrome/i', $user_agent, $reg)) { // we can have 'chrome (Mozilla...) chrome x.y' in one string $name = 'chrome'; @@ -356,11 +356,11 @@ function getBrowserInfo($user_agent) $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'safari'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { // Safari is often present in string for mobile but its not. $name = 'opera'; - $version = $reg[2]; + $version = empty($reg[2]) ? '' : $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); @@ -368,10 +368,10 @@ function getBrowserInfo($user_agent) // MS products at end $name = 'ie'; $version = end($reg); - } elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { + } elseif (preg_match('/l[iy]n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { // MS products at end $name = 'lynxlinks'; - $version = $reg[4]; + $version = empty($reg[3]) ? '' : $reg[3]; } if ($tablet) { From 57358b618b8f46535ed7e434cfd9e105207434e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 17:08:10 +0100 Subject: [PATCH 174/370] Clean code --- htdocs/core/modules/action/modules_action.php | 2 -- htdocs/core/modules/asset/modules_asset.php | 2 -- htdocs/core/modules/bank/modules_bank.php | 2 -- htdocs/core/modules/bom/modules_bom.php | 2 -- htdocs/core/modules/cheque/modules_chequereceipts.php | 2 -- htdocs/core/modules/commande/modules_commande.php | 2 -- htdocs/core/modules/contract/modules_contract.php | 2 -- htdocs/core/modules/delivery/modules_delivery.php | 2 -- htdocs/core/modules/dons/modules_don.php | 2 -- htdocs/core/modules/expedition/modules_expedition.php | 2 -- .../modules/expensereport/modules_expensereport.php | 2 -- htdocs/core/modules/export/modules_export.php | 8 +++----- htdocs/core/modules/facture/modules_facture.php | 2 -- htdocs/core/modules/fichinter/modules_fichinter.php | 2 -- htdocs/core/modules/holiday/modules_holiday.php | 2 -- htdocs/core/modules/hrm/modules_evaluation.php | 2 -- htdocs/core/modules/import/modules_import.php | 8 +++----- htdocs/core/modules/member/modules_cards.php | 2 -- htdocs/core/modules/member/modules_member.class.php | 1 - htdocs/core/modules/movement/modules_movement.php | 2 -- htdocs/core/modules/mrp/modules_mo.php | 2 -- htdocs/core/modules/printsheet/modules_labels.php | 2 -- .../product_batch/modules_product_batch.class.php | 2 -- htdocs/core/modules/project/modules_project.php | 2 -- htdocs/core/modules/project/task/modules_task.php | 2 -- .../propale/doc/doc_generic_proposal_odt.modules.php | 8 ++++---- htdocs/core/modules/propale/modules_propale.php | 2 -- htdocs/core/modules/reception/modules_reception.php | 2 -- htdocs/core/modules/societe/modules_societe.class.php | 1 - htdocs/core/modules/stock/doc/pdf_standard.modules.php | 2 +- htdocs/core/modules/stock/modules_stock.php | 2 -- .../modules/stocktransfer/modules_stocktransfer.php | 2 -- .../supplier_invoice/modules_facturefournisseur.php | 2 -- .../supplier_order/modules_commandefournisseur.php | 2 -- .../supplier_payment/modules_supplier_payment.php | 2 -- .../supplier_proposal/modules_supplier_proposal.php | 2 -- htdocs/core/modules/ticket/modules_ticket.php | 2 -- htdocs/core/modules/user/modules_user.class.php | 2 -- .../core/modules/usergroup/modules_usergroup.class.php | 2 -- .../core/modules/workstation/modules_workstation.php | 2 -- htdocs/exports/export.php | 2 +- htdocs/exports/index.php | 2 +- htdocs/imports/import.php | 10 +++++----- htdocs/imports/index.php | 2 +- qodana.yaml | 1 + 45 files changed, 20 insertions(+), 93 deletions(-) diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php index b496e32f5e1..1681d1f5100 100644 --- a/htdocs/core/modules/action/modules_action.php +++ b/htdocs/core/modules/action/modules_action.php @@ -44,8 +44,6 @@ abstract class ModeleAction extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'action'; $list = array(); diff --git a/htdocs/core/modules/asset/modules_asset.php b/htdocs/core/modules/asset/modules_asset.php index 0b90eab00e3..c9b64e0180f 100644 --- a/htdocs/core/modules/asset/modules_asset.php +++ b/htdocs/core/modules/asset/modules_asset.php @@ -84,8 +84,6 @@ abstract class ModelePDFAsset extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'asset'; $list = array(); diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php index 70f6717d0c7..cfe7d406248 100644 --- a/htdocs/core/modules/bank/modules_bank.php +++ b/htdocs/core/modules/bank/modules_bank.php @@ -48,8 +48,6 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'bankaccount'; $list = array(); diff --git a/htdocs/core/modules/bom/modules_bom.php b/htdocs/core/modules/bom/modules_bom.php index 4c58e57c546..64fc9502d26 100644 --- a/htdocs/core/modules/bom/modules_bom.php +++ b/htdocs/core/modules/bom/modules_bom.php @@ -50,8 +50,6 @@ abstract class ModelePDFBom extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'bom'; $list = array(); diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index 519b13db443..45e18a12734 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -146,8 +146,6 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'chequereceipt'; $list = array(); diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 055286ddf37..d6ecda2b2e7 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -51,8 +51,6 @@ abstract class ModelePDFCommandes extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'order'; $list = array(); diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 8e296f626fb..577ec4be5d9 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -54,8 +54,6 @@ abstract class ModelePDFContract extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'contract'; $list = array(); diff --git a/htdocs/core/modules/delivery/modules_delivery.php b/htdocs/core/modules/delivery/modules_delivery.php index 66e9727bc7b..9f7b6805f73 100644 --- a/htdocs/core/modules/delivery/modules_delivery.php +++ b/htdocs/core/modules/delivery/modules_delivery.php @@ -52,8 +52,6 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'delivery'; $list = array(); diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index 6bb78ab98ac..ca982c61a53 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -50,8 +50,6 @@ abstract class ModeleDon extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'donation'; $list = array(); diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index ce210d6a958..2ca5613af48 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -53,8 +53,6 @@ abstract class ModelePdfExpedition extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'shipping'; $list = array(); diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index eee2190033e..8e7718ee0d5 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.php @@ -75,8 +75,6 @@ abstract class ModeleExpenseReport extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'expensereport'; $list = array(); diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php index 685a4bda430..31b137f6465 100644 --- a/htdocs/core/modules/export/modules_export.php +++ b/htdocs/core/modules/export/modules_export.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; /** * Parent class for export modules */ -class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by liste_modeles +class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by listOfAvailableExportFormat { /** * @var string Error code (or message) @@ -44,7 +44,6 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac public $libversion = array(); - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load into memory list of available export format * @@ -52,10 +51,9 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac * @param integer $maxfilenamelength Max length of value to show * @return array List of templates (same content than array this->driverlabel) */ - public function liste_modeles($db, $maxfilenamelength = 0) + public function listOfAvailableExportFormat($db, $maxfilenamelength = 0) { - // phpcs:enable - dol_syslog(get_class($this)."::liste_modeles"); + dol_syslog(get_class($this)."::listOfAvailableExportFormat"); $dir = DOL_DOCUMENT_ROOT."/core/modules/export/"; $handle = opendir($dir); diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index b0d3c4682ba..ff541550d4e 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -61,8 +61,6 @@ abstract class ModelePDFFactures extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'invoice'; $list = array(); diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 185ef4cf73b..28b3fd265ce 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -51,8 +51,6 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'ficheinter'; $list = array(); diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index 7b6e13ea992..e38801a052e 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -55,8 +55,6 @@ abstract class ModelePDFHoliday extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'holiday'; $list = array(); diff --git a/htdocs/core/modules/hrm/modules_evaluation.php b/htdocs/core/modules/hrm/modules_evaluation.php index a28d3f2ef9d..06276ca8474 100644 --- a/htdocs/core/modules/hrm/modules_evaluation.php +++ b/htdocs/core/modules/hrm/modules_evaluation.php @@ -49,8 +49,6 @@ abstract class ModelePDFEvaluation extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'evaluation'; $list = array(); diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index d875afc5c4f..fa4a5ad3692 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -155,18 +155,16 @@ class ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Charge en memoire et renvoie la liste des modeles actifs + * Load into memory list of available import format * * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - public function liste_modeles($db, $maxfilenamelength = 0) + public function listOfAvailableImportFormat($db, $maxfilenamelength = 0) { - // phpcs:enable - dol_syslog(get_class($this)."::liste_modeles"); + dol_syslog(get_class($this)."::listOfAvailableImportFormat"); $dir = DOL_DOCUMENT_ROOT."/core/modules/import/"; $handle = opendir($dir); diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index b37b9144d3e..0147f42f6c7 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -51,8 +51,6 @@ class ModelePDFCards public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'member'; $list = array(); diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php index a356c76ee7c..77ab5621915 100644 --- a/htdocs/core/modules/member/modules_member.class.php +++ b/htdocs/core/modules/member/modules_member.class.php @@ -51,7 +51,6 @@ abstract class ModelePDFMember extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - $type = 'member'; $list = array(); diff --git a/htdocs/core/modules/movement/modules_movement.php b/htdocs/core/modules/movement/modules_movement.php index 1af966faf22..a058d685114 100644 --- a/htdocs/core/modules/movement/modules_movement.php +++ b/htdocs/core/modules/movement/modules_movement.php @@ -85,8 +85,6 @@ abstract class ModelePDFMovement extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'movement'; $list = array(); diff --git a/htdocs/core/modules/mrp/modules_mo.php b/htdocs/core/modules/mrp/modules_mo.php index 1b3af7f6b8c..c178a5d3eaf 100644 --- a/htdocs/core/modules/mrp/modules_mo.php +++ b/htdocs/core/modules/mrp/modules_mo.php @@ -50,8 +50,6 @@ abstract class ModelePDFMo extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'mrp'; $list = array(); diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index ae4c6888a6c..b80710dc1f6 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -51,8 +51,6 @@ class ModelePDFLabels public function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'members_labels'; $list = array(); diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 1446d20aeda..d596ffeb111 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -55,8 +55,6 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'product_batch'; $list = array(); diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 6f55426e65f..9f8e0e977c7 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -103,8 +103,6 @@ abstract class ModelePDFProjects extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'project'; $list = array(); diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index 6614369aa43..97e31d5d24c 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -49,8 +49,6 @@ abstract class ModelePDFTask extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'project_task'; $list = array(); diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index de6554137df..ac95786cdd2 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -190,21 +190,21 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) { // Model for creation $list = ModelePDFPropales::liste_modeles($this->db); - $texte .= ''; + $texte .= '
'; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '"; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '"; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '"; diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index b58ae681ef2..f69fd5e763e 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -53,8 +53,6 @@ abstract class ModelePDFPropales extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'propal'; $list = array(); diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php index f519974382b..0dba62ee646 100644 --- a/htdocs/core/modules/reception/modules_reception.php +++ b/htdocs/core/modules/reception/modules_reception.php @@ -43,8 +43,6 @@ abstract class ModelePdfReception extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'reception'; $list = array(); diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index a1067c14d30..105333d815b 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -48,7 +48,6 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator public static function liste_modeles($dbs, $maxfilenamelength = 0) { // phpcs:enable - $type = 'company'; $list = array(); diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index ed1877ec8f7..ac0bf98b0f3 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -402,7 +402,7 @@ class pdf_standard extends ModelePDFStock // Label $pdf->SetXY($this->posxlabel + 0.8, $curY); - $pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3, dol_trunc($objp->produit, 24), 0, 'L'); + $pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3, dol_trunc($productstatic->label, 24), 0, 'L'); // Quantity $valtoshow = price2num($objp->value, 'MS'); diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php index 73092bb0bf6..d1dc684d1d2 100644 --- a/htdocs/core/modules/stock/modules_stock.php +++ b/htdocs/core/modules/stock/modules_stock.php @@ -75,8 +75,6 @@ abstract class ModelePDFStock extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'stock'; $list = array(); diff --git a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php index 6c0213afb0c..2a7218543e7 100644 --- a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php +++ b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php @@ -50,8 +50,6 @@ abstract class ModelePDFStockTransfer extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'stocktransfer'; $list = array(); diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index 546596ab640..de56773eae2 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -51,8 +51,6 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'invoice_supplier'; $list = array(); diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 51c4e5f07d3..e8b66bb84cf 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -54,8 +54,6 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'order_supplier'; $list = array(); diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php index 9409c4c688b..881d123772c 100644 --- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php +++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php @@ -74,8 +74,6 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'supplier_payment'; $list = array(); diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index 42c935ca13c..f1fbf2f9890 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -53,8 +53,6 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'supplier_proposal'; $list = array(); diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php index 263803162fd..aaf9fb2e11b 100644 --- a/htdocs/core/modules/ticket/modules_ticket.php +++ b/htdocs/core/modules/ticket/modules_ticket.php @@ -44,8 +44,6 @@ abstract class ModelePDFTicket extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'ticket'; $list = array(); diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php index b0142687ce5..d20e5e95eb8 100644 --- a/htdocs/core/modules/user/modules_user.class.php +++ b/htdocs/core/modules/user/modules_user.class.php @@ -55,8 +55,6 @@ abstract class ModelePDFUser extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'user'; $list = array(); diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php index 99ee232fdf2..2c4aebe1e6f 100644 --- a/htdocs/core/modules/usergroup/modules_usergroup.class.php +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -55,8 +55,6 @@ abstract class ModelePDFUserGroup extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'group'; $list = array(); diff --git a/htdocs/core/modules/workstation/modules_workstation.php b/htdocs/core/modules/workstation/modules_workstation.php index a99dab9b17a..b72d34f5812 100644 --- a/htdocs/core/modules/workstation/modules_workstation.php +++ b/htdocs/core/modules/workstation/modules_workstation.php @@ -50,8 +50,6 @@ abstract class ModelePDFWorkstation extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'workstation'; $list = array(); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 4591ccd0bf3..f35ae3a3121 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -1187,7 +1187,7 @@ if ($step == 5 && $datatoexport) { $htmltabloflibs .= ''; $htmltabloflibs .= ''."\n"; - $liste = $objmodelexport->liste_modeles($db); + $liste = $objmodelexport->listOfAvailableExportFormat($db); $listeall = $liste; foreach ($listeall as $key => $val) { if (preg_match('/__\(Disabled\)__/', $listeall[$key])) { diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 41d6cd18ed0..6039a9c447a 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -72,7 +72,7 @@ print ''; include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; $model = new ModeleExports($db); -$liste = $model->liste_modeles($db); // This is not a static method for exports because method load non static properties +$liste = $model->listOfAvailableExportFormat($db); // This is not a static method for exports because method load non static properties foreach ($liste as $key => $val) { if (preg_match('/__\(Disabled\)__/', $liste[$key])) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 579fdb74c4a..d326470aa04 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -485,7 +485,7 @@ if ($step == 2 && $datatoimport) { print ''; - $list = $objmodelimport->liste_modeles($db); + $list = $objmodelimport->listOfAvailableImportFormat($db); foreach ($list as $key) { print ''; print ''; @@ -529,7 +529,7 @@ if ($step == 3 && $datatoimport) { $param .= '&enclosure='.urlencode($enclosure); } - $list = $objmodelimport->liste_modeles($db); + $list = $objmodelimport->listOfAvailableImportFormat($db); llxHeader('', $langs->trans("NewImport"), $help_url); @@ -763,7 +763,7 @@ if ($step == 4 && $datatoimport) { //var_dump($array_match_file_to_database); $model = $format; - $list = $objmodelimport->liste_modeles($db); + $list = $objmodelimport->listOfAvailableImportFormat($db); if (empty($separator)) { $separator = (empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE); @@ -1547,7 +1547,7 @@ if ($step == 5 && $datatoimport) { } $model = $format; - $list = $objmodelimport->liste_modeles($db); + $list = $objmodelimport->listOfAvailableImportFormat($db); // Create classe to use for import $dir = DOL_DOCUMENT_ROOT."/core/modules/import/"; @@ -2010,7 +2010,7 @@ if ($step == 6 && $datatoimport) { } $model = $format; - $list = $objmodelimport->liste_modeles($db); + $list = $objmodelimport->listOfAvailableImportFormat($db); $importid = GETPOST("importid", 'alphanohtml'); diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index ac3d2b23f69..e90f58aa8e1 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -68,7 +68,7 @@ print ''; include_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php'; $model = new ModeleImports(); -$list = $model->liste_modeles($db); +$list = $model->listOfAvailableImportFormat($db); foreach ($list as $key) { print ''; diff --git a/qodana.yaml b/qodana.yaml index 36c35ece4c6..49fd189e734 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -72,6 +72,7 @@ exclude: - name: PhpConditionCheckedByNextConditionInspection - name: RegExpSingleCharAlternation - name: PhpSuspiciousNameCombinationInspection + - name: PhpObjectFieldsAreOnlyWrittenInspection - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection \ No newline at end of file From 97222603c10c97396c450a6cb933c081d5c8dc3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 17:14:58 +0100 Subject: [PATCH 175/370] Debug v17 --- htdocs/modulebuilder/index.php | 6 +++--- htdocs/stripe/admin/stripe.php | 4 ++-- htdocs/takepos/admin/terminal.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 8b87d84c10e..a6f3431bd2e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1731,9 +1731,9 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { ); $resultko = 0; - foreach ($filetodelete as $filetodelete) { - $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); - $resulttmp = dol_delete_file($dir.'/'.$filetodelete.'.back', 0, 0, 1); + foreach ($filetodelete as $tmpfiletodelete) { + $resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete, 0, 0, 1); + $resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete.'.back', 0, 0, 1); if (!$resulttmp) { $resultko++; } diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 6cbefc14185..1c5a507b619 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -420,8 +420,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code $location = array(); $location[""] = $langs->trans("NotDefined"); - foreach ($locations as $locations) { - $location[$locations->id] = $locations->display_name; + foreach ($locations as $tmplocation) { + $location[$tmplocation->id] = $tmplocation->display_name; } print $form->selectarray("STRIPE_LOCATION", $location, getDolGlobalString('STRIPE_LOCATION')); print ''; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index fe03139c8a3..7fc2d60544a 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -219,8 +219,8 @@ if (isModEnabled("banque")) { $reader = array(); $reader[""] = $langs->trans("NoReader"); - foreach ($readers as $readers) { - $reader[$reader->id] = $readers->label.' ('.$readers->status.')'; + foreach ($readers as $tmpreader) { + $reader[$tmpreader->id] = $tmpreader->label.' ('.$tmpreader->status.')'; } print $form->selectarray('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, $reader, $conf->global->{'CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse}); print ''; From 1b1e4e188e439ba2a6b417264182bcf379e03769 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 17:17:21 +0100 Subject: [PATCH 176/370] Debug v17 --- htdocs/core/class/fileupload.class.php | 2 +- qodana.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index b1e085fbff7..a3fb3505fba 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -259,7 +259,7 @@ class FileUpload /** * getFileObjects * - * @return void + * @return array Array of objects */ protected function getFileObjects() { diff --git a/qodana.yaml b/qodana.yaml index 49fd189e734..5b835ab446d 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -72,7 +72,7 @@ exclude: - name: PhpConditionCheckedByNextConditionInspection - name: RegExpSingleCharAlternation - name: PhpSuspiciousNameCombinationInspection - - name: PhpObjectFieldsAreOnlyWrittenInspection + - name: PhpObjectFieldsAreOnlyWrittenInspection - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection \ No newline at end of file From b70c6faef299c1418b984497ae2272d471131644 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 17:19:05 +0100 Subject: [PATCH 177/370] Clean code --- .../modules/supplier_payment/modules_supplier_payment.php | 7 +++++-- htdocs/ftp/index.php | 8 ++++---- htdocs/index.php | 2 +- qodana.yaml | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php index 881d123772c..93195edec24 100644 --- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php +++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php @@ -17,6 +17,8 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + + /** * Parent class for supplier invoices models */ @@ -85,8 +87,9 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator } /** - * \class ModeleNumRefSupplierPayments - * \brief Payment numbering references mother class + * ModeleNumRefSupplierPayments + * + * Payment numbering references mother class */ abstract class ModeleNumRefSupplierPayments diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index af48f0f8348..633cb6fa5ce 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -282,7 +282,7 @@ if ($action == 'download') { $newsection = $section; - $result = dol_ftp_get($connect_id, $localfile, $file, $newsection); + $result = dol_ftp_get($conn_id, $localfile, $file, $newsection); if ($result) { @@ -306,9 +306,9 @@ if ($action == 'download') { header('Content-Type: '.$type); } if ($attachment) { - header('Content-Disposition: attachment; filename="'.$filename.'"'); + header('Content-Disposition: attachment; filename="'.$file.'"'); } else { - header('Content-Disposition: inline; filename="'.$filename.'"'); + header('Content-Disposition: inline; filename="'.$file.'"'); } // Ajout directives pour resoudre bug IE @@ -319,7 +319,7 @@ if ($action == 'download') { exit; } else { - setEventMessages($langs->transnoentitiesnoconv('FailedToGetFile', $remotefile), null, 'errors'); + setEventMessages($langs->transnoentitiesnoconv('FailedToGetFile', $file), null, 'errors'); } } else { dol_print_error('', $mesg); diff --git a/htdocs/index.php b/htdocs/index.php index e0001adba5e..15c41e7ff50 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -119,7 +119,7 @@ if (empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) { } // Conf files must be in read only mode - if (is_writable($conffile)) { + if (is_writable($conffile)) { // $conffile is defined into filefunc.inc.php $langs->load("errors"); //$langs->load("other"); //if (!empty($message)) $message.='
'; diff --git a/qodana.yaml b/qodana.yaml index 5b835ab446d..75ab2315e9a 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -73,6 +73,7 @@ exclude: - name: RegExpSingleCharAlternation - name: PhpSuspiciousNameCombinationInspection - name: PhpObjectFieldsAreOnlyWrittenInspection + - name: PhpMissingParentConstructorInspection - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection - + \ No newline at end of file From d1934bfded6f1ef8ff7c75487746c72f19e86dc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Dec 2022 17:29:57 +0100 Subject: [PATCH 178/370] Debug v17 --- htdocs/compta/localtax/index.php | 12 ++---------- htdocs/compta/tva/index.php | 10 ---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index ad0b86a161d..fb96e766945 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -18,11 +18,13 @@ * along with this program. If not, see . */ + /** * \file htdocs/compta/localtax/index.php * \ingroup tax * \brief Index page of IRPF reports */ + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; @@ -441,16 +443,6 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ $hookmanager->initHooks(array('externalbalance')); $reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if (!is_array($x_coll) && $coll_listbuy == -1) { - $langs->load("errors"); - print '
'; - break; - } - if (!is_array($x_paye) && $coll_listbuy == -2) { - print ''; - break; - } - print ''; print ''; diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index f0efe305d8c..5c0d6930475 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -389,16 +389,6 @@ if ($refresh === true) { $hookmanager->initHooks(array('externalbalance')); $reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if (!is_array($x_coll) && $coll_listbuy == -1) { - $langs->load("errors"); - print ''; - break; - } - if (!is_array($x_paye) && $coll_listbuy == -2) { - print ''; - break; - } - print ''; print ''; From da4567c87524c96337cfa89588dfe3a689ac7c2a Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 1 Jan 2023 15:05:04 +0100 Subject: [PATCH 179/370] Set $remise_percent to 0, if GETPOST is empty. --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 77a59c159ff..996beecab61 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1106,7 +1106,7 @@ if (empty($reshook)) { $special_code = 3; } - $remise_percent = price2num(GETPOST('remise_percent'), '', 2); + $remise_percent = GETPOST('remise_percent') != '' ? price2num(GETPOST('remise_percent'), '', 2) : 0; // Check minimum price $productid = GETPOST('productid', 'int'); From 0915374fa126efda9260bf898e714eb7f65bda22 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 1 Jan 2023 16:54:36 +0100 Subject: [PATCH 180/370] Fix php 8 errors --- htdocs/stripe/class/stripe.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 43f940acdee..53adfdbe85b 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -378,7 +378,7 @@ class Stripe extends CommonObject $paymentintent = null; - if (is_object($object) && !empty($conf->global->STRIPE_REUSE_EXISTING_INTENT_IF_FOUND) && empty($conf->global->STRIPE_CARD_PRESENT)) { + if (is_object($object) && getDolGlobalInt('STRIPE_REUSE_EXISTING_INTENT_IF_FOUND') && !getDolGlobalInt('STRIPE_CARD_PRESENT')) { // Warning. If a payment was tried and failed, a payment intent was created. // But if we change something on object to pay (amount or other that does not change the idempotency key), reusing same payment intent is not allowed by Stripe. // Recommended solution is to recreate a new payment intent each time we need one (old one will be automatically closed by Stripe after a delay), Stripe will @@ -435,26 +435,26 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); $descriptor = dol_trunc($tag, 10, 'right', 'UTF-8', 1); - if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { + if (getDolGlobalInt('STRIPE_SEPA_DIRECT_DEBIT')) { $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) //$descriptor = preg_replace('/ref=[^:=]+/', '', $descriptor); // Clean ref } - if (!empty($conf->global->STRIPE_KLARNA)) { + if (getDolGlobalInt('STRIPE_KLARNA')) { $paymentmethodtypes[] = "klarna"; } - if (!empty($conf->global->STRIPE_BANCONTACT)) { + if (getDolGlobalInt('STRIPE_BANCONTACT')) { $paymentmethodtypes[] = "bancontact"; } - if (!empty($conf->global->STRIPE_IDEAL)) { + if (getDolGlobalInt('STRIPE_IDEAL')) { $paymentmethodtypes[] = "ideal"; } - if (!empty($conf->global->STRIPE_GIROPAY)) { + if (getDolGlobalInt('STRIPE_GIROPAY')) { $paymentmethodtypes[] = "giropay"; } - if (!empty($conf->global->STRIPE_SOFORT)) { + if (getDolGlobalInt('STRIPE_SOFORT')) { $paymentmethodtypes[] = "sofort"; } - if (!empty($conf->global->STRIPE_CARD_PRESENT) && $mode == 'terminal') { + if (getDolGlobalInt('STRIPE_CARD_PRESENT') && $mode == 'terminal') { $paymentmethodtypes = array("card_present"); } @@ -484,13 +484,13 @@ class Stripe extends CommonObject //$dataforintent["setup_future_usage"] = "off_session"; $dataforintent["off_session"] = true; } - if (!empty($conf->global->STRIPE_GIROPAY)) { + if (getDolGlobalInt('STRIPE_GIROPAY')) { unset($dataforintent['setup_future_usage']); } - if (!empty($conf->global->STRIPE_KLARNA)) { + if (getDolGlobalInt('STRIPE_KLARNA')) { unset($dataforintent['setup_future_usage']); } - if (!empty($conf->global->STRIPE_CARD_PRESENT) && $mode == 'terminal') { + if (getDolGlobalInt('STRIPE_CARD_PRESENT') && $mode == 'terminal') { unset($dataforintent['setup_future_usage']); $dataforintent["capture_method"] = "manual"; $dataforintent["confirmation_method"] = "manual"; @@ -500,7 +500,7 @@ class Stripe extends CommonObject $description .= ' - '.$payment_method; } - if ($conf->entity != $conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0) { + if ($conf->entity != getDolGlobalInt('STRIPECONNECT_PRINCIPAL') && $stripefee > 0) { $dataforintent["application_fee_amount"] = $stripefee; } if ($usethirdpartyemailforreceiptemail && is_object($object) && $object->thirdparty->email) { From 5c8dc4ed58e1a3231dc1572b24e188ef234485e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Jan 2023 23:50:37 +0100 Subject: [PATCH 181/370] Fix warning --- .../core/boxes/box_graph_invoices_peryear.php | 4 ++-- htdocs/core/modules/modLoan.class.php | 2 +- htdocs/don/class/don.class.php | 8 ++++---- htdocs/expedition/class/expedition.class.php | 19 +------------------ htdocs/reception/class/reception.class.php | 19 ------------------- qodana.yaml | 2 +- 6 files changed, 9 insertions(+), 45 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index 5a9b84829f2..9ea2fe5a130 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -142,7 +142,7 @@ class box_graph_invoices_peryear extends ModeleBoxes $px2->SetData($data2); unset($data2); $i = $startyear; - $legend = array(); + /*$legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); @@ -150,7 +150,7 @@ class box_graph_invoices_peryear extends ModeleBoxes $legend[] = $i; } $i++; - } + }*/ $px2->SetLegend([$langs->trans("AmountOfBillsHT")]); $px2->SetMaxValue($px2->GetCeilMaxValue()); $px2->SetWidth($WIDTH); diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php index 7f2850b075a..36919bc38af 100644 --- a/htdocs/core/modules/modLoan.class.php +++ b/htdocs/core/modules/modLoan.class.php @@ -82,7 +82,7 @@ class modLoan extends DolibarrModules "chaine", "6611" ); - $this->const[1] = array( + $this->const[2] = array( "LOAN_ACCOUNTING_ACCOUNT_INSURANCE", "chaine", "6162" diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 333f9673175..158c96cb441 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -206,7 +206,7 @@ class Don extends CommonObject */ public function initAsSpecimen() { - global $conf, $user, $langs; + global $conf; $now = dol_now(); @@ -224,10 +224,10 @@ class Don extends CommonObject $num_socs = $this->db->num_rows($resql); $i = 0; while ($i < $num_socs) { - $i++; - $row = $this->db->fetch_row($resql); $socids[$i] = $row[0]; + + $i++; } } @@ -237,7 +237,7 @@ class Don extends CommonObject $this->specimen = 1; $this->lastname = 'Doe'; $this->firstname = 'John'; - $this->socid = 1; + $this->socid = empty($socids[0]) ? 0 : $socids[0]; $this->date = $now; $this->date_valid = $now; $this->amount = 100.90; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bb2954daa60..dd6dfee55b1 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1911,23 +1911,6 @@ class Expedition extends CommonObject dol_syslog(get_class($this)."::initAsSpecimen"); - // Load array of products prodids - $num_prods = 0; - $prodids = array(); - $sql = "SELECT rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."product"; - $sql .= " WHERE entity IN (".getEntity('product').")"; - $resql = $this->db->query($sql); - if ($resql) { - $num_prods = $this->db->num_rows($resql); - $i = 0; - while ($i < $num_prods) { - $i++; - $row = $this->db->fetch_row($resql); - $prodids[$i] = $row[0]; - } - } - $order = new Commande($this->db); $order->initAsSpecimen(); @@ -1940,7 +1923,7 @@ class Expedition extends CommonObject $this->date = $now; $this->date_creation = $now; $this->date_valid = $now; - $this->date_delivery = $now; + $this->date_delivery = $now + 24 * 3600; $this->date_expedition = $now + 24 * 3600; $this->entrepot_id = 0; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 96b275bfb26..03ed28a2200 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1348,25 +1348,6 @@ class Reception extends CommonObject dol_syslog(get_class($this)."::initAsSpecimen"); - // Load array of products prodids - $num_prods = 0; - $prodids = array(); - $sql = "SELECT rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."product"; - $sql .= " WHERE entity IN (".getEntity('product').")"; - $sql .= $this->db->plimit(100); - - $resql = $this->db->query($sql); - if ($resql) { - $num_prods = $this->db->num_rows($resql); - $i = 0; - while ($i < $num_prods) { - $i++; - $row = $this->db->fetch_row($resql); - $prodids[$i] = $row[0]; - } - } - $order = new CommandeFournisseur($this->db); $order->initAsSpecimen(); diff --git a/qodana.yaml b/qodana.yaml index 75ab2315e9a..7347f4dd50b 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -75,5 +75,5 @@ exclude: - name: PhpObjectFieldsAreOnlyWrittenInspection - name: PhpMissingParentConstructorInspection - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection - + - name: PhpArrayUsedOnlyForWriteInspection \ No newline at end of file From ac75406e357ce5b4cddf590a26dd0936898d4faa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Jan 2023 23:55:59 +0100 Subject: [PATCH 182/370] Clean code --- htdocs/fichinter/card-rec.php | 2 +- htdocs/fichinter/class/fichinterrec.class.php | 11 ++++------- qodana.yaml | 3 +++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index f2bd0bac8a3..22f77546090 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -234,7 +234,7 @@ if ($action == 'add') { } elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) { // delete modele $object->fetch($id); - $object->delete(); + $object->delete($user); $id = 0; header('Location: '.$_SERVER["PHP_SELF"]); exit; diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index fa3b700b1fd..2f4ca02d3c7 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -411,16 +411,13 @@ class FichinterRec extends Fichinter /** * Delete template fichinter rec * - * @param int $rowid Id of fichinter rec to delete. If empty, we delete current instance of fichinter rec - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @param int $idwarehouse Id warehouse to use for stock change. + * @param User $user Object user who delete + * @param int $notrigger Disable trigger * @return int <0 if KO, >0 if OK */ - public function delete($rowid = 0, $notrigger = 0, $idwarehouse = -1) + public function delete(User $user, $notrigger = 0) { - if (empty($rowid)) { - $rowid = $this->id; - } + $rowid = $this->id; dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); diff --git a/qodana.yaml b/qodana.yaml index 7347f4dd50b..872b043013b 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -76,4 +76,7 @@ exclude: - name: PhpMissingParentConstructorInspection - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection - name: PhpArrayUsedOnlyForWriteInspection + - name: PhpArrayIndexImmediatelyRewrittenInspection + - name: PhpParameterNameChangedDuringInheritanceInspection + - name: PhpDuplicateSwitchCaseBodyInspection \ No newline at end of file From 7e22e1e7b490f7c3862602b2afa2870359497206 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 00:02:34 +0100 Subject: [PATCH 183/370] Clean php --- .github/workflows/code_quality.yml | 1 + htdocs/mailmanspip/class/mailmanspip.class.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 2b8ea0b3551..700d9fe64bf 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -16,6 +16,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 + php-version: '7.1' - name: 'Qodana Scan' uses: JetBrains/qodana-action@v2022.3.0 env: diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 46701a459a6..6bc34977e4e 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -105,13 +105,13 @@ class MailmanSpip */ public function connectSpip() { - $resource = getDoliDBInstance('mysql', ADHERENT_SPIP_SERVEUR, ADHERENT_SPIP_USER, ADHERENT_SPIP_PASS, ADHERENT_SPIP_DB, ADHERENT_SPIP_PORT); + $resource = getDoliDBInstance('mysql', getDolGlobalString('ADHERENT_SPIP_SERVEUR'), getDolGlobalString('ADHERENT_SPIP_USER'), getDolGlobalString('ADHERENT_SPIP_PASS'), getDolGlobalString('ADHERENT_SPIP_DB'), getDolGlobalString('ADHERENT_SPIP_PORT')); if ($resource->ok) { return $resource; } - dol_syslog('Error when connecting to SPIP '.ADHERENT_SPIP_SERVEUR.' '.ADHERENT_SPIP_USER.' '.ADHERENT_SPIP_PASS.' '.ADHERENT_SPIP_DB, LOG_ERR); + dol_syslog('Error when connecting to SPIP '.getDolGlobalString('ADHERENT_SPIP_SERVEUR').' '.getDolGlobalString('ADHERENT_SPIP_USER').' '.getDolGlobalString('ADHERENT_SPIP_PASS').' '.getDolGlobalString('ADHERENT_SPIP_DB'), LOG_ERR); return false; } From a6847e9edc81976fb98324ae04f586a21e8b3fbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 00:06:15 +0100 Subject: [PATCH 184/370] doxygen --- htdocs/ticket/class/actions_ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 6ad204965bc..29a013f1eb9 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -111,7 +111,7 @@ class ActionsTicket * @param int $id ID of ticket * @param string $ref Reference of ticket * @param string $track_id Track ID of ticket (for public area) - * @return void + * @return int <0 if KO, >0 if OK */ public function fetch($id = 0, $ref = '', $track_id = '') { From cf1ff1e1f69688a7656c08051dc01fb3f6fb0ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 00:07:03 +0100 Subject: [PATCH 185/370] Fix warning --- htdocs/resource/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 5c588b59c6b..3ee118d06c7 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -225,7 +225,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) { // Type print ''; print ''; // Description From 2aef5e94df346965073f9feddca8342037afc913 Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 1 Jan 2023 15:05:04 +0100 Subject: [PATCH 186/370] Set $remise_percent to 0, if GETPOST is empty. --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 66e673abf2d..e467a398dc7 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1106,7 +1106,7 @@ if (empty($reshook)) { $special_code = 3; } - $remise_percent = price2num(GETPOST('remise_percent'), '', 2); + $remise_percent = GETPOST('remise_percent') != '' ? price2num(GETPOST('remise_percent'), '', 2) : 0; // Check minimum price $productid = GETPOST('productid', 'int'); From b96c58ea6796232bd35562c2f711358b8812b054 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 00:07:03 +0100 Subject: [PATCH 187/370] Fix warning --- htdocs/resource/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 5c588b59c6b..3ee118d06c7 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -225,7 +225,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) { // Type print ''; print ''; // Description From edfa7dddfcc4c78faa6f6130f418be6818488205 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 01:50:25 +0100 Subject: [PATCH 188/370] Update html.formpropal.class.php --- htdocs/core/class/html.formpropal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index fbbf2c97fb7..7cce3c839c5 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -139,7 +139,7 @@ class FormPropal } else { print ''; print ''; From 9aecf48ce33880623e3f5f0330cbbba76710bd7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 01:53:05 +0100 Subject: [PATCH 189/370] Update main.inc.php --- htdocs/main.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e0ea7b1dbfc..dbb18aa61d3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3211,7 +3211,7 @@ if (!function_exists("llxFooter")) { global $contextpage, $page, $limit, $mode; global $dolibarr_distrib; - $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); + $ext = 'layout='.urlencode($conf->browser->layout).'&version='.urlencode(DOL_VERSION); // Hook to add more things on all pages within fiche DIV $llxfooter = ''; @@ -3222,7 +3222,9 @@ if (!function_exists("llxFooter")) { } elseif ($reshook > 0) { $llxfooter = $hookmanager->resPrint; } - print $llxfooter; + if ($llxfooter) { + print $llxfooter; + } // Global html output events ($mesgs, $errors, $warnings) dol_htmloutput_events($disabledoutputofmessages); From 73e5d6d2d2a7b86eee434a0db4fe100c195a4b31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 02:08:20 +0100 Subject: [PATCH 190/370] Clean code --- htdocs/core/class/conf.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 56e9e88b1dc..74d8b089223 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -499,9 +499,9 @@ class Conf // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. // Sous module bons d'expedition - $this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0); + $this->expedition_bon->enabled = (empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? 0 : $this->global->MAIN_SUBMODULE_EXPEDITION); // Sub module delivery note Sous module bons de livraison - $this->delivery_note->enabled = (!empty($this->global->MAIN_SUBMODULE_DELIVERY) ? $this->global->MAIN_SUBMODULE_DELIVERY : 0); + $this->delivery_note->enabled = (empty($this->global->MAIN_SUBMODULE_DELIVERY) ? 0 : $this->global->MAIN_SUBMODULE_DELIVERY); // Module fournisseur if (!empty($this->fournisseur)) { From f3bdecd111e8d30f92536be289f407271600bcf7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 02:23:28 +0100 Subject: [PATCH 191/370] Revert option ECM_AUTO_TREE_ENABLED into ECM_AUTO_TREE_HIDEN --- htdocs/admin/ecm.php | 24 ++++++++++++------------ htdocs/core/lib/ecm.lib.php | 2 +- htdocs/core/modules/modECM.class.php | 8 +------- htdocs/ecm/index_auto.php | 2 +- htdocs/install/upgrade2.php | 7 +++++++ 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 3e0c2378742..4b5ccbb133e 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page $langs->load("admin"); +$action = GETPOST('action', 'aZ09'); + if (!$user->admin) { accessforbidden(); } @@ -41,6 +43,7 @@ if (!$user->admin) { */ // set +$reg = array(); if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $code = $reg[1]; if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { @@ -67,6 +70,8 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { * View */ +$form = new Form($db); + $help_url = ''; llxHeader('', $langs->trans("ECMSetup"), $help_url); @@ -81,26 +86,21 @@ print dol_get_fiche_head($head, 'ecm', '', -1, ''); print '
'.$langs->trans("DefaultModelPropalCreate").''.$langs->trans("DefaultModelPropalCreate").''; $texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''.$langs->trans("DefaultModelPropalToBill").''; $texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''.$langs->trans("DefaultModelPropalClosed").''; $texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); $texte .= "
'.$langs->trans("LibraryVersion").'
'; print $langs->trans("FileMustHaveOneOfFollowingFormat"); print '
'.img_picto_common($key, $objmodelimport->getPictoForKey($key)).'
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").'
' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
' . $langs->trans("FeatureNotYetAvailable") . '
' . dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y") . '
'.$langs->trans("ResourceType").''; - $ret = $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2); + $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2); print '
'.$langs->trans("ResourceType").''; - $ret = $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2); + $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2); print '
'; print ''; print ''; -print ''; -print ''."\n"; +print ''."\n"; print ''; -$form = new Form($db); - // Mail required for members print ''; print ''; -print ''; - -print ''; diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index e7840505e8f..2a9b9a766a3 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -54,7 +54,7 @@ function ecm_prepare_dasboard_head($object) $head[$h][2] = 'index'; $h++; - if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { + if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) { $head[$h][0] = DOL_URL_ROOT.'/ecm/index_auto.php'; $head[$h][1] = $langs->trans("ECMSectionsAuto").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3); $head[$h][2] = 'index_auto'; diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 1ea7530be53..09556b43cd8 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -74,12 +74,6 @@ class modECM extends DolibarrModules $this->const = array(); // List of parameters $r = 0; - $this->const[$r][0] = "ECM_AUTO_TREE_ENABLED"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "1"; - $this->const[$r][3] = 'Auto tree is enabled by default'; - $this->const[$r][4] = 0; - // Boxes $this->boxes = array(); // List of boxes $r = 0; @@ -182,7 +176,7 @@ class modECM extends DolibarrModules 'langs'=>'ecm', 'position'=>103, 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("ECM_AUTO_TREE_ENABLED")', + 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")', 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 342d7d74129..9d9d30e8188 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -309,7 +309,7 @@ llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $m // Add sections to manage $rowspan = 0; $sectionauto = array(); -if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { +if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) { if (isModEnabled("product") || isModEnabled("service")) { $langs->load("products"); $rowspan++; $sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 51334eaae21..89e190f92c1 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -490,6 +490,13 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { migrate_contractdet_rank(); } + + // Scripts for 18.0 + $afterversionarray = explode('.', '170.9'); + $beforeversionarray = explode('.', '18.0.9'); + if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + migrate_contractdet_rank(); + } } From 5148e6a1a2601e298188a87312ce22853fa74a9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 03:08:57 +0100 Subject: [PATCH 192/370] Enhance doxygen conf --- .github/workflows/doxygen-action.yml.disabled | 17 +++++++ build/doxygen/dolibarr-doxygen.doxyfile | 50 ++++++++++++------- 2 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/doxygen-action.yml.disabled diff --git a/.github/workflows/doxygen-action.yml.disabled b/.github/workflows/doxygen-action.yml.disabled new file mode 100644 index 00000000000..bd923e6394f --- /dev/null +++ b/.github/workflows/doxygen-action.yml.disabled @@ -0,0 +1,17 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +name: Doxygen +on: + schedule: + - cron: "0 15 * * *" + workflow_dispatch: + branches: + - develop + +jobs: + doxygen: + runs-on: ubuntu-latest + steps: + - name: 'Doxygen' + uses: mattnotmitt/doxygen-action@1.9.5 + with: + doxyfile-path: build/doxygen diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 31400661ecc..b7ca04898e5 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -1,14 +1,17 @@ -# Doxyfile 1.7.3 +# Doxyfile 1.8.16 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project +# doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. # The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options @@ -448,7 +451,7 @@ GENERATE_TODOLIST = NO # disable (NO) the test list. This list is created by putting \test # commands in the documentation. -GENERATE_TESTLIST = YES +GENERATE_TESTLIST = NO # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug @@ -625,7 +628,7 @@ EXCLUDE_SYMLINKS = YES # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = */CVS/* *google* *pibarcode* +EXCLUDE_PATTERNS = */CVS/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -775,14 +778,16 @@ IGNORE_PREFIX = # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html @@ -852,13 +857,24 @@ HTML_TIMESTAMP = YES HTML_ALIGN_MEMBERS = YES +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = NO + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). -HTML_DYNAMIC_SECTIONS = YES +HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 @@ -1003,7 +1019,7 @@ QHG_LOCATION = # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. -GENERATE_ECLIPSEHELP = YES +GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have @@ -1072,7 +1088,7 @@ FORMULA_TRANSPARENT = YES # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. -SEARCHENGINE = NO +SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client From f8f2e8ea9ea988c075153037feb58853506704d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 03:52:29 +0100 Subject: [PATCH 193/370] Enhancement with doxygen --- .github/workflows/doxygen-action.yml.disabled | 17 --------- .github/workflows/doxygen-gh-pages.yml | 38 +++++++++++++++++++ build/doxygen/dolibarr-doxygen-build.pl | 10 ++--- build/doxygen/dolibarr-doxygen.doxyfile | 38 +++++++++---------- 4 files changed, 62 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/doxygen-action.yml.disabled create mode 100644 .github/workflows/doxygen-gh-pages.yml diff --git a/.github/workflows/doxygen-action.yml.disabled b/.github/workflows/doxygen-action.yml.disabled deleted file mode 100644 index bd923e6394f..00000000000 --- a/.github/workflows/doxygen-action.yml.disabled +++ /dev/null @@ -1,17 +0,0 @@ -# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: Doxygen -on: - schedule: - - cron: "0 15 * * *" - workflow_dispatch: - branches: - - develop - -jobs: - doxygen: - runs-on: ubuntu-latest - steps: - - name: 'Doxygen' - uses: mattnotmitt/doxygen-action@1.9.5 - with: - doxyfile-path: build/doxygen diff --git a/.github/workflows/doxygen-gh-pages.yml b/.github/workflows/doxygen-gh-pages.yml new file mode 100644 index 00000000000..066ede4dea3 --- /dev/null +++ b/.github/workflows/doxygen-gh-pages.yml @@ -0,0 +1,38 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +name: Doxygen +on: + schedule: + - cron: "0 15 * * *" + workflow_dispatch: + branches: + - develop +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Build + uses: DenverCoder1/doxygen-github-pages-action@v1.2.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + folder: docs/html + config_file: build/doxygen/dolibarr-doxygen.doxyfile + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: docs/html # The folder the action should deploy. + target-folder: docs/html2 + +#jobs: +# doxygen: +# runs-on: ubuntu-latest +# steps: +# - name: 'Doxygen' +# uses: mattnotmitt/doxygen-action@1.9.5 +# with: +# doxyfile-path: build/doxygen diff --git a/build/doxygen/dolibarr-doxygen-build.pl b/build/doxygen/dolibarr-doxygen-build.pl index 75a5cceddbe..5a4849a3a5b 100755 --- a/build/doxygen/dolibarr-doxygen-build.pl +++ b/build/doxygen/dolibarr-doxygen-build.pl @@ -17,9 +17,9 @@ use Cwd; my $dir = getcwd; print "Current dir is: $dir\n"; -print "Running dir for doxygen must be: $DIR\n"; +#print "Running dir for doxygen must be: $DIR\n"; -if (! -s $CONFFILE) +if (! -s "build/doxygen/$CONFFILE") { print "Error: current directory for building Dolibarr doxygen documentation is not correct.\n"; print "\n"; @@ -30,7 +30,7 @@ if (! -s $CONFFILE) exit 1; } -$SOURCE="../.."; +$SOURCE="."; # Get version $MAJOR, $MINOR and $BUILD $result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" ); @@ -47,8 +47,8 @@ $version=$MAJOR.".".$MINOR.".".$BUILD; print "Running doxygen for version ".$version.", please wait...\n"; -print "cat $CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n"; -$result=`cat $CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`; +print "cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n"; +$result=`cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`; print $result; diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index b7ca04898e5..216ba517dc5 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -41,7 +41,7 @@ PROJECT_NUMBER = x.y.z # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = ../../build +OUTPUT_DIRECTORY = build # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -117,7 +117,7 @@ FULL_PATH_NAMES = YES # If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = "../.." +STRIP_FROM_PATH = "" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells @@ -290,7 +290,7 @@ TYPEDEF_HIDES_STRUCT = NO # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols -SYMBOL_CACHE_SIZE = 0 +#SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options @@ -490,7 +490,7 @@ SHOW_USED_FILES = YES # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. -SHOW_DIRECTORIES = YES +#SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the @@ -574,7 +574,7 @@ WARN_FORMAT = "$file:$line: $text" # and error messages should be written. If left blank the output is written # to stderr. -WARN_LOGFILE = doxygen_warnings.log +WARN_LOGFILE = build/html/doxygen_warnings.log #--------------------------------------------------------------------------- # configuration options related to the input files @@ -585,7 +585,7 @@ WARN_LOGFILE = doxygen_warnings.log # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ../../htdocs ../../scripts +INPUT = htdocs scripts # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -614,7 +614,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = ../../build ../../dev ../../doc ../../document ../../documents ../../htdocs/conf/conf.php ../../htdocs/custom ../../htdocs/document ../../htdocs/documents ../../htdocs/includes +EXCLUDE = build dev doc document documents htdocs/conf/conf.php htdocs/custom htdocs/document htdocs/documents htdocs/includes # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded @@ -642,7 +642,7 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = ../../htdocs/modulebuilder/template +EXAMPLE_PATH = htdocs/modulebuilder/template # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -662,7 +662,7 @@ EXAMPLE_RECURSIVE = NO # directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = ../../doc/images +IMAGE_PATH = doc/images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -765,7 +765,7 @@ ALPHABETICAL_INDEX = YES # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) -COLS_IN_ALPHA_INDEX = 5 +#COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. @@ -802,14 +802,14 @@ HTML_FILE_EXTENSION = .html # standard header. # Does not work with 1.7.3 -#HTML_HEADER = doxygen_header.html +#HTML_HEADER = build/doxygen/doxygen_header.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. # Does not work with 1.7.3 -HTML_FOOTER = doxygen_footer.html +HTML_FOOTER = build/doxygen/doxygen_footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to @@ -855,7 +855,7 @@ HTML_TIMESTAMP = YES # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. -HTML_ALIGN_MEMBERS = YES +#HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that @@ -1051,7 +1051,7 @@ GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. -USE_INLINE_TREES = NO +#USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree @@ -1098,7 +1098,7 @@ SEARCHENGINE = YES # full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. -SERVER_BASED_SEARCH = NO +SERVER_BASED_SEARCH = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output @@ -1276,13 +1276,13 @@ XML_OUTPUT = xml # which can be used by a validating XML parser to check the # syntax of the XML files. -XML_SCHEMA = +#XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. -XML_DTD = +#XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting @@ -1447,7 +1447,7 @@ EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). -PERL_PATH = /usr/bin/perl +#PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool @@ -1469,7 +1469,7 @@ CLASS_DIAGRAMS = NO # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. -MSCGEN_PATH = +#MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented From 466239c256e1cf6371a29a4644cb600c45eb5db4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 04:08:09 +0100 Subject: [PATCH 194/370] Fix font --- build/doxygen/dolibarr-doxygen.doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 216ba517dc5..b1302c7853d 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -1501,7 +1501,7 @@ DOT_NUM_THREADS = 0 # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. -DOT_FONTNAME = FreeSans.ttf +#DOT_FONTNAME = FreeSans.ttf # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. From 7dd39092279fe9bfe35623e4414a81e8b4991331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 04:16:06 +0100 Subject: [PATCH 195/370] Fix doxygen --- .github/workflows/doxygen-gh-pages.yml | 4 ++-- build/doxygen/dolibarr-doxygen.doxyfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/doxygen-gh-pages.yml b/.github/workflows/doxygen-gh-pages.yml index 066ede4dea3..dbeebfeb8d9 100644 --- a/.github/workflows/doxygen-gh-pages.yml +++ b/.github/workflows/doxygen-gh-pages.yml @@ -18,14 +18,14 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages - folder: docs/html + folder: build/html config_file: build/doxygen/dolibarr-doxygen.doxyfile - name: Deploy uses: JamesIves/github-pages-deploy-action@v4 with: branch: gh-pages - folder: docs/html # The folder the action should deploy. + folder: build/html # The folder the action should deploy. target-folder: docs/html2 #jobs: diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index b1302c7853d..2ba292f21ad 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -614,7 +614,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = build dev doc document documents htdocs/conf/conf.php htdocs/custom htdocs/document htdocs/documents htdocs/includes +EXCLUDE = build dev doc document documents htdocs/conf/conf.php htdocs/custom htdocs/document htdocs/documents htdocs/includes htdocs/install/doctemplates # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded From 47d26974e6a4d2ece4a59b0c14c106c251b6dbdd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 04:31:27 +0100 Subject: [PATCH 196/370] Fix doxygen --- build/doxygen/dolibarr-doxygen.doxyfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 2ba292f21ad..51f697e1945 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -642,21 +642,21 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = htdocs/modulebuilder/template +#EXAMPLE_PATH = htdocs/modulebuilder/template # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = *.php +#EXAMPLE_PATTERNS = *.php # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. -EXAMPLE_RECURSIVE = NO +#EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see From c973b7d59c0b20c3b4625b63eccead5bd2d743cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 04:33:42 +0100 Subject: [PATCH 197/370] Try removing the copy --- .github/workflows/doxygen-gh-pages.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/doxygen-gh-pages.yml b/.github/workflows/doxygen-gh-pages.yml index dbeebfeb8d9..33dd47aa6e6 100644 --- a/.github/workflows/doxygen-gh-pages.yml +++ b/.github/workflows/doxygen-gh-pages.yml @@ -21,12 +21,12 @@ jobs: folder: build/html config_file: build/doxygen/dolibarr-doxygen.doxyfile - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: gh-pages - folder: build/html # The folder the action should deploy. - target-folder: docs/html2 +# - name: Deploy +# uses: JamesIves/github-pages-deploy-action@v4 +# with: +# branch: gh-pages +# folder: build/html # The folder the action should deploy. +# target-folder: docs/html2 #jobs: # doxygen: From 70e1e8cbb9d52c814c54cc3943853e89fa62c0cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 12:48:17 +0100 Subject: [PATCH 198/370] Clean code for doxygen --- build/doxygen/dolibarr-doxygen.doxyfile | 6 +- build/doxygen/doxygen-awesome.css | 2413 +++++++++++++++++ .../stock/class/api_stockmovements.class.php | 4 +- 3 files changed, 2420 insertions(+), 3 deletions(-) create mode 100644 build/doxygen/doxygen-awesome.css diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 51f697e1945..20ff102f0a2 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -1098,7 +1098,7 @@ SEARCHENGINE = YES # full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. -SERVER_BASED_SEARCH = YES +SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output @@ -1650,3 +1650,7 @@ GENERATE_LEGEND = YES # the various graphs. DOT_CLEANUP = YES + + +FULL_SIDEBAR = NO +HTML_EXTRA_STYLESHEET = build/doxygen/doxygen-awesome.css diff --git a/build/doxygen/doxygen-awesome.css b/build/doxygen/doxygen-awesome.css new file mode 100644 index 00000000000..0b1c8c20892 --- /dev/null +++ b/build/doxygen/doxygen-awesome.css @@ -0,0 +1,2413 @@ +/** + +Doxygen Awesome +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 - 2022 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +html { + /* primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ... */ + --primary-color: #1779c4; + --primary-dark-color: #335c80; + --primary-light-color: #70b1e9; + + /* page base colors */ + --page-background-color: #ffffff; + --page-foreground-color: #2f4153; + --page-secondary-foreground-color: #6f7e8e; + + /* color for all separators on the website: hr, borders, ... */ + --separator-color: #dedede; + + /* border radius for all rounded components. Will affect many components, like dropdowns, memitems, codeblocks, ... */ + --border-radius-large: 8px; + --border-radius-small: 4px; + --border-radius-medium: 6px; + + /* default spacings. Most components reference these values for spacing, to provide uniform spacing on the page. */ + --spacing-small: 5px; + --spacing-medium: 10px; + --spacing-large: 16px; + + /* default box shadow used for raising an element above the normal content. Used in dropdowns, search result, ... */ + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.075); + + --odd-color: rgba(0,0,0,.028); + + /* font-families. will affect all text on the website + * font-family: the normal font for text, headlines, menus + * font-family-monospace: used for preformatted text in memtitle, code, fragments + */ + --font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif; + --font-family-monospace: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; + + /* font sizes */ + --page-font-size: 15.6px; + --navigation-font-size: 14.4px; + --toc-font-size: 13.4px; + --code-font-size: 14px; /* affects code, fragment */ + --title-font-size: 22px; + + /* content text properties. These only affect the page content, not the navigation or any other ui elements */ + --content-line-height: 27px; + /* The content is centered and constraint in it's width. To make the content fill the whole page, set the variable to auto.*/ + --content-maxwidth: 1050px; + --table-line-height: 24px; + --toc-sticky-top: var(--spacing-medium); + --toc-width: 200px; + --toc-max-height: calc(100vh - 2 * var(--spacing-medium) - 85px); + + /* colors for various content boxes: @warning, @note, @deprecated @bug */ + --warning-color: #f8d1cc; + --warning-color-dark: #b61825; + --warning-color-darker: #75070f; + --note-color: #faf3d8; + --note-color-dark: #f3a600; + --note-color-darker: #5f4204; + --todo-color: #e4f3ff; + --todo-color-dark: #1879C4; + --todo-color-darker: #274a5c; + --deprecated-color: #ecf0f3; + --deprecated-color-dark: #5b6269; + --deprecated-color-darker: #43454a; + --bug-color: #e4dafd; + --bug-color-dark: #5b2bdd; + --bug-color-darker: #2a0d72; + --invariant-color: #d8f1e3; + --invariant-color-dark: #44b86f; + --invariant-color-darker: #265532; + + /* blockquote colors */ + --blockquote-background: #f8f9fa; + --blockquote-foreground: #636568; + + /* table colors */ + --tablehead-background: #f1f1f1; + --tablehead-foreground: var(--page-foreground-color); + + /* menu-display: block | none + * Visibility of the top navigation on screens >= 768px. On smaller screen the menu is always visible. + * `GENERATE_TREEVIEW` MUST be enabled! + */ + --menu-display: block; + + --menu-focus-foreground: var(--page-background-color); + --menu-focus-background: var(--primary-color); + --menu-selected-background: rgba(0,0,0,.05); + + + --header-background: var(--page-background-color); + --header-foreground: var(--page-foreground-color); + + /* searchbar colors */ + --searchbar-background: var(--side-nav-background); + --searchbar-foreground: var(--page-foreground-color); + + /* searchbar size + * (`searchbar-width` is only applied on screens >= 768px. + * on smaller screens the searchbar will always fill the entire screen width) */ + --searchbar-height: 33px; + --searchbar-width: 210px; + --searchbar-border-radius: var(--searchbar-height); + + /* code block colors */ + --code-background: #f5f5f5; + --code-foreground: var(--page-foreground-color); + + /* fragment colors */ + --fragment-background: #F8F9FA; + --fragment-foreground: #37474F; + --fragment-keyword: #bb6bb2; + --fragment-keywordtype: #8258b3; + --fragment-keywordflow: #d67c3b; + --fragment-token: #438a59; + --fragment-comment: #969696; + --fragment-link: #5383d6; + --fragment-preprocessor: #46aaa5; + --fragment-linenumber-color: #797979; + --fragment-linenumber-background: #f4f4f5; + --fragment-linenumber-border: #e3e5e7; + --fragment-lineheight: 20px; + + /* sidebar navigation (treeview) colors */ + --side-nav-background: #fbfbfb; + --side-nav-foreground: var(--page-foreground-color); + --side-nav-arrow-opacity: 0; + --side-nav-arrow-hover-opacity: 0.9; + + --toc-background: var(--side-nav-background); + --toc-foreground: var(--side-nav-foreground); + + /* height of an item in any tree / collapsable table */ + --tree-item-height: 30px; + + --memname-font-size: var(--code-font-size); + --memtitle-font-size: 18px; + + --webkit-scrollbar-size: 7px; + --webkit-scrollbar-padding: 4px; + --webkit-scrollbar-color: var(--separator-color); +} + +@media screen and (max-width: 767px) { + html { + --page-font-size: 16px; + --navigation-font-size: 16px; + --toc-font-size: 15px; + --code-font-size: 15px; /* affects code, fragment */ + --title-font-size: 22px; + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #86a9c4; + --primary-light-color: #4779ac; + + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.35); + + --odd-color: rgba(100,100,100,.06); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #38393b; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #222325; + --blockquote-foreground: #7e8c92; + + --warning-color: #2e1917; + --warning-color-dark: #ad2617; + --warning-color-darker: #f5b1aa; + --note-color: #3b2e04; + --note-color-dark: #f1b602; + --note-color-darker: #ceb670; + --todo-color: #163750; + --todo-color-dark: #1982D2; + --todo-color-darker: #dcf0fa; + --deprecated-color: #2e323b; + --deprecated-color-dark: #738396; + --deprecated-color-darker: #abb0bd; + --bug-color: #2a2536; + --bug-color-dark: #7661b3; + --bug-color-darker: #ae9ed6; + --invariant-color: #303a35; + --invariant-color-dark: #76ce96; + --invariant-color-darker: #cceed5; + + --fragment-background: #282c34; + --fragment-foreground: #dbe4eb; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; + } +} + +/* dark mode variables are defined twice, to support both the dark-mode without and with doxygen-awesome-darkmode-toggle.js */ +html.dark-mode { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #86a9c4; + --primary-light-color: #4779ac; + + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.30); + + --odd-color: rgba(100,100,100,.06); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #38393b; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #222325; + --blockquote-foreground: #7e8c92; + + --warning-color: #2e1917; + --warning-color-dark: #ad2617; + --warning-color-darker: #f5b1aa; + --note-color: #3b2e04; + --note-color-dark: #f1b602; + --note-color-darker: #ceb670; + --todo-color: #163750; + --todo-color-dark: #1982D2; + --todo-color-darker: #dcf0fa; + --deprecated-color: #2e323b; + --deprecated-color-dark: #738396; + --deprecated-color-darker: #abb0bd; + --bug-color: #2a2536; + --bug-color-dark: #7661b3; + --bug-color-darker: #ae9ed6; + --invariant-color: #303a35; + --invariant-color-dark: #76ce96; + --invariant-color-darker: #cceed5; + + --fragment-background: #282c34; + --fragment-foreground: #dbe4eb; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; +} + +body { + color: var(--page-foreground-color); + background-color: var(--page-background-color); + font-size: var(--page-font-size); +} + +body, table, div, p, dl, #nav-tree .label, .title, +.sm-dox a, .sm-dox a:hover, .sm-dox a:focus, #projectname, +.SelectItem, #MSearchField, .navpath li.navelem a, +.navpath li.navelem a:hover, p.reference, p.definition { + font-family: var(--font-family); +} + +h1, h2, h3, h4, h5 { + margin-top: .9em; + font-weight: 600; + line-height: initial; +} + +p, div, table, dl, p.reference, p.definition { + font-size: var(--page-font-size); +} + +p.reference, p.definition { + color: var(--page-secondary-foreground-color); +} + +a:link, a:visited, a:hover, a:focus, a:active { + color: var(--primary-color) !important; + font-weight: 500; +} + +a.anchor { + scroll-margin-top: var(--spacing-large); + display: block; +} + +/* + Title and top navigation + */ + +#top { + background: var(--header-background); + border-bottom: 1px solid var(--separator-color); +} + +@media screen and (min-width: 768px) { + #top { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + } +} + +#main-nav { + flex-grow: 5; + padding: var(--spacing-small) var(--spacing-medium); +} + +#titlearea { + width: auto; + padding: var(--spacing-medium) var(--spacing-large); + background: none; + color: var(--header-foreground); + border-bottom: none; +} + +@media screen and (max-width: 767px) { + #titlearea { + padding-bottom: var(--spacing-small); + } +} + +#titlearea table tbody tr { + height: auto !important; +} + +#projectname { + font-size: var(--title-font-size); + font-weight: 600; +} + +#projectnumber { + font-family: inherit; + font-size: 60%; +} + +#projectbrief { + font-family: inherit; + font-size: 80%; +} + +#projectlogo { + vertical-align: middle; +} + +#projectlogo img { + max-height: calc(var(--title-font-size) * 2); + margin-right: var(--spacing-small); +} + +.sm-dox, .tabs, .tabs2, .tabs3 { + background: none; + padding: 0; +} + +.tabs, .tabs2, .tabs3 { + border-bottom: 1px solid var(--separator-color); + margin-bottom: -1px; +} + +.main-menu-btn-icon, .main-menu-btn-icon:before, .main-menu-btn-icon:after { + background: var(--page-secondary-foreground-color); +} + +@media screen and (max-width: 767px) { + .sm-dox a span.sub-arrow { + background: var(--code-background); + } + + #main-menu a.has-submenu span.sub-arrow { + color: var(--page-secondary-foreground-color); + border-radius: var(--border-radius-medium); + } + + #main-menu a.has-submenu:hover span.sub-arrow { + color: var(--page-foreground-color); + } +} + +@media screen and (min-width: 768px) { + .sm-dox li, .tablist li { + display: var(--menu-display); + } + + .sm-dox a span.sub-arrow { + border-color: var(--header-foreground) transparent transparent transparent; + } + + .sm-dox a:hover span.sub-arrow { + border-color: var(--menu-focus-foreground) transparent transparent transparent; + } + + .sm-dox ul a span.sub-arrow { + border-color: transparent transparent transparent var(--page-foreground-color); + } + + .sm-dox ul a:hover span.sub-arrow { + border-color: transparent transparent transparent var(--menu-focus-foreground); + } +} + +.sm-dox ul { + background: var(--page-background-color); + box-shadow: var(--box-shadow); + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium) !important; + padding: var(--spacing-small); + animation: ease-out 150ms slideInMenu; +} + +@keyframes slideInMenu { + from { + opacity: 0; + transform: translate(0px, -2px); + } + + to { + opacity: 1; + transform: translate(0px, 0px); + } +} + +.sm-dox ul a { + color: var(--page-foreground-color) !important; + background: var(--page-background-color); + font-size: var(--navigation-font-size); +} + +.sm-dox>li>ul:after { + border-bottom-color: var(--page-background-color) !important; +} + +.sm-dox>li>ul:before { + border-bottom-color: var(--separator-color) !important; +} + +.sm-dox ul a:hover, .sm-dox ul a:active, .sm-dox ul a:focus { + font-size: var(--navigation-font-size) !important; + color: var(--menu-focus-foreground) !important; + text-shadow: none; + background-color: var(--menu-focus-background); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a, .sm-dox a:focus, .tablist li, .tablist li a, .tablist li.current a { + text-shadow: none; + background: transparent; + background-image: none !important; + color: var(--header-foreground) !important; + font-weight: normal; + font-size: var(--navigation-font-size); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a:focus { + outline: auto; +} + +.sm-dox a:hover, .sm-dox a:active, .tablist li a:hover { + text-shadow: none; + font-weight: normal; + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; + border-radius: var(--border-radius-small) !important; + font-size: var(--navigation-font-size); +} + +.tablist li.current { + border-radius: var(--border-radius-small); + background: var(--menu-selected-background); +} + +.tablist li { + margin: var(--spacing-small) 0 var(--spacing-small) var(--spacing-small); +} + +.tablist a { + padding: 0 var(--spacing-large); +} + + +/* + Search box + */ + +#MSearchBox { + height: var(--searchbar-height); + background: var(--searchbar-background); + border-radius: var(--searchbar-border-radius); + border: 1px solid var(--separator-color); + overflow: hidden; + width: var(--searchbar-width); + position: relative; + box-shadow: none; + display: block; + margin-top: 0; +} + +/* until Doxygen 1.9.4 */ +.left img#MSearchSelect { + left: 0; + user-select: none; + padding-left: 8px; +} + +/* Doxygen 1.9.5 */ +.left span#MSearchSelect { + left: 0; + user-select: none; + margin-left: 8px; + padding: 0; +} + +.left #MSearchSelect[src$=".png"] { + padding-left: 0 +} + +.SelectionMark { + user-select: none; +} + +.tabs .left #MSearchSelect { + padding-left: 0; +} + +.tabs #MSearchBox { + position: absolute; + right: var(--spacing-medium); +} + +@media screen and (max-width: 767px) { + .tabs #MSearchBox { + position: relative; + right: 0; + margin-left: var(--spacing-medium); + margin-top: 0; + } +} + +#MSearchSelectWindow, #MSearchResultsWindow { + z-index: 9999; +} + +#MSearchBox.MSearchBoxActive { + border-color: var(--primary-color); + box-shadow: inset 0 0 0 1px var(--primary-color); +} + +#main-menu > li:last-child { + margin-right: 0; +} + +@media screen and (max-width: 767px) { + #main-menu > li:last-child { + height: 50px; + } +} + +#MSearchField { + font-size: var(--navigation-font-size); + height: calc(var(--searchbar-height) - 2px); + background: transparent; + width: calc(var(--searchbar-width) - 64px); +} + +.MSearchBoxActive #MSearchField { + color: var(--searchbar-foreground); +} + +#MSearchSelect { + top: calc(calc(var(--searchbar-height) / 2) - 11px); +} + +#MSearchBox span.left, #MSearchBox span.right { + background: none; + background-image: none; +} + +#MSearchBox span.right { + padding-top: calc(calc(var(--searchbar-height) / 2) - 12px); + position: absolute; + right: var(--spacing-small); +} + +.tabs #MSearchBox span.right { + top: calc(calc(var(--searchbar-height) / 2) - 12px); +} + +@keyframes slideInSearchResults { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } +} + +#MSearchResultsWindow { + left: auto !important; + right: var(--spacing-medium); + border-radius: var(--border-radius-large); + border: 1px solid var(--separator-color); + transform: translate(0, 20px); + box-shadow: var(--box-shadow); + animation: ease-out 280ms slideInSearchResults; + background: var(--page-background-color); +} + +iframe#MSearchResults { + margin: 4px; +} + +iframe { + color-scheme: normal; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) iframe#MSearchResults { + filter: invert() hue-rotate(180deg); + } +} + +html.dark-mode iframe#MSearchResults { + filter: invert() hue-rotate(180deg); +} + +#MSearchResults .SRPage { + background-color: transparent; +} + +#MSearchResults .SRPage .SREntry { + font-size: 10pt; + padding: var(--spacing-small) var(--spacing-medium); +} + +#MSearchSelectWindow { + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + box-shadow: var(--box-shadow); + background: var(--page-background-color); + padding-top: var(--spacing-small); + padding-bottom: var(--spacing-small); +} + +#MSearchSelectWindow a.SelectItem { + font-size: var(--navigation-font-size); + line-height: var(--content-line-height); + margin: 0 var(--spacing-small); + border-radius: var(--border-radius-small); + color: var(--page-foreground-color) !important; + font-weight: normal; +} + +#MSearchSelectWindow a.SelectItem:hover { + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; +} + +@media screen and (max-width: 767px) { + #MSearchBox { + margin-top: var(--spacing-medium); + margin-bottom: var(--spacing-medium); + width: calc(100vw - 30px); + } + + #main-menu > li:last-child { + float: none !important; + } + + #MSearchField { + width: calc(100vw - 110px); + } + + @keyframes slideInSearchResultsMobile { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } + } + + #MSearchResultsWindow { + left: var(--spacing-medium) !important; + right: var(--spacing-medium); + overflow: auto; + transform: translate(0, 20px); + animation: ease-out 280ms slideInSearchResultsMobile; + width: auto !important; + } + + /* + * Overwrites for fixing the searchbox on mobile in doxygen 1.9.2 + */ + label.main-menu-btn ~ #searchBoxPos1 { + top: 3px !important; + right: 6px !important; + left: 45px; + display: flex; + } + + label.main-menu-btn ~ #searchBoxPos1 > #MSearchBox { + margin-top: 0; + margin-bottom: 0; + flex-grow: 2; + float: left; + } +} + +/* + Tree view + */ + +#side-nav { + padding: 0 !important; + background: var(--side-nav-background); +} + +@media screen and (max-width: 767px) { + #side-nav { + display: none; + } + + #doc-content { + margin-left: 0 !important; + } +} + +#nav-tree { + background: transparent; +} + +#nav-tree .label { + font-size: var(--navigation-font-size); +} + +#nav-tree .item { + height: var(--tree-item-height); + line-height: var(--tree-item-height); +} + +#nav-sync { + bottom: 12px; + right: 12px; + top: auto !important; + user-select: none; +} + +#nav-tree .selected { + text-shadow: none; + background-image: none; + background-color: transparent; + position: relative; +} + +#nav-tree .selected::after { + content: ""; + position: absolute; + top: 1px; + bottom: 1px; + left: 0; + width: 4px; + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; + background: var(--primary-color); +} + + +#nav-tree a { + color: var(--side-nav-foreground) !important; + font-weight: normal; +} + +#nav-tree a:focus { + outline-style: auto; +} + +#nav-tree .arrow { + opacity: var(--side-nav-arrow-opacity); +} + +.arrow { + color: inherit; + cursor: pointer; + font-size: 45%; + vertical-align: middle; + margin-right: 2px; + font-family: serif; + height: auto; + text-align: right; +} + +#nav-tree div.item:hover .arrow, #nav-tree a:focus .arrow { + opacity: var(--side-nav-arrow-hover-opacity); +} + +#nav-tree .selected a { + color: var(--primary-color) !important; + font-weight: bolder; + font-weight: 600; +} + +.ui-resizable-e { + background: var(--separator-color); + width: 1px; +} + +/* + Contents + */ + +div.header { + border-bottom: 1px solid var(--separator-color); + background-color: var(--page-background-color); + background-image: none; +} + +@media screen and (min-width: 1000px) { + #doc-content > div > div.contents, + .PageDoc > div.contents { + display: flex; + flex-direction: row-reverse; + flex-wrap: nowrap; + align-items: flex-start; + } + + div.contents .textblock { + min-width: 200px; + flex-grow: 1; + } +} + +div.contents, div.header .title, div.header .summary { + max-width: var(--content-maxwidth); +} + +div.contents, div.header .title { + line-height: initial; + margin: calc(var(--spacing-medium) + .2em) auto var(--spacing-medium) auto; +} + +div.header .summary { + margin: var(--spacing-medium) auto 0 auto; +} + +div.headertitle { + padding: 0; +} + +div.header .title { + font-weight: 600; + font-size: 225%; + padding: var(--spacing-medium) var(--spacing-large); + word-break: break-word; +} + +div.header .summary { + width: auto; + display: block; + float: none; + padding: 0 var(--spacing-large); +} + +td.memSeparator { + border-color: var(--separator-color); +} + +span.mlabel { + background: var(--primary-color); + border: none; + padding: 4px 9px; + border-radius: 12px; + margin-right: var(--spacing-medium); +} + +span.mlabel:last-of-type { + margin-right: 2px; +} + +div.contents { + padding: 0 var(--spacing-large); +} + +div.contents p, div.contents li { + line-height: var(--content-line-height); +} + +div.contents div.dyncontent { + margin: var(--spacing-medium) 0; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) div.contents div.dyncontent img, + html:not(.light-mode) div.contents center img, + html:not(.light-mode) div.contents > table img, + html:not(.light-mode) div.contents div.dyncontent iframe, + html:not(.light-mode) div.contents center iframe, + html:not(.light-mode) div.contents table iframe { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode div.contents div.dyncontent img, +html.dark-mode div.contents center img, +html.dark-mode div.contents > table img, +html.dark-mode div.contents div.dyncontent iframe, +html.dark-mode div.contents center iframe, +html.dark-mode div.contents table iframe { + filter: hue-rotate(180deg) invert(); +} + +h2.groupheader { + border-bottom: 0px; + color: var(--page-foreground-color); + box-shadow: + 100px 0 var(--page-background-color), + -100px 0 var(--page-background-color), + 100px 0.75px var(--separator-color), + -100px 0.75px var(--separator-color), + 500px 0 var(--page-background-color), + -500px 0 var(--page-background-color), + 500px 0.75px var(--separator-color), + -500px 0.75px var(--separator-color), + 900px 0 var(--page-background-color), + -900px 0 var(--page-background-color), + 900px 0.75px var(--separator-color), + -900px 0.75px var(--separator-color), + 1400px 0 var(--page-background-color), + -1400px 0 var(--page-background-color), + 1400px 0.75px var(--separator-color), + -1400px 0.75px var(--separator-color), + 1900px 0 var(--page-background-color), + -1900px 0 var(--page-background-color), + 1900px 0.75px var(--separator-color), + -1900px 0.75px var(--separator-color); +} + +blockquote { + margin: 0 var(--spacing-medium) 0 var(--spacing-medium); + padding: var(--spacing-small) var(--spacing-large); + background: var(--blockquote-background); + color: var(--blockquote-foreground); + border-left: 0; + overflow: visible; + border-radius: var(--border-radius-medium); + overflow: visible; + position: relative; +} + +blockquote::before, blockquote::after { + font-weight: bold; + font-family: serif; + font-size: 360%; + opacity: .15; + position: absolute; +} + +blockquote::before { + content: "“"; + left: -10px; + top: 4px; +} + +blockquote::after { + content: "”"; + right: -8px; + bottom: -25px; +} + +blockquote p { + margin: var(--spacing-small) 0 var(--spacing-medium) 0; +} +.paramname { + font-weight: 600; + color: var(--primary-dark-color); +} + +.paramname > code { + border: 0; +} + +table.params .paramname { + font-weight: 600; + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); + padding-right: var(--spacing-small); + line-height: var(--table-line-height); +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px var(--primary-light-color); +} + +.alphachar a { + color: var(--page-foreground-color); +} + +/* + Table of Contents + */ + +div.contents .toc { + max-height: var(--toc-max-height); + min-width: var(--toc-width); + border: 0; + border-left: 1px solid var(--separator-color); + border-radius: 0; + background-color: transparent; + box-shadow: none; + position: sticky; + top: var(--toc-sticky-top); + padding: 0 var(--spacing-large); + margin: var(--spacing-small) 0 var(--spacing-large) var(--spacing-large); +} + +div.toc h3 { + color: var(--toc-foreground); + font-size: var(--navigation-font-size); + margin: var(--spacing-large) 0 var(--spacing-medium) 0; +} + +div.toc li { + padding: 0; + background: none; + line-height: var(--toc-font-size); + margin: var(--toc-font-size) 0 0 0; +} + +div.toc li::before { + display: none; +} + +div.toc ul { + margin-top: 0 +} + +div.toc li a { + font-size: var(--toc-font-size); + color: var(--page-foreground-color) !important; + text-decoration: none; +} + +div.toc li a:hover, div.toc li a.active { + color: var(--primary-color) !important; +} + +div.toc li a.aboveActive { + color: var(--page-secondary-foreground-color) !important; +} + + +@media screen and (max-width: 999px) { + div.contents .toc { + max-height: 45vh; + float: none; + width: auto; + margin: 0 0 var(--spacing-medium) 0; + position: relative; + top: 0; + position: relative; + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + background-color: var(--toc-background); + box-shadow: var(--box-shadow); + } + + div.contents .toc.interactive { + max-height: calc(var(--navigation-font-size) + 2 * var(--spacing-large)); + overflow: hidden; + } + + div.contents .toc > h3 { + -webkit-tap-highlight-color: transparent; + cursor: pointer; + position: sticky; + top: 0; + background-color: var(--toc-background); + margin: 0; + padding: var(--spacing-large) 0; + display: block; + } + + div.contents .toc.interactive > h3::before { + content: ""; + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 5px solid var(--primary-color); + display: inline-block; + margin-right: var(--spacing-small); + margin-bottom: calc(var(--navigation-font-size) / 4); + transform: rotate(-90deg); + transition: transform 0.25s ease-out; + } + + div.contents .toc.interactive.open > h3::before { + transform: rotate(0deg); + } + + div.contents .toc.interactive.open { + max-height: 45vh; + overflow: auto; + transition: max-height 0.2s ease-in-out; + } + + div.contents .toc a, div.contents .toc a.active { + color: var(--primary-color) !important; + } + + div.contents .toc a:hover { + text-decoration: underline; + } +} + +/* + Code & Fragments + */ + +code, div.fragment, pre.fragment { + border-radius: var(--border-radius-small); + border: 1px solid var(--separator-color); + overflow: hidden; +} + +code { + display: inline; + background: var(--code-background); + color: var(--code-foreground); + padding: 2px 6px; +} + +div.fragment, pre.fragment { + margin: var(--spacing-medium) 0; + padding: calc(var(--spacing-large) - (var(--spacing-large) / 6)) var(--spacing-large); + background: var(--fragment-background); + color: var(--fragment-foreground); + overflow-x: auto; +} + +@media screen and (max-width: 767px) { + div.fragment, pre.fragment { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: 0; + } + + .contents > div.fragment, + .textblock > div.fragment, + .textblock > pre.fragment, + .contents > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .doxygen-awesome-fragment-wrapper > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + border-radius: 0; + border-left: 0; + } + + .textblock li > .fragment, + .textblock li > .doxygen-awesome-fragment-wrapper > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + } + + .memdoc li > .fragment, + .memdoc li > .doxygen-awesome-fragment-wrapper > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + } + + .textblock ul, .memdoc ul { + overflow: initial; + } + + .memdoc > div.fragment, + .memdoc > pre.fragment, + dl dd > div.fragment, + dl dd pre.fragment, + .memdoc > .doxygen-awesome-fragment-wrapper > div.fragment, + .memdoc > .doxygen-awesome-fragment-wrapper > pre.fragment, + dl dd > .doxygen-awesome-fragment-wrapper > div.fragment, + dl dd .doxygen-awesome-fragment-wrapper > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + border-radius: 0; + border-left: 0; + } +} + +code, code a, pre.fragment, div.fragment, div.fragment .line, div.fragment span, div.fragment .line a, div.fragment .line span { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size) !important; +} + +div.line:after { + margin-right: var(--spacing-medium); +} + +div.fragment .line, pre.fragment { + white-space: pre; + word-wrap: initial; + line-height: var(--fragment-lineheight); +} + +div.fragment span.keyword { + color: var(--fragment-keyword); +} + +div.fragment span.keywordtype { + color: var(--fragment-keywordtype); +} + +div.fragment span.keywordflow { + color: var(--fragment-keywordflow); +} + +div.fragment span.stringliteral { + color: var(--fragment-token) +} + +div.fragment span.comment { + color: var(--fragment-comment); +} + +div.fragment a.code { + color: var(--fragment-link) !important; +} + +div.fragment span.preprocessor { + color: var(--fragment-preprocessor); +} + +div.fragment span.lineno { + display: inline-block; + width: 27px; + border-right: none; + background: var(--fragment-linenumber-background); + color: var(--fragment-linenumber-color); +} + +div.fragment span.lineno a { + background: none; + color: var(--fragment-link) !important; +} + +div.fragment .line:first-child .lineno { + box-shadow: -999999px 0px 0 999999px var(--fragment-linenumber-background), -999998px 0px 0 999999px var(--fragment-linenumber-border); +} + +div.line { + border-radius: var(--border-radius-small); +} + +div.line.glow { + background-color: var(--primary-light-color); + box-shadow: none; +} + +/* + dl warning, attention, note, deprecated, bug, ... + */ + +dl.bug dt a, dl.deprecated dt a, dl.todo dt a { + font-weight: bold !important; +} + +dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, dl.invariant, dl.pre, dl.todo, dl.remark { + padding: var(--spacing-medium); + margin: var(--spacing-medium) 0; + color: var(--page-background-color); + overflow: hidden; + margin-left: 0; + border-radius: var(--border-radius-small); +} + +dl.section dd { + margin-bottom: 2px; +} + +dl.warning, dl.attention { + background: var(--warning-color); + border-left: 8px solid var(--warning-color-dark); + color: var(--warning-color-darker); +} + +dl.warning dt, dl.attention dt { + color: var(--warning-color-dark); +} + +dl.note, dl.remark { + background: var(--note-color); + border-left: 8px solid var(--note-color-dark); + color: var(--note-color-darker); +} + +dl.note dt, dl.remark dt { + color: var(--note-color-dark); +} + +dl.todo { + background: var(--todo-color); + border-left: 8px solid var(--todo-color-dark); + color: var(--todo-color-darker); +} + +dl.todo dt { + color: var(--todo-color-dark); +} + +dl.bug dt a { + color: var(--todo-color-dark) !important; +} + +dl.bug { + background: var(--bug-color); + border-left: 8px solid var(--bug-color-dark); + color: var(--bug-color-darker); +} + +dl.bug dt a { + color: var(--bug-color-dark) !important; +} + +dl.deprecated { + background: var(--deprecated-color); + border-left: 8px solid var(--deprecated-color-dark); + color: var(--deprecated-color-darker); +} + +dl.deprecated dt a { + color: var(--deprecated-color-dark) !important; +} + +dl.section dd, dl.bug dd, dl.deprecated dd, dl.todo dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre { + background: var(--invariant-color); + border-left: 8px solid var(--invariant-color-dark); + color: var(--invariant-color-darker); +} + +dl.invariant dt, dl.pre dt { + color: var(--invariant-color-dark); +} + +/* + memitem + */ + +div.memdoc, div.memproto, h2.memtitle { + box-shadow: none; + background-image: none; + border: none; +} + +div.memdoc { + padding: 0 var(--spacing-medium); + background: var(--page-background-color); +} + +h2.memtitle, div.memitem { + border: 1px solid var(--separator-color); + box-shadow: var(--box-shadow); +} + +h2.memtitle { + box-shadow: 0px var(--spacing-medium) 0 -1px var(--fragment-background), var(--box-shadow); +} + +div.memitem { + transition: none; +} + +div.memproto, h2.memtitle { + background: var(--fragment-background); +} + +h2.memtitle { + font-weight: 500; + font-size: var(--memtitle-font-size); + font-family: var(--font-family-monospace); + border-bottom: none; + border-top-left-radius: var(--border-radius-medium); + border-top-right-radius: var(--border-radius-medium); + word-break: break-all; + position: relative; +} + +h2.memtitle:after { + content: ""; + display: block; + background: var(--fragment-background); + height: var(--spacing-medium); + bottom: calc(0px - var(--spacing-medium)); + left: 0; + right: -14px; + position: absolute; + border-top-right-radius: var(--border-radius-medium); +} + +h2.memtitle > span.permalink { + font-size: inherit; +} + +h2.memtitle > span.permalink > a { + text-decoration: none; + padding-left: 3px; + margin-right: -4px; + user-select: none; + display: inline-block; + margin-top: -6px; +} + +h2.memtitle > span.permalink > a:hover { + color: var(--primary-dark-color) !important; +} + +a:target + h2.memtitle, a:target + h2.memtitle + div.memitem { + border-color: var(--primary-light-color); +} + +div.memitem { + border-top-right-radius: var(--border-radius-medium); + border-bottom-right-radius: var(--border-radius-medium); + border-bottom-left-radius: var(--border-radius-medium); + overflow: hidden; + display: block !important; +} + +div.memdoc { + border-radius: 0; +} + +div.memproto { + border-radius: 0 var(--border-radius-small) 0 0; + overflow: auto; + border-bottom: 1px solid var(--separator-color); + padding: var(--spacing-medium); + margin-bottom: -1px; +} + +div.memtitle { + border-top-right-radius: var(--border-radius-medium); + border-top-left-radius: var(--border-radius-medium); +} + +div.memproto table.memname { + font-family: var(--font-family-monospace); + color: var(--page-foreground-color); + font-size: var(--memname-font-size); + text-shadow: none; +} + +div.memproto div.memtemplate { + font-family: var(--font-family-monospace); + color: var(--primary-dark-color); + font-size: var(--memname-font-size); + margin-left: 2px; + text-shadow: none; +} + +table.mlabels, table.mlabels > tbody { + display: block; +} + +td.mlabels-left { + width: auto; +} + +td.mlabels-right { + margin-top: 3px; + position: sticky; + left: 0; +} + +table.mlabels > tbody > tr:first-child { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.memname, .memitem span.mlabels { + margin: 0 +} + +/* + reflist + */ + +dl.reflist { + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-medium); + border: 1px solid var(--separator-color); + overflow: hidden; + padding: 0; +} + + +dl.reflist dt, dl.reflist dd { + box-shadow: none; + text-shadow: none; + background-image: none; + border: none; + padding: 12px; +} + + +dl.reflist dt { + font-weight: 500; + border-radius: 0; + background: var(--code-background); + border-bottom: 1px solid var(--separator-color); + color: var(--page-foreground-color) +} + + +dl.reflist dd { + background: none; +} + +/* + Table + */ + +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname), +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody { + display: inline-block; + max-width: 100%; +} + +.contents > table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname):not(.classindex) { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + max-width: calc(100% + 2 * var(--spacing-large)); +} + +table.fieldtable, +table.markdownTable tbody, +table.doxtable tbody { + border: none; + margin: var(--spacing-medium) 0; + box-shadow: 0 0 0 1px var(--separator-color); + border-radius: var(--border-radius-small); +} + +table.doxtable caption { + display: block; +} + +table.fieldtable { + border-collapse: collapse; + width: 100%; +} + +th.markdownTableHeadLeft, +th.markdownTableHeadRight, +th.markdownTableHeadCenter, +th.markdownTableHeadNone, +table.doxtable th { + background: var(--tablehead-background); + color: var(--tablehead-foreground); + font-weight: 600; + font-size: var(--page-font-size); +} + +th.markdownTableHeadLeft:first-child, +th.markdownTableHeadRight:first-child, +th.markdownTableHeadCenter:first-child, +th.markdownTableHeadNone:first-child, +table.doxtable tr th:first-child { + border-top-left-radius: var(--border-radius-small); +} + +th.markdownTableHeadLeft:last-child, +th.markdownTableHeadRight:last-child, +th.markdownTableHeadCenter:last-child, +th.markdownTableHeadNone:last-child, +table.doxtable tr th:last-child { + border-top-right-radius: var(--border-radius-small); +} + +table.markdownTable td, +table.markdownTable th, +table.fieldtable td, +table.fieldtable th, +table.doxtable td, +table.doxtable th { + border: 1px solid var(--separator-color); + padding: var(--spacing-small) var(--spacing-medium); +} + +table.markdownTable td:last-child, +table.markdownTable th:last-child, +table.fieldtable td:last-child, +table.fieldtable th:last-child, +table.doxtable td:last-child, +table.doxtable th:last-child { + border-right: none; +} + +table.markdownTable td:first-child, +table.markdownTable th:first-child, +table.fieldtable td:first-child, +table.fieldtable th:first-child, +table.doxtable td:first-child, +table.doxtable th:first-child { + border-left: none; +} + +table.markdownTable tr:first-child td, +table.markdownTable tr:first-child th, +table.fieldtable tr:first-child td, +table.fieldtable tr:first-child th, +table.doxtable tr:first-child td, +table.doxtable tr:first-child th { + border-top: none; +} + +table.markdownTable tr:last-child td, +table.markdownTable tr:last-child th, +table.fieldtable tr:last-child td, +table.fieldtable tr:last-child th, +table.doxtable tr:last-child td, +table.doxtable tr:last-child th { + border-bottom: none; +} + +table.markdownTable tr, table.doxtable tr { + border-bottom: 1px solid var(--separator-color); +} + +table.markdownTable tr:last-child, table.doxtable tr:last-child { + border-bottom: none; +} + +table.fieldtable th { + font-size: var(--page-font-size); + font-weight: 600; + background-image: none; + background-color: var(--tablehead-background); + color: var(--tablehead-foreground); +} + +table.fieldtable td.fieldtype, .fieldtable td.fieldname, .fieldtable td.fielddoc, .fieldtable th { + border-bottom: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); +} + +table.fieldtable tr:last-child td:first-child { + border-bottom-left-radius: var(--border-radius-small); +} + +table.fieldtable tr:last-child td:last-child { + border-bottom-right-radius: var(--border-radius-small); +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: var(--primary-light-color); + box-shadow: none; +} + +table.memberdecls { + display: block; + -webkit-tap-highlight-color: transparent; +} + +table.memberdecls tr[class^='memitem'] { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); +} + +table.memberdecls tr[class^='memitem'] .memTemplParams { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); + color: var(--primary-dark-color); + white-space: normal; +} + +table.memberdecls .memItemLeft, +table.memberdecls .memItemRight, +table.memberdecls .memTemplItemLeft, +table.memberdecls .memTemplItemRight, +table.memberdecls .memTemplParams { + transition: none; + padding-top: var(--spacing-small); + padding-bottom: var(--spacing-small); + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + background-color: var(--fragment-background); +} + +table.memberdecls .memTemplItemLeft, +table.memberdecls .memTemplItemRight { + padding-top: 2px; +} + +table.memberdecls .memTemplParams { + border-bottom: 0; + border-left: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); + border-radius: var(--border-radius-small) var(--border-radius-small) 0 0; + padding-bottom: var(--spacing-small); +} + +table.memberdecls .memTemplItemLeft { + border-radius: 0 0 0 var(--border-radius-small); + border-left: 1px solid var(--separator-color); + border-top: 0; +} + +table.memberdecls .memTemplItemRight { + border-radius: 0 0 var(--border-radius-small) 0; + border-right: 1px solid var(--separator-color); + padding-left: 0; + border-top: 0; +} + +table.memberdecls .memItemLeft { + border-radius: var(--border-radius-small) 0 0 var(--border-radius-small); + border-left: 1px solid var(--separator-color); + padding-left: var(--spacing-medium); + padding-right: 0; +} + +table.memberdecls .memItemRight { + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; + border-right: 1px solid var(--separator-color); + padding-right: var(--spacing-medium); + padding-left: 0; + +} + +table.memberdecls .mdescLeft, table.memberdecls .mdescRight { + background: none; + color: var(--page-foreground-color); + padding: var(--spacing-small) 0; +} + +table.memberdecls .memItemLeft, +table.memberdecls .memTemplItemLeft { + padding-right: var(--spacing-medium); +} + +table.memberdecls .memSeparator { + background: var(--page-background-color); + height: var(--spacing-large); + border: 0; + transition: none; +} + +table.memberdecls .groupheader { + margin-bottom: var(--spacing-large); +} + +table.memberdecls .inherit_header td { + padding: 0 0 var(--spacing-medium) 0; + text-indent: -12px; + color: var(--page-secondary-foreground-color); +} + +table.memberdecls img[src="closed.png"], +table.memberdecls img[src="open.png"], +div.dynheader img[src="open.png"], +div.dynheader img[src="closed.png"] { + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 5px solid var(--primary-color); + margin-top: 8px; + display: block; + float: left; + margin-left: -10px; + transition: transform 0.25s ease-out; +} + +table.memberdecls img { + margin-right: 10px; +} + +table.memberdecls img[src="closed.png"], +div.dynheader img[src="closed.png"] { + transform: rotate(-90deg); + +} + +.compoundTemplParams { + font-family: var(--font-family-monospace); + color: var(--primary-dark-color); + font-size: var(--code-font-size); +} + +@media screen and (max-width: 767px) { + + table.memberdecls .memItemLeft, + table.memberdecls .memItemRight, + table.memberdecls .mdescLeft, + table.memberdecls .mdescRight, + table.memberdecls .memTemplItemLeft, + table.memberdecls .memTemplItemRight, + table.memberdecls .memTemplParams { + display: block; + text-align: left; + padding-left: var(--spacing-large); + margin: 0 calc(0px - var(--spacing-large)) 0 calc(0px - var(--spacing-large)); + border-right: none; + border-left: none; + border-radius: 0; + white-space: normal; + } + + table.memberdecls .memItemLeft, + table.memberdecls .mdescLeft, + table.memberdecls .memTemplItemLeft { + border-bottom: 0; + padding-bottom: 0; + } + + table.memberdecls .memTemplItemLeft { + padding-top: 0; + } + + table.memberdecls .mdescLeft { + margin-bottom: calc(0px - var(--page-font-size)); + } + + table.memberdecls .memItemRight, + table.memberdecls .mdescRight, + table.memberdecls .memTemplItemRight { + border-top: 0; + padding-top: 0; + padding-right: var(--spacing-large); + overflow-x: auto; + } + + table.memberdecls tr[class^='memitem']:not(.inherit) { + display: block; + width: calc(100vw - 2 * var(--spacing-large)); + } + + table.memberdecls .mdescRight { + color: var(--page-foreground-color); + } + + table.memberdecls tr.inherit { + visibility: hidden; + } + + table.memberdecls tr[style="display: table-row;"] { + display: block !important; + visibility: visible; + width: calc(100vw - 2 * var(--spacing-large)); + animation: fade .5s; + } + + @keyframes fade { + 0% { + opacity: 0; + max-height: 0; + } + + 100% { + opacity: 1; + max-height: 200px; + } + } +} + + +/* + Horizontal Rule + */ + +hr { + margin-top: var(--spacing-large); + margin-bottom: var(--spacing-large); + height: 1px; + background-color: var(--separator-color); + border: 0; +} + +.contents hr { + box-shadow: 100px 0 0 var(--separator-color), + -100px 0 0 var(--separator-color), + 500px 0 0 var(--separator-color), + -500px 0 0 var(--separator-color), + 1500px 0 0 var(--separator-color), + -1500px 0 0 var(--separator-color), + 2000px 0 0 var(--separator-color), + -2000px 0 0 var(--separator-color); +} + +.contents img, .contents .center, .contents center, .contents div.image object { + max-width: 100%; + overflow: auto; +} + +@media screen and (max-width: 767px) { + .contents .dyncontent > .center, .contents > center { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + max-width: calc(100% + 2 * var(--spacing-large)); + } +} + +/* + Directories + */ +div.directory { + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + width: auto; +} + +table.directory { + font-family: var(--font-family); + font-size: var(--page-font-size); + font-weight: normal; + width: 100%; +} + +table.directory td.entry, table.directory td.desc { + padding: calc(var(--spacing-small) / 2) var(--spacing-small); + line-height: var(--table-line-height); +} + +table.directory tr.even td:last-child { + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; +} + +table.directory tr.even td:first-child { + border-radius: var(--border-radius-small) 0 0 var(--border-radius-small); +} + +table.directory tr.even:last-child td:last-child { + border-radius: 0 var(--border-radius-small) 0 0; +} + +table.directory tr.even:last-child td:first-child { + border-radius: var(--border-radius-small) 0 0 0; +} + +table.directory td.desc { + min-width: 250px; +} + +table.directory tr.even { + background-color: var(--odd-color); +} + +table.directory tr.odd { + background-color: transparent; +} + +.icona { + width: auto; + height: auto; + margin: 0 var(--spacing-small); +} + +.icon { + background: var(--primary-color); + border-radius: var(--border-radius-small); + font-size: var(--page-font-size); + padding: calc(var(--page-font-size) / 5); + line-height: var(--page-font-size); + transform: scale(0.8); + height: auto; + width: var(--page-font-size); + user-select: none; +} + +.iconfopen, .icondoc, .iconfclosed { + background-position: center; + margin-bottom: 0; + height: var(--table-line-height); +} + +.icondoc { + filter: saturate(0.2); +} + +@media screen and (max-width: 767px) { + div.directory { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) .iconfopen, html:not(.light-mode) .iconfclosed { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode .iconfopen, html.dark-mode .iconfclosed { + filter: hue-rotate(180deg) invert(); +} + +/* + Class list + */ + +.classindex dl.odd { + background: var(--odd-color); + border-radius: var(--border-radius-small); +} + +.classindex dl.even { + background-color: transparent; +} + +/* + Class Index Doxygen 1.8 +*/ + +table.classindex { + margin-left: 0; + margin-right: 0; + width: 100%; +} + +table.classindex table div.ah { + background-image: none; + background-color: initial; + border-color: var(--separator-color); + color: var(--page-foreground-color); + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-large); + padding: var(--spacing-small); +} + +div.qindex { + background-color: var(--odd-color); + border-radius: var(--border-radius-small); + border: 1px solid var(--separator-color); + padding: var(--spacing-small) 0; +} + +/* + Footer and nav-path + */ + +#nav-path { + width: 100%; +} + +#nav-path ul { + background-image: none; + background: var(--page-background-color); + border: none; + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + border-bottom: 0; + box-shadow: 0 0.75px 0 var(--separator-color); + font-size: var(--navigation-font-size); +} + +img.footer { + width: 60px; +} + +.navpath li.footer { + color: var(--page-secondary-foreground-color); +} + +address.footer { + color: var(--page-secondary-foreground-color); + margin-bottom: var(--spacing-large); +} + +#nav-path li.navelem { + background-image: none; + display: flex; + align-items: center; +} + +.navpath li.navelem a { + text-shadow: none; + display: inline-block; + color: var(--primary-color) !important; +} + +.navpath li.navelem b { + color: var(--primary-dark-color); + font-weight: 500; +} + +li.navelem { + padding: 0; + margin-left: -8px; +} + +li.navelem:first-child { + margin-left: var(--spacing-large); +} + +li.navelem:first-child:before { + display: none; +} + +#nav-path li.navelem:after { + content: ''; + border: 5px solid var(--page-background-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: translateY(-1px) scaleY(4.2); + z-index: 10; + margin-left: 6px; +} + +#nav-path li.navelem:before { + content: ''; + border: 5px solid var(--separator-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: translateY(-1px) scaleY(3.2); + margin-right: var(--spacing-small); +} + +.navpath li.navelem a:hover { + color: var(--primary-color); +} + +/* + Scrollbars for Webkit +*/ + +#nav-tree::-webkit-scrollbar, +div.fragment::-webkit-scrollbar, +pre.fragment::-webkit-scrollbar, +div.memproto::-webkit-scrollbar, +.contents center::-webkit-scrollbar, +.contents .center::-webkit-scrollbar, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar, +div.contents .toc::-webkit-scrollbar { + background: transparent; + width: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); + height: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); +} + +#nav-tree::-webkit-scrollbar-thumb, +div.fragment::-webkit-scrollbar-thumb, +pre.fragment::-webkit-scrollbar-thumb, +div.memproto::-webkit-scrollbar-thumb, +.contents center::-webkit-scrollbar-thumb, +.contents .center::-webkit-scrollbar-thumb, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-thumb, +div.contents .toc::-webkit-scrollbar-thumb { + background-color: transparent; + border: var(--webkit-scrollbar-padding) solid transparent; + border-radius: calc(var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); + background-clip: padding-box; +} + +#nav-tree:hover::-webkit-scrollbar-thumb, +div.fragment:hover::-webkit-scrollbar-thumb, +pre.fragment:hover::-webkit-scrollbar-thumb, +div.memproto:hover::-webkit-scrollbar-thumb, +.contents center:hover::-webkit-scrollbar-thumb, +.contents .center:hover::-webkit-scrollbar-thumb, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody:hover::-webkit-scrollbar-thumb, +div.contents .toc:hover::-webkit-scrollbar-thumb { + background-color: var(--webkit-scrollbar-color); +} + +#nav-tree::-webkit-scrollbar-track, +div.fragment::-webkit-scrollbar-track, +pre.fragment::-webkit-scrollbar-track, +div.memproto::-webkit-scrollbar-track, +.contents center::-webkit-scrollbar-track, +.contents .center::-webkit-scrollbar-track, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-track, +div.contents .toc::-webkit-scrollbar-track { + background: transparent; +} + +#nav-tree::-webkit-scrollbar-corner { + background-color: var(--side-nav-background); +} + +#nav-tree, +div.fragment, +pre.fragment, +div.memproto, +.contents center, +.contents .center, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, +div.contents .toc { + overflow-x: auto; + overflow-x: overlay; +} + +#nav-tree { + overflow-x: auto; + overflow-y: auto; + overflow-y: overlay; +} + +/* + Scrollbars for Firefox +*/ + +#nav-tree, +div.fragment, +pre.fragment, +div.memproto, +.contents center, +.contents .center, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, +div.contents .toc { + scrollbar-width: thin; +} + +/* + Optional Dark mode toggle button +*/ + +doxygen-awesome-dark-mode-toggle { + display: inline-block; + margin: 0 0 0 var(--spacing-small); + padding: 0; + width: var(--searchbar-height); + height: var(--searchbar-height); + background: none; + border: none; + border-radius: var(--searchbar-height); + vertical-align: middle; + text-align: center; + line-height: var(--searchbar-height); + font-size: 22px; + display: flex; + align-items: center; + justify-content: center; + user-select: none; + cursor: pointer; +} + +doxygen-awesome-dark-mode-toggle > svg { + transition: transform .1s ease-in-out; +} + +doxygen-awesome-dark-mode-toggle:active > svg { + transform: scale(.5); +} + +doxygen-awesome-dark-mode-toggle:hover { + background-color: rgba(0,0,0,.03); +} + +html.dark-mode doxygen-awesome-dark-mode-toggle:hover { + background-color: rgba(0,0,0,.18); +} + +/* + Optional fragment copy button +*/ +.doxygen-awesome-fragment-wrapper { + position: relative; +} + +doxygen-awesome-fragment-copy-button { + opacity: 0; + background: var(--fragment-background); + width: 28px; + height: 28px; + position: absolute; + right: calc(var(--spacing-large) - (var(--spacing-large) / 2.5)); + top: calc(var(--spacing-large) - (var(--spacing-large) / 2.5)); + border: 1px solid var(--fragment-foreground); + cursor: pointer; + border-radius: var(--border-radius-small); + display: flex; + justify-content: center; + align-items: center; +} + +.doxygen-awesome-fragment-wrapper:hover doxygen-awesome-fragment-copy-button, doxygen-awesome-fragment-copy-button.success { + opacity: .28; +} + +doxygen-awesome-fragment-copy-button:hover, doxygen-awesome-fragment-copy-button.success { + opacity: 1 !important; +} + +doxygen-awesome-fragment-copy-button:active:not([class~=success]) svg { + transform: scale(.91); +} + +doxygen-awesome-fragment-copy-button svg { + fill: var(--fragment-foreground); + width: 18px; + height: 18px; +} + +doxygen-awesome-fragment-copy-button.success svg { + fill: rgb(14, 168, 14); +} + +doxygen-awesome-fragment-copy-button.success { + border-color: rgb(14, 168, 14); +} + +@media screen and (max-width: 767px) { + .textblock > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .textblock li > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .memdoc li > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .memdoc > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + dl dd > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button { + right: 0; + } +} + +/* + Optional paragraph link button +*/ + +a.anchorlink { + font-size: 90%; + margin-left: var(--spacing-small); + color: var(--page-foreground-color) !important; + text-decoration: none; + opacity: .15; + display: none; + transition: opacity .1s ease-in-out, color .1s ease-in-out; +} + +a.anchorlink svg { + fill: var(--page-foreground-color); +} + +h3 a.anchorlink svg, h4 a.anchorlink svg { + margin-bottom: -3px; + margin-top: -4px; +} + +a.anchorlink:hover { + opacity: .45; +} + +h2:hover a.anchorlink, h1:hover a.anchorlink, h3:hover a.anchorlink, h4:hover a.anchorlink { + display: inline-block; +} + + +#MSearchBox .left { + background: none !important; +} +#MSearchBox .right { + background: none !important; +} diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 544485060af..472d38ea245 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -162,8 +162,8 @@ class StockMovements extends DolibarrApi * @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true} * @param int $type Optionally specify the type of movement. 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer), 2=output (stock decrease), 3=input (stock increase). {@from body} {@type int} * @param string $lot Lot {@from body} - * @param string $movementcode Movement code {@example INV123} {@from body} - * @param string $movementlabel Movement label {@example Inventory number 123} {@from body} + * @param string $movementcode Movement code {@from body} + * @param string $movementlabel Movement label {@from body} * @param string $price To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0). {@from body} * @param string $datem Date of movement {@from body} {@type date} * @param string $dlc Eat-by date. {@from body} {@type date} From 59ed7b9f96f8b6ad5bf42ac4fc04e56f587ec9c1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 2 Jan 2023 11:52:34 +0000 Subject: [PATCH 199/370] Fixing style errors. --- htdocs/comm/propal/card.php | 26 ++++++++++----------- htdocs/commande/card.php | 45 ++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 73a94a2a503..7953691f11b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1235,7 +1235,7 @@ if (empty($reshook)) { // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; - $pu_equivalent_ttc = $pu_ttc; + $pu_equivalent_ttc = $pu_ttc; $currency_tx = $object->multicurrency_tx; // Check if we have a foreing currency @@ -1243,7 +1243,7 @@ if (empty($reshook)) { if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { $pu_equivalent = $pu_ht_devise * $currency_tx; } - if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { + if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; } @@ -1364,18 +1364,18 @@ if (empty($reshook)) { $remise_percent = price2num(GETPOST('remise_percent'), '', 2); // Prepare a price equivalent for minimum price check - $pu_equivalent = $pu_ht; - $pu_equivalent_ttc = $pu_ttc; - $currency_tx = $object->multicurrency_tx; + $pu_equivalent = $pu_ht; + $pu_equivalent_ttc = $pu_ttc; + $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency - // If so, we update the pu_equiv as the equivalent price in base currency - if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; - } - if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; - } + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } + if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { + $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + } // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f5b204c6889..135c6fc9ab9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -684,18 +684,18 @@ if (empty($reshook)) { // Prepare a price equivalent for minimum price check - $pu_equivalent = $pu_ht; - $pu_equivalent_ttc = $pu_ttc; - $currency_tx = $object->multicurrency_tx; + $pu_equivalent = $pu_ht; + $pu_equivalent_ttc = $pu_ttc; + $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency - // If so, we update the pu_equiv as the equivalent price in base currency - if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; - } - if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; - } + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } + if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { + $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); @@ -1013,7 +1013,6 @@ if (empty($reshook)) { } if (!$error) { - // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise); @@ -1093,18 +1092,18 @@ if (empty($reshook)) { $qty = price2num(GETPOST('qty', 'alpha'), 'MS'); // Prepare a price equivalent for minimum price check - $pu_equivalent = $pu_ht; - $pu_equivalent_ttc = $pu_ttc; - $currency_tx = $object->multicurrency_tx; + $pu_equivalent = $pu_ht; + $pu_equivalent_ttc = $pu_ttc; + $currency_tx = $object->multicurrency_tx; - // Check if we have a foreing currency - // If so, we update the pu_equiv as the equivalent price in base currency - if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; - } - if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; - } + // Check if we have a foreing currency + // If so, we update the pu_equiv as the equivalent price in base currency + if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { + $pu_equivalent = $pu_ht_devise * $currency_tx; + } + if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { + $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + } // Define info_bits $info_bits = 0; From 66ee541f771664fa3437d96748528ae914452809 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 15:18:25 +0100 Subject: [PATCH 200/370] Fix class name collision --- htdocs/includes/OAuth/Common/Storage/DoliStorage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index a769efdf8b9..0ca8dee700b 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -67,10 +67,10 @@ class DoliStorage implements TokenStorageInterface /** * @param DoliDB $db Database handler - * @param Conf $conf Conf object + * @param \Conf $conf Conf object * @param string $keyforprovider Key to manage several providers of the same type. For example 'abc' will be added to 'Google' to defined storage key. */ - public function __construct(DoliDB $db, Conf $conf, $keyforprovider = '') + public function __construct(DoliDB $db, \Conf $conf, $keyforprovider = '') { $this->db = $db; $this->conf = $conf; From 5dcee6b7d76548ae404be0861746e3226c0c460b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 15:24:20 +0100 Subject: [PATCH 201/370] Fix doxygen --- htdocs/core/boxes/box_dolibarr_state_board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 9a2e94b8a1d..6152b167863 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/boxes/box_dolibarr_state_board.php - * \ingroup + * \ingroup core * \brief Module Dolibarr state base */ From 1484237c1e7588ebe5ac9f0d5654c95b634a198c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 16:13:35 +0100 Subject: [PATCH 202/370] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3d9b0b04e5a..bbb01cfd3cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,7 +21,7 @@ For users: NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6 NEW: #21780 Add pid field to Cronjob class and store PID on job execution NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link -NEW: #20650 can move the checkbox column on left (experimental option) +NEW: #20650 can move the checkbox column on left (experimental option MAIN_CHECKBOX_LEFT_COLUMN) NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list NEW: #21395 Added option for dark theme mode in display - color and theme NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup From 3ed5edc0032ff0f1ace6958e11e628cf52eeecb0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 2 Jan 2023 16:21:14 +0100 Subject: [PATCH 203/370] NEW : search on time spent duration range --- htdocs/projet/tasks/time.php | 53 +++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 94ed0edaffd..8c98e6387b1 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -88,6 +88,10 @@ $search_company = GETPOST('$search_company', 'alpha'); $search_company_alias = GETPOST('$search_company_alias', 'alpha'); $search_project_ref = GETPOST('$search_project_ref', 'alpha'); $search_project_label = GETPOST('$search_project_label', 'alpha'); +$search_timespent_starthour = GETPOSTINT("search_timespent_duration_starthour"); +$search_timespent_startmin = GETPOSTINT("search_timespent_duration_startmin"); +$search_timespent_endhour = GETPOSTINT("search_timespent_duration_endhour"); +$search_timespent_endmin = GETPOSTINT("search_timespent_duration_endmin"); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -196,6 +200,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_product_ref = ''; $toselect = array(); $search_array_options = array(); + $search_timespent_starthour = ''; + $search_timespent_startmin = ''; + $search_timespent_endhour = ''; + $search_timespent_endmin = ''; $action = ''; } @@ -1337,6 +1345,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($search_date_endyear) { $param .= '&search_date_endyear='.urlencode($search_date_endyear); } + if ($search_timespent_starthour) { + $param .= '&search_timespent_duration_starthour='.urlencode($search_timespent_starthour); + } + if ($search_timespent_startmin) { + $param .= '&search_timespent_duration_startmin='.urlencode($search_timespent_startmin); + } + if ($search_timespent_endhour) { + $param .= '&search_timespent_duration_endhour='.urlencode($search_timespent_endhour); + } + if ($search_timespent_endmin) { + $param .= '&search_timespent_duration_endmin='.urlencode($search_timespent_endmin); + } /* // Add $param from extra fields @@ -1609,6 +1629,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " AND t.task_date <= '".$db->idate($search_date_end)."'"; } + if($search_timespent_starthour || $search_timespent_startmin) { + $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds + $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration >= ".$timespent_duration_start; + } + + if($search_timespent_endhour || $search_timespent_endmin) { + $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds + $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration <= ".$timespent_duration_end; + } + $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); // Add where from hooks @@ -1877,7 +1909,26 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Duration if (!empty($arrayfields['t.task_duration']['checked'])) { - print ''; + // Duration - Time spent + print ''; } // Product if (!empty($arrayfields['t.fk_product']['checked'])) { From 1bd0099d9f1e3c85ecdf3aefefe4830212a3bbcd Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 2 Jan 2023 16:29:16 +0100 Subject: [PATCH 204/370] Add column "Alias Name" in contact list --- htdocs/contact/list.php | 44 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index e8c4174af71..3e5103d319a 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -72,6 +72,7 @@ $search_firstlast_only = GETPOST("search_firstlast_only", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha'); $search_firstname = GETPOST("search_firstname", 'alpha'); $search_societe = GETPOST("search_societe", 'alpha'); +$search_societe_alias = GETPOST("search_societe_alias", 'alpha'); $search_poste = GETPOST("search_poste", 'alpha'); $search_phone_perso = GETPOST("search_phone_perso", 'alpha'); $search_phone_pro = GETPOST("search_phone_pro", 'alpha'); @@ -192,6 +193,7 @@ foreach ($object->fields as $key => $val) { // Add none object fields for "search in all" if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $fieldstosearchall['s.nom'] = "ThirdParty"; + $fieldstosearchall['s.name_alias'] = "AliasNames"; } // Definition of fields for list @@ -213,6 +215,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['country.code_iso'] = array('label'=>"Country", 'position'=>66, 'checked'=>0); if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>113, 'checked'=> 1); + $arrayfields['s.name_alias'] = array('label'=>"AliasNameShort", 'position'=>114, 'checked'=> 1); } $arrayfields['unsubscribed'] = array( @@ -277,6 +280,7 @@ if (empty($reshook)) { $search_lastname = ""; $search_firstname = ""; $search_societe = ""; + $search_societe_alias = ""; $search_town = ""; $search_address = ""; $search_zip = ""; @@ -372,7 +376,7 @@ if ($resql) { dol_print_error($db); } -$sql = "SELECT s.rowid as socid, s.nom as name,"; +$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,"; $sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email,"; $sql .= " p.socialnetworks, p.photo,"; $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; @@ -544,8 +548,15 @@ if ($search_lastname) { if ($search_firstname) { $sql .= natural_search('p.firstname', $search_firstname); } -if ($search_societe) { - $sql .= natural_search(empty($conf->global->SOCIETE_DISABLE_CONTACTS) ? 's.nom' : 'p.fk_soc', $search_societe); +if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) { + $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe); +} else { + if ($search_societe) { + $sql .= natural_search('s.nom', $search_societe); + } + if ($search_societe_alias) { + $sql .= natural_search('s.name_alias', $search_societe_alias); + } } if ($search_country) { $sql .= " AND p.fk_pays IN (".$db->sanitize($search_country).')'; @@ -676,6 +687,9 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ( exit; } +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'; llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); @@ -712,6 +726,9 @@ if ($search_firstname != '') { if ($search_societe != '') { $param .= '&search_societe='.urlencode($search_societe); } +if ($search_societe_alias != '') { + $param .= '&search_societe_alias='.urlencode($search_societe_alias); +} if ($search_address != '') { $param .= '&search_address='.urlencode($search_address); } @@ -984,6 +1001,12 @@ if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom'][ print ''; print ''; } +// Alias +if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; +} if (!empty($arrayfields['p.priv']['checked'])) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Private/Public if (!empty($arrayfields['p.priv']['checked'])) { print ''; From 07ba47dff8a89f9e37d2cbdda66ce67838f8ed82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 16:31:38 +0100 Subject: [PATCH 205/370] css --- htdocs/theme/eldy/global.inc.php | 5 +++++ htdocs/theme/md/style.css.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index daeb574a9dd..fe18193910d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -171,6 +171,11 @@ table.liste th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), table.liste max-width: 100px; text-overflow: ellipsis; } +th.wrapcolumntitle dl dt a span.fas.fa-list { + padding-bottom: 0; + vertical-align: bottom; +} + /*.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre select[name=year], diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index b4ff8bb18b6..b59eb7ebd10 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -485,6 +485,11 @@ th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), td.wrapcolumntitle.list max-width: 120px; text-overflow: ellipsis; } +th.wrapcolumntitle dl dt a span.fas.fa-list { + padding-bottom: 0; + vertical-align: bottom; +} + .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], From c84d17eced5d2a922b89b85a30ba61f6b680dbcf Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 2 Jan 2023 16:58:33 +0100 Subject: [PATCH 206/370] FIX : filter only if t.task_duration checked --- htdocs/projet/tasks/time.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8c98e6387b1..6652b57304a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1629,16 +1629,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " AND t.task_date <= '".$db->idate($search_date_end)."'"; } - if($search_timespent_starthour || $search_timespent_startmin) { - $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds - $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds - $sql .= " AND t.task_duration >= ".$timespent_duration_start; - } + if (!empty($arrayfields['t.task_duration']['checked'])) { - if($search_timespent_endhour || $search_timespent_endmin) { - $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds - $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds - $sql .= " AND t.task_duration <= ".$timespent_duration_end; + if ($search_timespent_starthour || $search_timespent_startmin) { + $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds + $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration >= " . $timespent_duration_start; + } + + if ($search_timespent_endhour || $search_timespent_endmin) { + $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds + $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration <= " . $timespent_duration_end; + } + } $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); From c3f44859ae61968e1db1d6846f53777201eed225 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 17:33:11 +0100 Subject: [PATCH 207/370] Debug v17 --- htdocs/admin/oauth.php | 7 ++++--- htdocs/admin/oauthlogintokens.php | 8 +++++++- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 64968b1a516..217dfd63cc9 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -285,7 +285,7 @@ if (count($listinsetup) > 0) { // Delete print ''; print ''; - print ''; print ''; print ''; @@ -306,7 +307,7 @@ if (count($listinsetup) > 0) { if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { print ''; print ''; - print ''; print ''; print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index f798995d525..9a0532880cd 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -213,7 +213,13 @@ if ($mode == 'setup' && $user->admin) { $urltocheckperms = ''; } - $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); + if ($urltorenew) { + $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); + } + if ($urltodelete) { + $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); + } + // Show value of token $tokenobj = null; diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index b993cbdd81e..80c39d85158 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -42,7 +42,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai $action = GETPOST('action', 'aZ09'); $backtourl = GETPOST('backtourl', 'alpha'); $keyforprovider = GETPOST('keyforprovider', 'aZ09'); -if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) { +if (!GETPOSTISSET('keyforprovider', 'aZ09') && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) { // If we are coming from the Oauth page $keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"]; } From 4ddf0b27dc10268344c35e5db9c998af794270d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Mon, 2 Jan 2023 18:15:33 +0100 Subject: [PATCH 208/370] NEW create email substitution variable for intervention signature URL --- htdocs/core/lib/functions.lib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 977342b1457..d5c3652ebdb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7659,6 +7659,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (isModEnabled("propal") && (!is_object($object) || $object->element == 'propal')) { $substitutionarray['__ONLINE_SIGN_URL__'] = 'ToOfferALinkForOnlineSignature'; } + if (isModEnabled("ficheinter") && (!is_object($object) || $object->element == 'fichinter')) { + $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = 'ToOfferALinkForOnlineSignature'; + } $substitutionarray['__ONLINE_PAYMENT_URL__'] = 'UrlToPayOnlineIfApplicable'; $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = 'TextAndUrlToPayOnlineIfApplicable'; $substitutionarray['__SECUREKEYPAYMENT__'] = 'Security key (if key is not unique per record)'; @@ -7929,6 +7932,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref); } + if (is_object($object) && $object->element == 'fichinter') { + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; + $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref); + } if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') { $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); } else { From 6a085ad60246dd4d73b8943959ef61d2bd2d3127 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 19:01:15 +0100 Subject: [PATCH 209/370] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b4ff1774054..46e34549731 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -172,7 +172,7 @@ table.liste th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), table.liste text-overflow: ellipsis; } th.wrapcolumntitle dl dt a span.fas.fa-list { - padding-bottom: 0; + padding-bottom: 1px; vertical-align: bottom; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 59cadcb3763..9a341e56b3b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -486,7 +486,7 @@ th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), td.wrapcolumntitle.list text-overflow: ellipsis; } th.wrapcolumntitle dl dt a span.fas.fa-list { - padding-bottom: 0; + padding-bottom: 1px; vertical-align: bottom; } From 9478cd6ad320a43c67006c9d354f84c2fbae1359 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 19:09:27 +0100 Subject: [PATCH 210/370] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bbb01cfd3cf..68b22cc4f8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -166,7 +166,7 @@ NEW: show product label on inventory NEW: show sell-by and eat-by dates only if not empty NEW: show SellBy/EatBy dates for each batch product in shipment card NEW: skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE) -NEW: SMTP using oauth2 authentication +NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP) NEW: can substitue project title in mail template NEW: Supplier order list - Add column private and public note NEW: Support IP type in extrafields From 3147c3a8d2548060db1fed4d4700b11ac0ecf845 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 19:01:15 +0100 Subject: [PATCH 211/370] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index fe18193910d..de4b84b5975 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -172,7 +172,7 @@ table.liste th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), table.liste text-overflow: ellipsis; } th.wrapcolumntitle dl dt a span.fas.fa-list { - padding-bottom: 0; + padding-bottom: 1px; vertical-align: bottom; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index b59eb7ebd10..78b962aa87d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -486,7 +486,7 @@ th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), td.wrapcolumntitle.list text-overflow: ellipsis; } th.wrapcolumntitle dl dt a span.fas.fa-list { - padding-bottom: 0; + padding-bottom: 1px; vertical-align: bottom; } From d62fb2af64eea3dab5bd1c20826f43f4f4f9edfe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 20:15:34 +0100 Subject: [PATCH 212/370] css --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/societe/list.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4724bf85d50..a600761d9b9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2198,7 +2198,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi // If the preview file is found if (file_exists($fileimage)) { $phototoshow = '
'; - $phototoshow .= ''; + $phototoshow .= ''; $phototoshow .= '
'; } } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 84a8d355c1a..f0ef18e4dfd 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -113,6 +113,7 @@ $place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is $diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user->id; +// Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -770,6 +771,7 @@ $num = $db->num_rows($resql); $arrayofselected = is_array($toselect) ? $toselect : array(); +// Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') { $obj = $db->fetch_object($resql); $id = $obj->rowid; @@ -1011,6 +1013,7 @@ foreach (array(1, 2, 3, 4, 5, 6) as $key) { } } +// Add code for pre mass action (confirmation or email presend form) $topicmail = "Information"; $modelmail = "thirdparty"; $objecttmp = new Societe($db); From 2dfb8c049683153e257610600d730801e053ef59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2023 20:26:46 +0100 Subject: [PATCH 213/370] Clean code --- htdocs/core/lib/files.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 82831424ccd..47b3955e617 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1991,7 +1991,6 @@ function deleteFilesIntoDatabaseIndex($dir, $file, $mode = 'uploaded') */ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = '') { - global $langs; if (class_exists('Imagick')) { $image = new Imagick(); try { From 94fb344bd67c5910b8e681d74e7677e864270ea7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 02:02:34 +0100 Subject: [PATCH 214/370] FIX #22271 --- htdocs/imports/import.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index dfe2d0b9d49..a6982bd0a4e 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -815,18 +815,22 @@ if ($step == 4 && $datatoimport) { $array_match_file_to_database = array(); } - // Load source fields in input file + // Load the source fields from input file into variable $arrayrecord $fieldssource = array(); $result = $obj->import_open_file($conf->import->dir_temp.'/'.$filetoimport, $langs); if ($result >= 0) { // Read first line $arrayrecord = $obj->import_read_record(); - // Put into array fieldssource starting with 1. + + // Create array $fieldssource starting with 1 with values found of first line. $i = 1; foreach ($arrayrecord as $key => $val) { if ($val["type"] != -1) { $fieldssource[$i]['example1'] = dol_trunc($val['val'], 128); $i++; + } else { + $fieldssource[$i]['example1'] = $langs->trans('Empty'); + $i++; } } $obj->import_close_file(); From 496cff016713848127b458ef027d9dc64ea05eb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 02:29:49 +0100 Subject: [PATCH 215/370] Debug v17 --- htdocs/accountancy/admin/account.php | 77 ++++++++++++++----- htdocs/accountancy/bookkeeping/list.php | 10 +++ .../accountancy/bookkeeping/listbyaccount.php | 10 +++ htdocs/langs/en_US/accountancy.lang | 2 + 4 files changed, 80 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 21d60103135..91b7673ab81 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -47,6 +47,7 @@ $search_label = GETPOST('search_label', 'alpha'); $search_labelshort = GETPOST('search_labelshort', 'alpha'); $search_accountparent = GETPOST('search_accountparent', 'alpha'); $search_pcgtype = GETPOST('search_pcgtype', 'alpha'); +$search_import_key = GETPOST('search_import_key', 'alpha'); $toselect = GETPOST('toselect', 'array'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $confirm = GETPOST('confirm', 'alpha'); @@ -83,16 +84,19 @@ if (!$sortorder) { } $arrayfields = array( - 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), - 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1), - 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), - 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), - 'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1), - 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) + 'aa.account_number'=>array('label'=>"AccountNumber", 'checked'=>1), + 'aa.label'=>array('label'=>"Label", 'checked'=>1), + 'aa.labelshort'=>array('label'=>"LabelToShow", 'checked'=>1), + 'aa.account_parent'=>array('label'=>"Accountparent", 'checked'=>1), + 'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'), + 'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'), + 'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1), + 'aa.active'=>array('label'=>"Activated", 'checked'=>1), + 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1) ); if ($conf->global->MAIN_FEATURES_LEVEL < 2) { + unset($arrayfields['categories']); unset($arrayfields['aa.reconcilable']); } @@ -226,15 +230,12 @@ if ($action == 'delete') { $pcgver = $conf->global->CHARTOFACCOUNTS; -$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconcilable, aa.active, "; +$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,"; +$sql .= " aa.reconcilable, aa.active, aa.import_key,"; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity; -if ($db->type == 'pgsql') { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity; -} else { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity; -} +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity); +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity); $sql .= " WHERE asy.rowid = ".((int) $pcgver); //print $sql; if (strlen(trim($search_account))) { @@ -337,6 +338,9 @@ if ($resql) { if ($search_pcgtype) { $param .= '&search_pcgtype='.urlencode($search_pcgtype); } + if ($optioncss != '') { + $param .= '&search_import_key='.urlencode($search_import_key); + } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } @@ -439,8 +443,17 @@ if ($resql) { print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2, array(), 0, 0, 'maxwidth150'); print ''; } + // Predefined group if (!empty($arrayfields['aa.pcg_type']['checked'])) { - print '
'; + print ''; + } + // Custom groups + if (!empty($arrayfields['categories']['checked'])) { + print ''; + } + // Import key + if (!empty($arrayfields['aa.import_key']['checked'])) { + print ''; } if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['aa.reconcilable']['checked'])) { @@ -471,6 +484,12 @@ if ($resql) { if (!empty($arrayfields['aa.pcg_type']['checked'])) { print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1); } + if (!empty($arrayfields['categories']['checked'])) { + print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'], 1); + } + if (!empty($arrayfields['aa.import_key']['checked'])) { + print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'], 1); + } if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['aa.reconcilable']['checked'])) { print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); @@ -505,7 +524,7 @@ if ($resql) { // Account label if (!empty($arrayfields['aa.label']['checked'])) { print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -515,7 +534,7 @@ if ($resql) { // Account label to show (label short) if (!empty($arrayfields['aa.labelshort']['checked'])) { print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -549,10 +568,30 @@ if ($resql) { } } - // Chart of accounts type + // Predefined group (deprecated) if (!empty($arrayfields['aa.pcg_type']['checked'])) { print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Custom accounts + if (!empty($arrayfields['categories']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Import id + if (!empty($arrayfields['aa.import_key']['checked'])) { + print "\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 2b2df70d647..fa42b5bd6fd 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1511,6 +1511,16 @@ while ($i < min($num, $limit)) { // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; +} $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 4a6e37ceb29..29596f0a124 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1232,6 +1232,16 @@ if ($num > 0 && $colspan > 0) { // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; +} $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b6bf1b90aef..9822a52e8f0 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -218,6 +218,7 @@ JournalLabel=Journal label NumPiece=Piece number TransactionNumShort=Num. transaction AccountingCategory=Custom group +AccountingCategories=Custom groups GroupByAccountAccounting=Group by general ledger account GroupBySubAccountAccounting=Group by subledger account AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports. @@ -265,6 +266,7 @@ ShowSubtotalByGroup=Show subtotal by level Pcgtype=Group of account PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report. +AccountingCategoriesDesc=Custom group of accounts can be used to group accounting accounts into one name to ease filter use or building of custom reports. Reconcilable=Reconcilable From 61ec6f5226f0d7d1d0c92e8e0cceb4452cd3a004 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 02:44:38 +0100 Subject: [PATCH 216/370] Doc --- htdocs/core/doxygen.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/doxygen.php b/htdocs/core/doxygen.php index ac66362a89f..06a2510dfef 100644 --- a/htdocs/core/doxygen.php +++ b/htdocs/core/doxygen.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2022 Laurent Destailleur * Copyright (C) 2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ * \mainpage Dolibarr project * * This is source documentation for Dolibarr ERP/CRM.
- * This documentation can be built or updated running the script dolibarr-doxygen-build.pl or from Eclipse with Doxygen plugin.
+ * This documentation can be built or updated running the script build/doxygen/dolibarr-doxygen-build.pl or from Eclipse with Doxygen plugin.
*
* Dolibarr official web site: www.dolibarr.org
*
From a0a6ab72415e85431b51d982e6f16b2afad84d2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 02:46:05 +0100 Subject: [PATCH 217/370] Doc --- htdocs/core/doxygen.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/doxygen.php b/htdocs/core/doxygen.php index 06a2510dfef..1e66b348ef8 100644 --- a/htdocs/core/doxygen.php +++ b/htdocs/core/doxygen.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/doxygen.php * \ingroup core - * \mainpage Dolibarr project + * \mainpage Dolibarr documentation of source code * * This is source documentation for Dolibarr ERP/CRM.
* This documentation can be built or updated running the script build/doxygen/dolibarr-doxygen-build.pl or from Eclipse with Doxygen plugin.
From 5978f404614fc31fe35f9d904152636fcd2d1fde Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 10:27:54 +0100 Subject: [PATCH 218/370] Fix user status --- htdocs/societe/list.php | 2 +- htdocs/user/class/user.class.php | 12 +++++++++--- htdocs/user/list.php | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 129e6ed63d4..3e69b1ff76e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1314,7 +1314,7 @@ if (!empty($arrayfields['s.tms']['checked'])) { // Status if (!empty($arrayfields['s.status']['checked'])) { print '
'; } if (!empty($arrayfields['s.import_key']['checked'])) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ebc49db57d3..a3445e3939f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -436,7 +436,7 @@ class User extends CommonObject $sql .= " u.admin, u.login, u.note_private, u.note_public,"; $sql .= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql .= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid, u.fk_user_expense_validator, u.fk_user_holiday_validator,"; - $sql .= " u.statut, u.lang, u.entity,"; + $sql .= " u.statut as status, u.lang, u.entity,"; $sql .= " u.datec as datec,"; $sql .= " u.tms as datem,"; $sql .= " u.datelastlogin as datel,"; @@ -553,7 +553,10 @@ class User extends CommonObject $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->note = $obj->note_private; // deprecated - $this->statut = $obj->statut; + + $this->statut = $obj->status; // deprecated + $this->status = $obj->status; + $this->photo = $obj->photo; $this->openid = $obj->openid; $this->lang = $obj->lang; @@ -1349,7 +1352,10 @@ class User extends CommonObject $error = 0; // Check parameters - if ($this->statut == $status) { + if (isset($this->statut) && $this->statut == $status) { + return 0; + } + if (isset($this->status) && $this->status == $status) { return 0; } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 8610113f0da..d3139b438e2 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -800,7 +800,7 @@ if (!empty($arrayfields['u.tms']['checked'])) { if (!empty($arrayfields['u.statut']['checked'])) { // Status print ''; } // Action column From 37ce175d538a2382334b914dbf071976a41a7896 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 10:27:54 +0100 Subject: [PATCH 219/370] Fix user status --- htdocs/societe/list.php | 2 +- htdocs/user/class/user.class.php | 12 +++++++++--- htdocs/user/list.php | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index f0ef18e4dfd..96666b28d8c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1311,7 +1311,7 @@ if (!empty($arrayfields['s.tms']['checked'])) { // Status if (!empty($arrayfields['s.status']['checked'])) { print ''; } if (!empty($arrayfields['s.import_key']['checked'])) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index dddcaa0ca6a..744e24fe15a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -436,7 +436,7 @@ class User extends CommonObject $sql .= " u.admin, u.login, u.note_private, u.note_public,"; $sql .= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql .= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid, u.fk_user_expense_validator, u.fk_user_holiday_validator,"; - $sql .= " u.statut, u.lang, u.entity,"; + $sql .= " u.statut as status, u.lang, u.entity,"; $sql .= " u.datec as datec,"; $sql .= " u.tms as datem,"; $sql .= " u.datelastlogin as datel,"; @@ -553,7 +553,10 @@ class User extends CommonObject $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->note = $obj->note_private; // deprecated - $this->statut = $obj->statut; + + $this->statut = $obj->status; // deprecated + $this->status = $obj->status; + $this->photo = $obj->photo; $this->openid = $obj->openid; $this->lang = $obj->lang; @@ -1350,7 +1353,10 @@ class User extends CommonObject $error = 0; // Check parameters - if ($this->statut == $status) { + if (isset($this->statut) && $this->statut == $status) { + return 0; + } + if (isset($this->status) && $this->status == $status) { return 0; } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 8610113f0da..d3139b438e2 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -800,7 +800,7 @@ if (!empty($arrayfields['u.tms']['checked'])) { if (!empty($arrayfields['u.statut']['checked'])) { // Status print ''; } // Action column From 9f02bd2350ed9b256c7f2d978cb9514e521df3e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 11:32:33 +0100 Subject: [PATCH 220/370] Debug v17 --- htdocs/user/class/user.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 744e24fe15a..e90252877d1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1353,10 +1353,11 @@ class User extends CommonObject $error = 0; // Check parameters - if (isset($this->statut) && $this->statut == $status) { - return 0; - } - if (isset($this->status) && $this->status == $status) { + if (isset($this->statut)) { + if ($this->statut == $status) { + return 0; + } + } elseif (isset($this->status) && $this->status == $status) { return 0; } @@ -3259,7 +3260,8 @@ class User extends CommonObject $this->iplastlogin = '127.0.0.1'; $this->datepreviouslogin = $now; $this->ippreviouslogin = '127.0.0.1'; - $this->statut = 1; + $this->statut = 1; // deprecated + $this->status = 1; $this->entity = 1; return 1; From 797b9c90548f27755cb5c68c9acb7cd9f780eeb8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 3 Jan 2023 11:42:39 +0100 Subject: [PATCH 221/370] dfelete cem data on product deletion --- htdocs/product/class/product.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0900f11ed29..e133e1a42f4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1408,6 +1408,14 @@ class Product extends CommonObject } } + // Delete record into ECM index and physically + if (!$error) { + $res = $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive + if (!$res) { + $error++; + } + } + if (!$error) { // We remove directory $ref = dol_sanitizeFileName($this->ref); From ea1ad5243f7b3e4f96b99c6a6edcc1c3072a04f7 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Thu, 22 Dec 2022 16:31:55 +0000 Subject: [PATCH 222/370] fix supplier invoice import --- htdocs/core/modules/modFournisseur.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 7bd10fcaf9b..b6286c35162 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -587,6 +587,9 @@ class modFournisseur extends DolibarrModules } // End add extra fields $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn'); + if (empty($conf->multicurrency->enabled)) { + $this->import_fieldshidden_array[$r]['f.multicurrency_code'] = 'const-'.$conf->currency; + } $this->import_regex_array[$r] = array('f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'); $import_sample = array( 'f.ref' => '(PROV001)', From 7fd82ccc45d59409c40bc3c29feb4b13b4553fd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 12:08:04 +0100 Subject: [PATCH 223/370] NEW formconfirm can support field with format datetime --- htdocs/core/class/html.form.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6655215a4f7..71df1296fc7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5010,7 +5010,7 @@ class Form * @param string $question Question * @param string $action Action * @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) - * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'select', 'multiselect', 'morecss', + * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', * 'other', 'onecolumn' or 'hidden'... * @param int|string $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx @@ -5141,11 +5141,11 @@ class Form $more .= ''."\n"; $i++; } - } elseif ($input['type'] == 'date') { + } elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { $more .= '
'.$input['label'].'
'; $more .= '
'; $addnowlink = (empty($input['datenow']) ? 0 : 1); - $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, $addnowlink); + $more .= $this->selectDate($input['value'], $input['name'], ($input['type'] == 'datetime' ? 1 : 0), ($input['type'] == 'datetime' ? 1 : 0), 0, '', 1, $addnowlink); $more .= '
'."\n"; $formquestion[] = array('name'=>$input['name'].'day'); $formquestion[] = array('name'=>$input['name'].'month'); From b8b1eb603559cb33e8df617e2b0dae9204c36a73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 12:08:04 +0100 Subject: [PATCH 224/370] NEW formconfirm can support field with format datetime --- htdocs/core/class/html.form.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c33ffe28551..5a2efa07f40 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5001,7 +5001,7 @@ class Form * @param string $question Question * @param string $action Action * @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) - * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'select', 'multiselect', 'morecss', + * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', * 'other', 'onecolumn' or 'hidden'... * @param int|string $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx @@ -5132,11 +5132,11 @@ class Form $more .= ''."\n"; $i++; } - } elseif ($input['type'] == 'date') { + } elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { $more .= '
'.$input['label'].'
'; $more .= '
'; $addnowlink = (empty($input['datenow']) ? 0 : 1); - $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, $addnowlink); + $more .= $this->selectDate($input['value'], $input['name'], ($input['type'] == 'datetime' ? 1 : 0), ($input['type'] == 'datetime' ? 1 : 0), 0, '', 1, $addnowlink); $more .= '
'."\n"; $formquestion[] = array('name'=>$input['name'].'day'); $formquestion[] = array('name'=>$input['name'].'month'); From 3e36e9831e137d427777055829f18e4ed1032ea9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 13:03:27 +0100 Subject: [PATCH 225/370] Fix warnings --- htdocs/admin/syslog.php | 3 -- htdocs/core/class/ctyperesource.class.php | 4 -- .../class/stocktransfer.class.php | 52 +++++-------------- .../class/stocktransferline.class.php | 36 ------------- .../class/companypaymentmode.class.php | 26 ---------- htdocs/website/class/websitepage.class.php | 39 ++++---------- .../workstation/class/workstation.class.php | 36 ------------- 7 files changed, 22 insertions(+), 174 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 71f7fd7f875..cf07dd49539 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -115,9 +115,6 @@ if ($action == 'set') { // Check configuration foreach ($activeModules as $modulename) { - /** - * @var LogHandler - */ $module = new $modulename; $error = $module->checkConfiguration(); } diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index be83877098c..88f6960a9f9 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -468,8 +468,4 @@ class CtyperesourceLine public $label; public $active; - - /** - * @var mixed Sample line property 2 - */ } diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index 60f13396b80..84182736a0a 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -57,11 +57,19 @@ class StockTransfer extends CommonObject */ public $isextrafieldmanaged = 1; + /** - * @var string Customer ref - * @deprecated - * @see $ref_customer - */ + * @var array List of child tables. To know object to delete on cascade. + * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object + */ + protected $childtablesoncascade = array('stocktransfer_stocktransferline'); + + /** + * @var string Customer ref + * @deprecated + * @see $ref_customer + */ public $ref_client; /** @@ -162,42 +170,6 @@ class StockTransfer extends CommonObject // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - public $table_element_line = 'stocktransfer_stocktransferline'; - - /** - * @var int Field with ID of parent key if this object has a parent - */ - public $fk_element = 'fk_stocktransfer'; - - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'StockTransferline'; - - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables = array(); - - /** - * @var array List of child tables. To know object to delete on cascade. - * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - */ - protected $childtablesoncascade = array('stocktransfer_stocktransferline'); - - /** - * @var StockTransferLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index 4ee2f1db631..65252efa106 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -117,42 +117,6 @@ class StockTransferLine extends CommonObjectLine // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - //public $table_element_line = 'stocktransfer_stocktransferlineline'; - - /** - * @var int Field with ID of parent key if this object has a parent - */ - //public $fk_element = 'fk_stocktransferline'; - - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'StockTransferLineline'; - - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables = array(); - - /** - * @var array List of child tables. To know object to delete on cascade. - * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - */ - //protected $childtablesoncascade = array('stocktransfer_stocktransferlinedet'); - - /** - * @var StockTransferLineLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 17889026e89..eb77a928f14 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -195,32 +195,6 @@ class CompanyPaymentMode extends CommonObject // END MODULEBUILDER PROPERTIES - - // If this object has a subtable with lines - - /** - * @var string Name of subtable line - */ - //public $table_element_line = 'companypaymentmodedet'; - /** - * @var string Field with ID of parent key if this field has a parent - */ - //public $fk_element = 'fk_companypaymentmode'; - /** - * @var string Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'CompanyPaymentModeline'; - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables=array(); - /** - * @var CompanyPaymentModeLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 55916fc4fe2..c4efd987d0b 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -50,6 +50,16 @@ class WebsitePage extends CommonObject */ public $picto = 'file-code'; + /** + * @var string Field with ID of parent key if this field has a parent or for child tables + */ + public $fk_element = 'fk_website_page'; + + /** + * @var array List of child tables. To know object to delete on cascade. + */ + protected $childtablesoncascade = array('categorie_website_page'); + /** * @var int ID @@ -181,35 +191,6 @@ class WebsitePage extends CommonObject // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - // /** - // * @var string Name of subtable line - // */ - //public $table_element_line = 'mymodule_myobjectline'; - - /** - * @var string Field with ID of parent key if this field has a parent or for child tables - */ - public $fk_element = 'fk_website_page'; - - // /** - // * @var string Name of subtable class that manage subtable lines - // */ - //public $class_element_line = 'MyObjectline'; - - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables=array(); - - /** - * @var array List of child tables. To know object to delete on cascade. - */ - protected $childtablesoncascade = array('categorie_website_page'); - - - /** * Constructor * diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index d3b098784da..6f81c4a28eb 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -132,42 +132,6 @@ class Workstation extends CommonObject // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - //public $table_element_line = 'workstation_workstationline'; - - /** - * @var int Field with ID of parent key if this object has a parent - */ - //public $fk_element = 'fk_workstation'; - - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'Workstationline'; - - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables = array(); - - /** - * @var array List of child tables. To know object to delete on cascade. - * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - */ - //protected $childtablesoncascade = array('workstation_workstationdet'); - - /** - * @var WorkstationLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * From f5792d692af4199d4d28fe637ad3d1a4013518dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 13:32:43 +0100 Subject: [PATCH 226/370] Fix migration --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 228fde598bb..31cbebab726 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -207,6 +207,8 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) N -- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer; -- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; +-- VMYSQL4.3 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN `rank` rankorder integer; +-- VPGSQL8.2 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN rank rankorder integer; -- Rename const to hide public and private notes (fix allow notes const was used to hide) @@ -388,4 +390,3 @@ ALTER TABLE llx_opensurvey_user_studs ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_opensurvey_comments ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0; - From ed11164b74e92fbd7214cbbbfbee3b71635902ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 13:33:04 +0100 Subject: [PATCH 227/370] Debug --- htdocs/hrm/compare.php | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index d1dde23a63c..6365dd51d25 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -28,9 +28,6 @@ * 2- the central part displays the skills. display of the maximum score for this group and the number of occurrences. * * 3- the right part displays the members of group 2 or the job to be compared - * - * - * */ @@ -48,6 +45,7 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm.lib.php'; // Load translation files required by the page $langs->load('hrm'); +$job = new Job($db); // Permissions $permissiontoread = $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read; @@ -61,8 +59,8 @@ if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessfor * View */ -$css = array(); -$css[] = '/hrm/css/style.css'; +$css = array('/hrm/css/style.css'); + llxHeader('', $langs->trans('SkillComparison'), '', '', 0, 0, '', $css); $head = array(); @@ -74,8 +72,6 @@ $head[$h][2] = 'compare'; print dol_get_fiche_head($head, 'compare', '', 1); -//$PDOdb = new TPDOdb; -$form = new Form($db); ?> '."\n"; llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0); -$head = ecm_prepare_dasboard_head(''); +$head = ecm_prepare_dasboard_head(null); print dol_get_fiche_head($head, 'index', '', -1, ''); diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 9d9d30e8188..3944e869da0 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -387,7 +387,7 @@ if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) { } } -$head = ecm_prepare_dasboard_head(''); +$head = ecm_prepare_dasboard_head(null); print dol_get_fiche_head($head, 'index_auto', '', -1, ''); diff --git a/htdocs/ecm/index_medias.php b/htdocs/ecm/index_medias.php index 2e1edcdc269..39118774430 100644 --- a/htdocs/ecm/index_medias.php +++ b/htdocs/ecm/index_medias.php @@ -295,7 +295,7 @@ $moreheadjs .= ''."\n"; llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0); -$head = ecm_prepare_dasboard_head(''); +$head = ecm_prepare_dasboard_head(null); print dol_get_fiche_head($head, 'index_medias', '', -1, ''); diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 633cb6fa5ce..e6c1aac1372 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -154,6 +154,7 @@ if ($action == 'addfolder') { // Action ajout d'un rep if ($action == 'add' && $user->rights->ftp->setup) { + $ecmdir = new EcmDirectory($db); $ecmdir->ref = GETPOST("ref"); $ecmdir->label = GETPOST("label"); $ecmdir->description = GETPOST("desc"); diff --git a/htdocs/index.php b/htdocs/index.php index 7cfd12d4bac..f1ce8248921 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -490,7 +490,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { foreach ($dashboardgroup as $groupKey => $groupElement) { $boards = array(); - // Scan $groupElement and save the one with 'stats' that lust be used for Open object dashboard + // Scan $groupElement and save the one with 'stats' that must be used for the open objects dashboard if (empty($conf->global->MAIN_DISABLE_NEW_OPENED_DASH_BOARD)) { foreach ($groupElement['stats'] as $infoKey) { if (!empty($valid_dashboardlines[$infoKey])) { @@ -519,10 +519,10 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { $openedDashBoard .= ' '."\n"; $openedDashBoard .= ' '."\n"; - // Show the span for the total of record + // Show the span for the total of record. TODO This seems not used. if (!empty($groupElement['globalStats'])) { $globalStatInTopOpenedDashBoard[] = $globalStatsKey; - $openedDashBoard .= ''.$nbTotal.''; + $openedDashBoard .= ''.$groupElement['globalStats']['nbTotal'].''; } $openedDashBoard .= ''."\n"; diff --git a/htdocs/install/index.php b/htdocs/install/index.php index a7ce50c819f..6810e3c509f 100644 --- a/htdocs/install/index.php +++ b/htdocs/install/index.php @@ -44,7 +44,7 @@ $langs->load("admin"); * View */ -$formadmin = new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''. +$formadmin = new FormAdmin(null); // Note: $db does not exist yet but we don't need it, so we put ''. pHeader("", "check"); // Next step = check diff --git a/htdocs/install/lib/repair.lib.php b/htdocs/install/lib/repair.lib.php index aea82107d29..c7c45dff053 100644 --- a/htdocs/install/lib/repair.lib.php +++ b/htdocs/install/lib/repair.lib.php @@ -125,7 +125,7 @@ function checkLinkedElements($sourcetype, $targettype) /** * Clean data into ecm_directories table * - * @return void + * @return int <0 if KO, >0 if OK */ function clean_data_ecm_directories() { @@ -145,12 +145,14 @@ function clean_data_ecm_directories() $resqlupdate = $db->query($sqlupdate); if (!$resqlupdate) { dol_print_error($db, 'Failed to update'); + return -1; } } } } else { dol_print_error($db, 'Failed to run request'); + return -1; } - return; + return 1; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d8eb602f624..17912f81101 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1413,7 +1413,7 @@ if (!function_exists("llxHeader")) { } if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) { - left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function + left_menu(array(), $help_url, '', '', 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function } // main area @@ -2885,7 +2885,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ $selected = -1; if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $usedbyinclude = 1; - $arrayresult = null; + $arrayresult = array(); include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 7f41d45d374..567a4b91669 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -225,5 +225,5 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) print ''."\n"; print "\n"; - return; + return 1; } diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 23a180b9a7b..8724e65ca4f 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -252,7 +252,7 @@ if (is_array($results)) { } } print ''; - print $tmpuser->getFullName(-1); + print $tmpuser->getFullName(); print '   '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope'); print ''; print '
'; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index db6b224466c..87357d10091 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -370,6 +370,9 @@ if ($action == 'getProducts') { $place = GETPOST('place', 'alpha'); require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; + + $object = new Facture($db); + $printer = new dolReceiptPrinter($db); $printer->sendToPrinter($object, getDolGlobalString('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term), getDolGlobalString('TAKEPOS_PRINTER_TO_USE'.$term)); } From d3c35651906ba23ca9eaf5563149cc8ec37cfcf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Jan 2023 20:53:09 +0100 Subject: [PATCH 306/370] css --- htdocs/compta/bank/bankentries_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index b0514c71ee6..6c961e85af9 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1134,8 +1134,8 @@ if ($resql) { } // Conciliated if (!empty($arrayfields['b.conciliated']['checked'])) { - print '
'; } // Bordereau From 44423bea30c4f1340a34fa6a82be8a666bb5cb39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Jan 2023 20:53:09 +0100 Subject: [PATCH 307/370] css --- htdocs/compta/bank/bankentries_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index b0514c71ee6..6c961e85af9 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1134,8 +1134,8 @@ if ($resql) { } // Conciliated if (!empty($arrayfields['b.conciliated']['checked'])) { - print ''; } // Bordereau From 8d922d89345c4f947e1b47e7d442ce07f8751c67 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 7 Jan 2023 00:24:57 +0100 Subject: [PATCH 308/370] New Accountancy - 2 line for 1 mvmt in create mode --- htdocs/accountancy/bookkeeping/card.php | 787 +++++++++++------------- 1 file changed, 367 insertions(+), 420 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 4620bf37e4e..e1916310b34 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2022 Waël Almoman * * 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 @@ -44,7 +45,7 @@ $cancel = GETPOST('cancel', 'aZ09'); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); // id of record -$mode = GETPOST('mode', 'aZ09'); // '' or '_tmp' +$mode = $mode = $action == 'create' ? "_tmp" : GETPOST('mode', 'aZ09'); // '' or '_tmp' $piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id) $accountingaccount = new AccountingAccount($db); @@ -54,10 +55,15 @@ $accountingaccount_number = GETPOST('accountingaccount_number', 'alphanohtml'); $accountingaccount->fetch(null, $accountingaccount_number, true); $accountingaccount_label = $accountingaccount->label; -$journal_code = GETPOST('code_journal', 'alpha'); +$journal_code = GETPOST('code_journal', 'alpha') ? GETPOST('code_journal', 'alpha') : "NULL"; $accountingjournal->fetch(null, $journal_code); $journal_label = $accountingjournal->label; +$next_num_mvt = (int) GETPOST('next_num_mvt', 'alpha'); +$doc_ref = (string) GETPOST('doc_ref', 'alpha'); +$doc_date = (string) GETPOST('doc_date', 'alpha'); +$doc_date = $doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); + $subledger_account = GETPOST('subledger_account', 'alphanohtml'); if ($subledger_account == -1) { $subledger_account = null; @@ -72,6 +78,10 @@ $save = GETPOST('save', 'alpha'); if (!empty($save)) { $action = 'add'; } +$valid = GETPOST('validate', 'alpha'); +if (!empty($valid)) { + $action = 'valid'; +} $update = GETPOST('update', 'alpha'); if (!empty($update)) { $action = 'confirm_update'; @@ -156,64 +166,79 @@ if ($action == "confirm_update") { } } } -} elseif ($action == "add") { +} elseif ($action == 'add' || $action == 'valid') { $error = 0; - if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { - $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action = ''; - } - if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); - $action = ''; + if (array_sum($debit) != array_sum($credit)) { + $action = 'add'; } - if (!$error) { - $object = new BookKeeping($db); + foreach ($accountingaccount_number as $key => $value) { + $accountingaccount->fetch(null, $accountingaccount_number[$key], true); + $accountingaccount_label[$key] = $accountingaccount->label[$key]; - $object->numero_compte = $accountingaccount_number; - $object->subledger_account = $subledger_account; - $object->subledger_label = $subledger_label; - $object->label_compte = $accountingaccount_label; - $object->label_operation = $label_operation; - $object->debit = $debit; - $object->credit = $credit; - $object->doc_date = (string) GETPOST('doc_date', 'alpha'); - $object->doc_type = (string) GETPOST('doc_type', 'alpha'); - $object->piece_num = $piece_num; - $object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); - $object->code_journal = $journal_code; - $object->journal_label = $journal_label; - $object->fk_doc = GETPOSTINT('fk_doc'); - $object->fk_docdet = GETPOSTINT('fk_docdet'); - - if (floatval($debit) != 0.0) { - $object->montant = $debit; // deprecated - $object->amount = $debit; - $object->sens = 'D'; + // if one added row is empty remove it before continue + if ($key < 1 && (empty($accountingaccount_number[$key]) || $accountingaccount_number[$key] == '-1') || (floatval($debit[$key]) == 0.0) && (floatval($credit[$key]) == 0.0)) { + continue; } - if (floatval($credit) != 0.0) { - $object->montant = $credit; // deprecated - $object->amount = $credit; - $object->sens = 'C'; - } - - $result = $object->createStd($user, false, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } - - $debit = 0; - $credit = 0; - + if ((floatval($debit[$key]) != 0.0) && (floatval($credit[$key]) != 0.0)) { + $error++; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $action = ''; } + + if (empty($accountingaccount_number[$key]) || $accountingaccount_number[$key] == '-1') { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action = ''; + } + + if (!$error) { + $object = new BookKeeping($db); + $object->numero_compte = $accountingaccount_number[$key]; + $object->subledger_account = $subledger_account[$key]; + $object->subledger_label = $subledger_label[$key]; + $object->label_compte = $accountingaccount_label[$key]; + $object->label_operation = $label_operation[$key]; + $object->debit = price2num($debit[$key]); + $object->credit = price2num($credit[$key]); + $object->doc_date = $doc_date; + $object->doc_type = (string) GETPOST('doc_type', 'alpha'); + $object->piece_num = $piece_num; + $object->doc_ref = $doc_ref; + $object->code_journal = $journal_code; + $object->journal_label = $journal_label; + $object->fk_doc = GETPOSTINT('fk_doc'); + $object->fk_docdet = GETPOSTINT('fk_docdet'); + + if (floatval($debit[$key]) != 0.0) { + $object->montant = $object->debit; // deprecated + $object->amount = $object->debit; + $object->sens = 'D'; + } + + if (floatval($credit[$key]) != 0.0) { + $object->montant = $object->credit; // deprecated + $object->amount = $object->credit; + $object->sens = 'C'; + } + + $result = $object->createStd($user, false, $mode); + if ($result < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + if (empty($error)) { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + $debit = 0; + $credit = 0; + + $action = $action == 'add' ? '' : $action ; // stay in valid mode when not adding line } } elseif ($action == "confirm_delete") { $object = new BookKeeping($db); @@ -230,17 +255,28 @@ if ($action == "confirm_update") { } } $action = ''; -} elseif ($action == "confirm_create") { +} elseif ($action == 'create') { $error = 0; $object = new BookKeeping($db); + $next_num_mvt = !empty($next_num_mvt) ? $next_num_mvt : $object->getNextNumMvt('_tmp'); + $doc_ref = !empty($doc_ref) ? $doc_ref : $next_num_mvt; + + if (empty($doc_date)) { + $tmp_date = dol_getdate(dol_now()); + $_POST['doc_dateday'] = $tmp_date['mday']; + $_POST['doc_datemonth'] = $tmp_date['mon']; + $_POST['doc_dateyear'] = $tmp_date['year']; + unset($tmp_date); + } + if (!$journal_code || $journal_code == '-1') { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); $action = 'create'; $error++; } - if (!GETPOST('doc_ref', 'alpha')) { + if (empty($doc_ref)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); $action = 'create'; $error++; @@ -252,8 +288,8 @@ if ($action == "confirm_update") { $object->credit = 0; $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $object->doc_type = GETPOST('doc_type', 'alpha'); - $object->piece_num = GETPOST('next_num_mvt', 'alpha'); - $object->doc_ref = GETPOST('doc_ref', 'alpha'); + $object->piece_num = $next_num_mvt; + $object->doc_ref = $doc_ref; $object->code_journal = $journal_code; $object->journal_label = $journal_label; $object->fk_doc = 0; @@ -302,7 +338,7 @@ if ($action == 'setjournal') { } if ($action == 'setdocref') { - $refdoc = GETPOST('doc_ref', 'alpha'); + $refdoc = $doc_ref; $result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -333,7 +369,7 @@ if ($action == 'valid') { $html = new Form($db); $formaccounting = new FormAccounting($db); -$title = $langs->trans("CreateMvts"); +$title = $langs->trans($mode =="_tmp" ? "CreateMvts": "UpdateMvts"); llxHeader('', $title); @@ -343,28 +379,37 @@ if ($action == 'delete') { print $formconfirm; } -if ($action == 'create') { - print load_fiche_titre($title); - $object = new BookKeeping($db); - $next_num_mvt = $object->getNextNumMvt('_tmp'); +$object = new BookKeeping($db); +$result = $object->fetchPerMvt($piece_num, $mode); +if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); +} - if (empty($next_num_mvt)) { - dol_print_error('', 'Failed to get next piece number'); +if (!empty($object->piece_num)) { + $backlink = ''.$langs->trans('BackToList').''; + + print load_fiche_titre($langs->trans($mode =="_tmp" ? "CreateMvts": "UpdateMvts"), $backlink); + + print ''; if ($optioncss != '') { + print ''; } + $head = array(); + $h = 0; + $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); + $head[$h][1] = $langs->trans("Transaction"); + $head[$h][2] = 'transaction'; + $h++; - print ''; - if ($optioncss != '') { - print ''; - } - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; + print dol_get_fiche_head($head, 'transaction', '', -1); - print dol_get_fiche_head(); + //dol_banner_tab($object, '', $backlink); - print '
'.$langs->trans("Description").' '.$langs->trans("Value").''.$langs->trans("Value").'
'.$langs->trans("ECMAutoTree").' '; +print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); + print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', null, null, 1); } else { - if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; - } elseif (!empty($conf->global->USER_MAIL_REQUIRED)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print '
'; + + $durationtouse_start = 0; + if ($search_timespent_starthour || $search_timespent_startmin) { + $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); + } + print '
'.$langs->trans('from').' '; + $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text'); + print '
'; + + $durationtouse_end = 0; + if ($search_timespent_endhour || $search_timespent_endmin) { + $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); + } + print '
'.$langs->trans('at').' '; + $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text'); + print '
'; + + print '
'; + print ''; + print ''; $selectarray = array('0'=>$langs->trans("ContactPublic"), '1'=>$langs->trans("ContactPrivate")); @@ -1105,6 +1128,9 @@ if (!empty($arrayfields['p.fk_soc']['checked'])) { if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); } +if (!empty($arrayfields['s.name_alias']['checked'])) { + print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", $begin, $param, '', $sortfield, $sortorder); +} if (!empty($arrayfields['p.priv']['checked'])) { print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); } @@ -1323,7 +1349,7 @@ while ($i < min($num, $limit)) { if ($obj->socid) { $objsoc = new Societe($db); $objsoc->fetch($obj->socid); - print $objsoc->getNomUrl(1); + print $objsoc->getNomUrl(1, 'customer', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); } else { print ' '; } @@ -1333,6 +1359,16 @@ while ($i < min($num, $limit)) { } } + // Alias name + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $obj->alias; + print ''.$contactstatic->LibPubPriv($obj->priv).''; $label = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); - print ''; + print ''; print img_picto('', 'delete'); print ''; @@ -298,7 +298,8 @@ if (count($listinsetup) > 0) { $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php'; print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''; + print ''; + print ajax_autoselect('uri'.$keyforsupportedoauth2array.$keyforprovider); print '
'.$langs->trans("URLOfServiceForAuthorization").''; + print ''; print '
"; - print $obj->label; + print dol_escape_htmltag($obj->label); print ""; - print $obj->labelshort; + print dol_escape_htmltag($obj->labelshort); print ""; - print $obj->pcg_type; + print dol_escape_htmltag($obj->pcg_type); + print ""; + // TODO Get all custom groups labels the account is in + print dol_escape_htmltag($obj->fk_accounting_category); + print ""; + print dol_escape_htmltag($obj->import_key); print "
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'
'; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage', 1); print ''; - print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); + print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage'); print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage', 1); print ''; - print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); + print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage'); print ''; - print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1); + print ''; + print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1, 'search_status onrightofpage maxwidth75'); print ''; - print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1); + print ''; + print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1, 'search_status onrightofpage maxwidth75'); print '
'; + print '
'; + print '
'; + + print '
'; + print '
'; /*print ''; print ''; @@ -374,7 +419,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; @@ -385,262 +430,151 @@ if ($action == 'create') { print ''; print ''; - print ''; + print ''; print ''; /* print ''; print ''; - print ''; + print ''; print ''; */ print '
' . $langs->trans("NumPiece") . '
'.$langs->trans("Docdate").''; - print $html->selectDate('', 'doc_date', '', '', '', "create_mvt", 1, 1); + print $html->selectDate($doc_date, 'doc_date', '', '', '', "create_mvt", 1, 1); print '
'.$langs->trans("Piece").'
' . $langs->trans("Doctype") . '
'; - print dol_get_fiche_end(); + print ''; - print $form->buttonsSaveCancel("Create"); + print '
'; - print ''; -} else { - $object = new BookKeeping($db); - $result = $object->fetchPerMvt($piece_num, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + print '
'; + print ''; + + // Doc type + if (!empty($object->doc_type)) { + print ''; + print ''; + print ''; + print ''; } - if (!empty($object->piece_num)) { - $backlink = ''.$langs->trans('BackToList').''; + // Date document creation + print ''; + print ''; + print ''; + print ''; - print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); - - $head = array(); - $h = 0; - $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); - $head[$h][1] = $langs->trans("Transaction"); - $head[$h][2] = 'transaction'; - $h++; - - print dol_get_fiche_head($head, 'transaction', '', -1); - - //dol_banner_tab($object, '', $backlink); - - print '
'; - print '
'; - - print '
'; - print '
'.$langs->trans("Doctype").''.$object->doc_type.'
'.$langs->trans("DateCreation").''; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print '
'; - - // Account movement + // Don't show in tmp mode, inevitably empty + if ($mode != "_tmp") { + // Date document export print ''; - print ''; - print ''; - print ''; - - // Date - print ''; - print ''; - - // Journal - print ''; - print ''; - - // Ref document - print ''; - print ''; - - print '
'.$langs->trans("NumMvts").''.($mode == '_tmp' ? ''.$langs->trans("Draft").'' : $object->piece_num).'
'; - print ''; - if ($action != 'editdate') { - print ''; - } - print '
'; - print $langs->trans('Docdate'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'
'; - print '
'; - if ($action == 'editdate') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); - print ''; - print '
'; - } else { - print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' '; - } - print '
'; - print ''; - if ($action != 'editjournal') { - print ''; - } - print '
'; - print $langs->trans('Codejournal'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - if ($action == 'editjournal') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); - print ''; - print '
'; - } else { - print $object->code_journal; - } - print '
'; - print ''; - if ($action != 'editdocref') { - print ''; - } - print '
'; - print $langs->trans('Piece'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - if ($action == 'editdocref') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - } else { - print $object->doc_ref; - } - print '
'; - - print '
'; - - print '
'; - - print '
'; - print ''; - - // Doc type - if (!empty($object->doc_type)) { - print ''; - print ''; - print ''; - print ''; - } - - // Date document creation - print ''; - print ''; + print ''; print ''; print ''; - // Don't show in tmp mode, inevitably empty - if ($mode != "_tmp") { - // Date document export - print ''; - print ''; - print ''; - print ''; - - // Date document validation - print ''; - print ''; - print ''; - print ''; - } - - // Validate - /* + // Date document validation print ''; - print ''; + print ''; print ''; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print ''; print ''; - */ + } + // Validate + /* + print ''; + print ''; + print ''; + print ''; + */ // check data - /* - print ''; - print ''; - if ($object->doc_type == 'customer_invoice') - { - $sqlmid = 'SELECT rowid as ref'; - $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; - $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); - dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $invoicestatic = new Facture($db); - $invoicestatic->fetch($objmid->ref); - $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); - } - else dol_print_error($db); - } - print ''; - print ''; - */ - print "
'.$langs->trans("Doctype").''.$object->doc_type.'
'.$langs->trans("DateCreation").''.$langs->trans("DateExport").''; - print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; print '
' . $langs->trans("DateExport") . ''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; - print '
' . $langs->trans("DateValidation") . ''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; - print '
' . $langs->trans("Status") . ''.$langs->trans("DateValidation").''; - if (empty($object->validated)) { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } - print '
' . $langs->trans("Status") . ''; + if (empty($object->validated)) { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } + print '
' . $langs->trans("Control") . '' . $ref .'
\n"; - - print '
'; - - print dol_get_fiche_end(); - - print '
'; - - print '
'; - - $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt - - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + /* + print ''; + print '' . $langs->trans("Control") . ''; + if ($object->doc_type == 'customer_invoice') { + $sqlmid = 'SELECT rowid as ref'; + $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; + $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); + dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $invoicestatic = new Facture($db); + $invoicestatic->fetch($objmid->ref); + $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); } else { - // List of movements - print load_fiche_titre($langs->trans("ListeMvts"), '', ''); + dol_print_error($db); + } + } + print '' . $ref .''; + print ''; + */ + print "\n"; - print '
'; - if ($optioncss != '') { - print ''; + print dol_get_fiche_end(); + + print '
'; + + print '
'; + + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + // List of movements + print load_fiche_titre($langs->trans("ListeMvts"), '', ''); + + if ($optioncss != '') { + print ''; + } + + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + + if (count($object->linesmvt) > 0) { + print '
'; + print ''; + + $total_debit = 0; + $total_credit = 0; + + // Don't show in tmp mode, inevitably empty + if ($mode != "_tmp") { + // Date document export + print ''; + print ''; + print ''; + print ''; + + // Date document validation + print ''; + print ''; + print ''; + print ''; } - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - if (count($object->linesmvt) > 0) { - print '
'; - print '
' . $langs->trans("DateExport") . ''; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print '
' . $langs->trans("DateValidation") . ''; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print '
'; - - $total_debit = 0; - $total_credit = 0; - - print ''; + print ''; print_liste_field_titre("AccountAccountingShort"); print_liste_field_titre("SubledgerAccount"); @@ -655,24 +589,59 @@ if ($action == 'create') { print "\n"; - // Add an empty line if there is not yet - if (!empty($object->linesmvt[0])) { - $tmpline = $object->linesmvt[0]; - if (!empty($tmpline->numero_compte)) { - $line = new BookKeepingLine(); - $object->linesmvt[] = $line; + // In _tmp mode the first line is empty so we remove it + if ($mode == "_tmp") { + array_shift($object->linesmvt); + } + + // Add an empty line at the end to be able to add transaction + $line = new BookKeepingLine(); + $object->linesmvt[] = $line; + + // Add a second line empty line if there is not yet + if (empty($object->linesmvt[1])) { + $line = new BookKeepingLine(); + $object->linesmvt[] = $line; + } + + $count_line = count($object->linesmvt); + $num_line = 0; + foreach ($object->linesmvt as $key => $line) { + $num_line++; + print ''; + $total_debit += $line->debit; + $total_credit += $line->credit; + + if ($action == 'update' && $line->id == $id) { + print ''; + print ''; + print ''; - $total_debit += $line->debit; - $total_credit += $line->credit; - - if ($action == 'update' && $line->id == $id) { - print ''; + // Add also input for subledger label + print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'" />'; + print ''; + print ''; + print ''; + print ''; + print ''; + } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { + if ($action == "" || $action == 'add') { + print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { - if ($action == "" || $action == 'add') { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - } else { - print ''; - $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true); - print ''; + print ''; + print ''; + // Add button should not appear twice + if ($num_line === $count_line) { + print ''; } else { - print $line->numero_compte.' ('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')'; + print ''; } - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; } - print "\n"; - } - - $total_debit = price2num($total_debit, 'MT'); - $total_credit = price2num($total_credit, 'MT'); - - if ($total_debit != $total_credit) { - setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); - } - - print '
'; + print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, ''); + print ''; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + } else { + print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'" />'; } - } - - foreach ($object->linesmvt as $line) { - print '
label_operation).'" />debit)).'" />credit)).'" />'; + print ''."\n"; + print ''; + print ''; - print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); + print $formaccounting->select_account((is_array($accountingaccount_number) ? $accountingaccount_number[$key] : $accountingaccount_number ), 'accountingaccount_number['.$key.']', 1, array(), 1, 1, ''); print ''; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: @@ -680,124 +649,102 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + print $formaccounting->select_auxaccount((is_array($subledger_account) ? $subledger_account[$key] : $subledger_account ), 'subledger_account['.$key.']', 1, 'maxwidth250', '', 'subledger_label'); } else { - print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; + print ''; } - // Add also input for subledger label - print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; + print '
'; print '
label_operation).'">debit)).'">credit)).'">'; - print ''."\n"; - print ''; - print ''; - print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); - print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: - // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. - // Also, it is not possible to use a value that is not in the list. - // Also, the label is not automatically filled when a value is selected. - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); - } else { - print ''; - } - print '
'; - print '
'; - if ($resultfetch > 0) { - print $accountingaccount->getNomUrl(0, 1, 1, '', 0); + print ''.length_accounta($line->subledger_account); - if ($line->subledger_label) { - print ' - '.$line->subledger_label.''; - } - print ''.$line->label_operation.''.($line->debit != 0 ? price($line->debit) : '').''.($line->credit != 0 ? price($line->credit) : '').''; - if (empty($line->date_export) && empty($line->date_validation)) { - print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; - print img_edit('', 0, 'class="marginrightonly"'); - print '  '; - } else { - print ''; - print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"'); - print '  '; - } - - if (empty($line->date_validation)) { - $actiontodelete = 'delete'; - if ($mode == '_tmp' || $action != 'delmouv') { - $actiontodelete = 'confirm_delete'; - } - - print ''; - print img_delete(); - print ''; - } else { - print ''; - print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated")); - print ''; - } - - print '
'; - print '
'; - - if ($mode == '_tmp' && $action == '') { - print '
'; - print '
'; - if ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; + } else { + print ''; + $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true); + print ''; + if ($resultfetch > 0) { + print $accountingaccount->getNomUrl(0, 1, 1, '', 0); } else { - print ''; + print $line->numero_compte.' ('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')'; + } + print ''; + print ''.length_accounta($line->subledger_account); + if ($line->subledger_label) { + print ' - '.$line->subledger_label.''; + } + print ''; + print ''.$line->label_operation.''; + print ''.($line->debit != 0 ? price($line->debit) : '').''; + print ''.($line->credit != 0 ? price($line->credit) : '').''; + + print ''; + if (empty($line->date_export) && empty($line->date_validation)) { + print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; + print img_edit('', 0, 'class="marginrightonly"'); + print '  '; + } else { + print ''; + print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"'); + print '  '; } - print '   '; - print ''.$langs->trans("Cancel").''; + if (empty($line->date_validation)) { + $actiontodelete = 'delete'; + if ($mode == '_tmp' || $action != 'delmouv') { + $actiontodelete = 'confirm_delete'; + } - print "
"; + print ''; + print img_delete(); + print ''; + } else { + print ''; + print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated")); + print ''; + } + + print ''; } + print "\n"; } - print '
'; + $total_debit = price2num($total_debit, 'MT'); + $total_credit = price2num($total_credit, 'MT'); + + if ($total_debit != $total_credit) { + setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); + } + + print ''; + print ''; + + if ($mode == '_tmp' && $action == '') { + print '
'; + print '
'; + if ($total_debit == $total_credit) { + print ''; + } else { + print ''; + } + + print '   '; + print ''.$langs->trans("Cancel").''; + + print "
"; + } } - } else { - print load_fiche_titre($langs->trans("NoRecords")); + + print ''; } +} else { + print load_fiche_titre($langs->trans("NoRecords")); } print dol_get_fiche_end(); From 35256d4ecb7213f09ec41ce5ab82fc0f1da652cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 02:36:05 +0100 Subject: [PATCH 309/370] Fix css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4a148611a76..4f44ab20bad 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -634,7 +634,7 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { -webkit-box-shadow: 0px 0px 5px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 5px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } -.button:hover, .buttonDelete:hover { +.button:hover:not(.nohover), .buttonDelete:hover:not(.nohover) { /* warning: having a larger shadow has side effect when button is completely on left of a table */ -webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6fd33800eb0..41c20074d6a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -879,7 +879,7 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } -.button:hover, .buttonDelete:hover { +.button:hover:not(.nohover), .buttonDelete:hover:not(.nohover) { -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } From e228536329e7dcfaa7d19aee48d3b744d8c24220 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 03:11:33 +0100 Subject: [PATCH 310/370] Fix date now --- htdocs/public/recruitment/view.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 57cb82d9b08..0d856539902 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -159,6 +159,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; * View */ +$now = dol_now(); + $head = ''; if (!empty($conf->global->MAIN_RECRUITMENT_CSS_URL)) { $head = ''."\n"; From 880be173fa4289cf479fcce1caceb26898b33118 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 03:28:21 +0100 Subject: [PATCH 311/370] Fix typo --- htdocs/public/recruitment/view.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 0d856539902..de8297d3ef0 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -203,7 +203,7 @@ $paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix; if (!empty($conf->global->$paramlogo)) { $logosmall = $conf->global->$paramlogo; } elseif (!empty($conf->global->ONLINE_RECRUITMENT_LOGO)) { - $logosmall = $conf->global->ONLINE_RECRUITMENT_LOGO_; + $logosmall = $conf->global->ONLINE_RECRUITMENT_LOGO; } //print ''."\n"; // Define urllogo @@ -236,7 +236,7 @@ if ($urllogo) { if (!empty($conf->global->RECRUITMENT_IMAGE_PUBLIC_INTERFACE)) { print '
'; - print ''; + print ''; print '
'; } From 00740ca267563eee40691aa8ab94294b2f363ad6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 04:05:59 +0100 Subject: [PATCH 312/370] WIP Work on public virtual card --- htdocs/adherents/admin/website.php | 2 +- htdocs/core/class/vcard.class.php | 87 +++++++ htdocs/core/lib/functions.lib.php | 47 ++-- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/langs/en_US/users.lang | 3 + htdocs/public/users/view.php | 381 +++++++++++++++++++++++++++++ htdocs/theme/eldy/global.inc.php | 4 +- htdocs/theme/md/style.css.php | 3 + htdocs/user/card.php | 10 +- htdocs/user/class/user.class.php | 24 ++ htdocs/user/info.php | 2 +- htdocs/user/vcard.php | 105 ++------ htdocs/user/virtualcard.php | 248 +++++++++++++++++++ 13 files changed, 810 insertions(+), 108 deletions(-) create mode 100644 htdocs/public/users/view.php create mode 100644 htdocs/user/virtualcard.php diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 08e9f617750..14379166247 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -178,7 +178,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { //print $langs->trans('FollowingLinksArePublic').'
'; print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
'; if (isModEnabled('multicompany')) { - $entity_qr = '?entity='.$conf->entity; + $entity_qr = '?entity='.((int) $conf->entity); } else { $entity_qr = ''; } diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index dbe505a894b..91e3a5565e1 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -1,4 +1,7 @@ * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2020 Tobias Sekan @@ -367,6 +370,90 @@ class vCard return $this->filename; } + /** + * Return a VCARD string + * + * @param Object $object Object + * @param Societe $company Company + * @param Translate $langs Lang object + * @return string String + */ + public function buildVCardString($object, $company, $langs) + { + $this->setProdId('Dolibarr '.DOL_VERSION); + + $this->setUid('DOLIBARR-USERID-'.$object->id); + $this->setName($object->lastname, $object->firstname, "", $object->civility_code, ""); + $this->setFormattedName($object->getFullName($langs, 1)); + + $this->setPhoneNumber($object->office_phone, "TYPE=WORK;VOICE"); + $this->setPhoneNumber($object->personal_mobile, "TYPE=HOME;VOICE"); + $this->setPhoneNumber($object->user_mobile, "TYPE=CELL;VOICE"); + $this->setPhoneNumber($object->office_fax, "TYPE=WORK;FAX"); + + $country = $object->country_code ? $object->country : ''; + + $this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL"); + $this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); + + $this->setEmail($object->email, "TYPE=WORK"); + $this->setNote($object->note_public); + $this->setTitle($object->job); + + if ($company->id > 0) { + $this->setURL($company->url, "TYPE=WORK"); + if (!$object->office_phone) { + $this->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); + } + if (!$object->office_fax) { + $this->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); + } + if (!$object->zip) { + $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL"); + } + + // when company e-mail is empty, use only user e-mail + if (empty(trim($company->email))) { + // was set before, don't set twice + } elseif (empty(trim($object->email))) { + // when user e-mail is empty, use only company e-mail + $this->setEmail($company->email, "TYPE=WORK"); + } else { + $tmpuser2 = explode("@", trim($object->email)); + $tmpcompany = explode("@", trim($company->email)); + + if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) { + // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) + $this->setEmail($object->email, "TYPE=WORK"); + + // support by Microsoft Outlook (2019 and possible earlier) + $this->setEmail($company->email, 'INTERNET'); + } else { + // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) + $this->setEmail($company->email, "TYPE=WORK"); + + // support by Microsoft Outlook (2019 and possible earlier) + $this->setEmail($object->email, 'INTERNET'); + } + } + + // Si user lie a un tiers non de type "particulier" + if ($company->typent_code != 'TE_PRIVATE') { + $this->setOrg($company->name); + } + } + + // Personal informations + $this->setPhoneNumber($object->personal_mobile, "TYPE=HOME;VOICE"); + if ($object->birth) { + $this->setBirthday($object->birth); + } + + // Return VCard string + return $this->getVCard(); + } + + /* Example from Microsoft Outlook 2019 BEGIN:VCARD diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7ac6150c5ac..ac774209d30 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -101,31 +101,41 @@ function getDolGlobalInt($key, $default = 0) } /** - * Return dolibarr user constant string value + * Return Dolibarr user constant string value * * @param string $key key to return value, return '' if not set * @param string $default value to return + * @param User $tmpuser To get another user than current user * @return string */ -function getDolUserString($key, $default = '') +function getDolUserString($key, $default = '', $tmpuser = null) { - global $user; + if (empty($tmpuser)) { + global $user; + $tmpuser = $user; + } + // return $conf->global->$key ?? $default; - return (string) (empty($user->conf->$key) ? $default : $user->conf->$key); + return (string) (empty($tmpuser->conf->$key) ? $default : $$tmpuser->conf->$key); } /** - * Return dolibarr user constant int value + * Return Dolibarr user constant int value * * @param string $key key to return value, return 0 if not set * @param int $default value to return + * @param User $tmpuser To get another user than current user * @return int */ -function getDolUserInt($key, $default = 0) +function getDolUserInt($key, $default = 0, $tmpuser = null) { - global $user; + if (empty($tmpuser)) { + global $user; + $tmpuser = $user; + } + // return $conf->global->$key ?? $default; - return (int) (empty($user->conf->$key) ? $default : $user->conf->$key); + return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); } /** @@ -1717,7 +1727,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = * * @param string $name A name for the html component * @param string $label Label shown in Popup title top bar - * @param string $buttonstring button string + * @param string $buttonstring button string (HTML text we can click on) * @param string $url Relative Url to open. For example '/project/card.php' * @param string $disabled Disabled text * @param string $morecss More CSS @@ -1725,7 +1735,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = * Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label' * @return string HTML component with button */ -function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'button bordertransp', $backtopagejsfields = '') +function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $backtopagejsfields = '') { global $conf; @@ -1753,7 +1763,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di //print ''; $out .= ''; - $out .= 'use_javascript_ajax)) { $out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"'; } @@ -2239,6 +2249,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } } + // Show barcode if ($showbarcode) { $morehtmlleft .= '
'.$form->showbarcode($object, 100, 'photoref valignmiddle').'
'; } @@ -2988,9 +2999,10 @@ function dol_print_size($size, $shortvalue = 0, $shortunit = 0) * @param string $target Target for link * @param int $max Max number of characters to show * @param int $withpicto With picto + * @param string $morecss More CSS * @return string HTML Link */ -function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0) +function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $morecss = 'float') { global $langs; @@ -3013,7 +3025,12 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0) } $link .= dol_trunc($url, $max); $link .= '
'; - return '
'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'
'; + + if ($morecss == 'float') { + return '
'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'
'; + } else { + return ''.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.''; + } } /** @@ -4067,7 +4084,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', - 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', + 'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', @@ -4134,7 +4151,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'supplier'=>'building', 'technic'=>'cogs', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', - 'uncheck'=>'times', 'uparrow'=>'share', 'url'=>'external-link-alt', 'vat'=>'money-check-alt', 'vcard'=>'address-card', + 'uncheck'=>'times', 'uparrow'=>'share', 'url'=>'external-link-alt', 'vat'=>'money-check-alt', 'vcard'=>'arrow-alt-circle-down', 'jabber'=>'comment-o', 'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye', 'world'=>'globe', 'private'=>'user-lock', 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 692d01f9ef0..6b51cf76150 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1784,7 +1784,7 @@ function weight_convert($weight, &$from_unit, $to_unit) * @param DoliDB $db Handler database * @param Conf $conf Object conf * @param User $user Object user - * @param array $tab Array (key=>value) with all parameters to save + * @param array $tab Array (key=>value) with all parameters to save/update * @return int <0 if KO, >0 if OK * * @see dolibarr_get_const(), dolibarr_set_const(), dolibarr_del_const() diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 757e9f1dedf..2f691153292 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -129,3 +129,6 @@ IPLastLogin=IP last login IPPreviousLogin=IP previous login ShowAllPerms=Show all permission rows HideAllPerms=Hide all permission rows +UserPublicPageDesc=You can enable a virtual card for this user. An url with the user profile and a barcode will be available to allow anybody with a smartphone to scan it and add your contact to its address book. +EnablePublicVirtualCard=Enable the public virtual user card +PublicVirtualCardUrl=Public virtual user card \ No newline at end of file diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php new file mode 100644 index 00000000000..2bc5e8e9245 --- /dev/null +++ b/htdocs/public/users/view.php @@ -0,0 +1,381 @@ + + * + * 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 . + */ + +/** + * \file htdocs/public/users/view.php + * \ingroup user + * \brief Public file to user profile + */ + +if (!defined('NOLOGIN')) { + define("NOLOGIN", 1); // This means this output page does not require to be logged. +} +if (!defined('NOCSRFCHECK')) { + define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("companies", "other", "recruitment")); + +// Get parameters +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = ''; + +$id = GETPOST('id', 'int'); +$securekey = GETPOST('securekey', 'alpha'); +$suffix = GETPOST('suffix'); + +$object = new User($db); +$object->fetch($id, '', '', 1); + +// Define $urlwithroot +//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. + +// Security check +global $dolibarr_main_instance_unique_id; +$encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5'); +if ($encodedsecurekey != $securekey) { + httponly_accessforbidden('User profile page not found or not allowed'); +} + + +/* + * Actions + */ + +if ($cancel) { + if (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = 'view'; +} + +/* +if ($action == "view" || $action == "presend" || $action == "dosubmit") { + $error = 0; + $display_ticket = false; + if (!strlen($ref)) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref"))); + $action = ''; + } + if (!strlen($email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); + $action = ''; + } else { + if (!isValidEmail($email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorEmailInvalid")); + $action = ''; + } + } + + if (!$error) { + $ret = $object->fetch('', $ref); + } + + if ($error || $errors) { + setEventMessages($object->error, $object->errors, 'errors'); + if ($action == "dosubmit") { + $action = 'presend'; + } else { + $action = ''; + } + } +} +*/ +//var_dump($action); +//$object->doActions($action); + +// Actions to send emails (for ticket, we need to manage the addfile and removefile only) +/*$triggersendname = 'USER_SENTBYMAIL'; +$paramname = 'id'; +$autocopy = 'MAIN_MAIL_AUTOCOPY_USER_TO'; // used to know the automatic BCC to add +$trackid = 'use'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; +*/ + + +/* + * View + */ + +$form = new Form($db); +$company = $mysoc; + +if ($action == 'vcard') { + // We create VCard + $v = new vCard(); + $output = $v->buildVCardString($object, $company, $langs); + + $filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" + $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); + //$filename = dol_sanitizeFileName($filename); + + top_httphead('text/x-vcard; name="'.$filename.'"'); + + header("Content-Disposition: attachment; filename=\"".$filename."\""); + header("Content-Length: ".dol_strlen($output)); + header("Connection: close"); + + print $output; + + $db->close(); + + exit; +} + +$head = ''; +if (!empty($conf->global->MAIN_USER_PROFILE_CSS_URL)) { + $head = ''."\n"; +} + +$conf->dol_hide_topmenu = 1; +$conf->dol_hide_leftmenu = 1; + +if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + $langs->load("errors"); + print '
'.$langs->trans('ErrorPublicInterfaceNotEnabled').'
'; + $db->close(); + exit(); +} + +$arrayofjs = array(); +$arrayofcss = array(); + +$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; +llxHeader($head, $langs->trans("UserProfile").' '.$object->getFullName($langs), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1); + +print ''."\n"; +print '
'."\n"; +print '
'."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''; +print "\n"; +print ''."\n"; + +$modulepart = 'user'; +$imagesize = 'small'; +$dir = $conf->user->dir_output; +$email = $object->email; + +// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logo = ''; +$logosmall = ''; +if (!empty($object->photo)) { + if (dolIsAllowedForPreview($object->photo)) { + $logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); + $logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; + //$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; + } +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($conf->user->dir_output.'/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logosmall); +} elseif (!empty($logo) && is_readable($conf->user->dir_output.'/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logo); +} + +// Output html code for logo +print '
'; +print '
'; + +// Show photo +if ($urllogo) { + /*if (!empty($mysoc->url)) { + print ''; + }*/ + print ''; + /*if (!empty($mysoc->url)) { + print ''; + }*/ +} +print '
'; +/*if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; +}*/ +print '
'; + + +if (!empty($conf->global->USER_IMAGE_PUBLIC_INTERFACE)) { + print '
'; + print ''; + print '
'; +} + +$urlforqrcode = $_SERVER["PHP_SELF"].'?action=vcard&id='.((int) $object->id).'&securekey='.urlencode($securekey); + +// Show barcode +$showbarcode = GETPOST('nobarcode') ? 0 : 1; +if ($showbarcode) { + print '
'; + print '
'; + print 'QRCODE...
'; + print $urlforqrcode; + print '
'; + print '
'; + print '
'; +} + + +print '
'.$langs->trans("Me").'
'."\n"; +print ''."\n"; + +// Output payment summary form +print ''."\n"; + +print '
'; + +print '
'; + +print '
'; + +// Add contact info +print '...'; + +print '
'; + + +print '
'."\n"; +print "\n"; + +print '
'."\n"; + + + + +print '
'.$langs->trans("MyCompany").'
'."\n"; +print ''."\n"; + +// Output payment summary form +print ''."\n"; + +print '
'; + +print '
'; + +// Add company info + + +// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logosmall = $mysoc->logo_small; +$logo = $mysoc->logo; +$paramlogo = 'ONLINE_USER_LOGO_'.$suffix; +if (!empty($conf->global->$paramlogo)) { + $logosmall = $conf->global->$paramlogo; +} elseif (!empty($conf->global->ONLINE_USER_LOGO)) { + $logosmall = $conf->global->ONLINE_USER_LOGO; +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); +} +// Output html code for logo +if ($urllogo) { + print '
'; + if (!empty($mysoc->url)) { + print ''; + } + print ''; + if (!empty($mysoc->url)) { + print ''; + } + print '
'; +} + + +if ($mysoc->email) { + print '
'; + print img_picto('', 'email', 'class="pictofixedwidth"').dol_print_email($mysoc->email, 0, 0, 1); + print '
'; +} + +if ($mysoc->url) { + print '
'; + print img_picto('', 'globe', 'class="pictofixedwidth"'); + //print 'rr'; + print dol_print_url($mysoc->url, '_blank', 0, 0, ''); + print '
'; +} + + +print '
'."\n"; +print "\n"; + +print '
'."\n"; + + + +// Description +$text = getDolUserString('USER_PUBLIC_MORE', '', $object); +print $text; + + +print '
'."\n"; +print '
'."\n"; +print '
'; + + +//htmlPrintOnlinePaymentFooter($mysoc, $langs); + +print ''; + +llxFooter('', 'public'); + +$db->close(); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4f44ab20bad..983e571e399 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -910,7 +910,9 @@ textarea.centpercent { .nomarginright { margin-: unset; } - +.nowidthimp { + width: unset !important; +} .cursordefault { cursor: default; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 41c20074d6a..89358053ef3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1147,6 +1147,9 @@ textarea.centpercent { .nomarginright { margin-: unset; } +.nowidthimp { + width: unset !important; +} .cursordefault { cursor: default; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f26d61da521..8fceddf313b 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1432,10 +1432,18 @@ if ($action == 'create' || $action == 'adduserldap') { if ($action != 'edit') { print dol_get_fiche_head($head, 'user', $title, -1, 'user'); - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + //$urltovirtualcard = $object->getOnlineVirtualCardUrl(); + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + /*$morehtmlref .= ''; + $morehtmlref .= img_picto($langs->trans("PublicVirtualCardUrl"), 'id-card', 'class="valignmiddle marginleftonly paddingrightonly"'); + $morehtmlref .= '';*/ + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a4d4c7acfe6..9104dd5cfd4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3786,6 +3786,30 @@ class User extends CommonObject } } + /** + * Return string with full Url to virtual card + * + * @return string Url string + */ + public function getOnlineVirtualCardUrl() + { + global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; + global $conf; + + $encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$this->id.'-'.$this->login, 'md5'); + if (isModEnabled('multicompany')) { + $entity_qr = '&entity='.((int) $conf->entity); + } else { + $entity_qr = ''; + } + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr; + } + /** * Load all objects into $this->users * diff --git a/htdocs/user/info.php b/htdocs/user/info.php index dfb1fe23d0b..3f5d1aea604 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -51,7 +51,7 @@ $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // If user is not user that read and no permission to read other users, we stop -if (($object->id != $user->id) && (!$user->rights->user->user->lire)) { +if (($object->id != $user->id) && empty($user->rights->user->user->lire)) { accessforbidden(); } diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index 6e7035d99ec..576d2b90a5b 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -21,8 +21,8 @@ /** * \file htdocs/user/vcard.php - * \ingroup societe - * \brief Onglet vcard d'un user + * \ingroup user + * \brief Page to return a user vcard */ // Load Dolibarr environment @@ -31,9 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php'; -$user2 = new User($db); - - $id = GETPOST('id', 'int'); // Security check @@ -44,106 +41,38 @@ if ($user->socid > 0) { $feature2 = 'user'; $result = restrictedArea($user, 'user', $id, 'user', $feature2); - -$result = $user2->fetch($id); +$object = new User($db); +$result = $object->fetch($id); if ($result <= 0) { - dol_print_error($user2->error); + dol_print_error($object->error); exit; } -$physicalperson = 1; - +// Data from linked company $company = new Societe($db); -if ($user2->socid) { - $result = $company->fetch($user2->socid); +if ($object->socid > 0) { + $result = $company->fetch($object->socid); } + +/* + * View + */ + // We create VCard $v = new vCard(); -$v->setProdId('Dolibarr '.DOL_VERSION); - -$v->setUid('DOLIBARR-USERID-'.$user2->id); -$v->setName($user2->lastname, $user2->firstname, "", $user2->civility_code, ""); -$v->setFormattedName($user2->getFullName($langs, 1)); - -$v->setPhoneNumber($user2->office_phone, "TYPE=WORK;VOICE"); -$v->setPhoneNumber($user2->personal_mobile, "TYPE=HOME;VOICE"); -$v->setPhoneNumber($user2->user_mobile, "TYPE=CELL;VOICE"); -$v->setPhoneNumber($user2->office_fax, "TYPE=WORK;FAX"); - -$country = $user2->country_code ? $user2->country : ''; - -$v->setAddress("", "", $user2->address, $user2->town, $user2->state, $user2->zip, $country, "TYPE=WORK;POSTAL"); -$v->setLabel("", "", $user2->address, $user2->town, $user2->state, $user2->zip, $country, "TYPE=WORK"); - -$v->setEmail($user2->email, "TYPE=WORK"); -$v->setNote($user2->note_public); -$v->setTitle($user2->job); - -// Data from linked company -if ($company->id) { - $v->setURL($company->url, "TYPE=WORK"); - if (!$user2->office_phone) { - $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); - } - if (!$user2->office_fax) { - $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); - } - if (!$user2->zip) { - $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL"); - } - - // when company e-mail is empty, use only user e-mail - if (empty(trim($company->email))) { - // was set before, don't set twice - } elseif (empty(trim($user2->email))) { - // when user e-mail is empty, use only company e-mail - $v->setEmail($company->email, "TYPE=WORK"); - } else { - $tmpuser2 = explode("@", trim($user2->email)); - $tmpcompany = explode("@", trim($company->email)); - - if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) { - // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) - $v->setEmail($user2->email, "TYPE=WORK"); - - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($company->email, 'INTERNET'); - } else { - // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) - $v->setEmail($company->email, "TYPE=WORK"); - - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($user2->email, 'INTERNET'); - } - } - - // Si user lie a un tiers non de type "particulier" - if ($company->typent_code != 'TE_PRIVATE') { - $v->setOrg($company->name); - } -} - -// Personal informations -$v->setPhoneNumber($user2->personal_mobile, "TYPE=HOME;VOICE"); -if ($user2->birth) { - $v->setBirthday($user2->birth); -} - -$db->close(); - -// Renvoi la VCard au navigateur - -$output = $v->getVCard(); +$output = $v->buildVCardString($object, $company, $langs); $filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); //$filename = dol_sanitizeFileName($filename); +top_httphead('text/x-vcard; name="'.$filename.'"'); header("Content-Disposition: attachment; filename=\"".$filename."\""); header("Content-Length: ".dol_strlen($output)); header("Connection: close"); -header("Content-Type: text/x-vcard; name=\"".$filename."\""); print $output; + +$db->close(); diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php new file mode 100644 index 00000000000..30dc32ad01c --- /dev/null +++ b/htdocs/user/virtualcard.php @@ -0,0 +1,248 @@ + + * Copyright (C) 2005-2015 Regis Houssin + * + * 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 . + */ + +/** + * \file htdocs/user/virtualcard.php + * \ingroup core + * \brief Page to setup a virtual card + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + +// Load translation files required by page +$langs->load("users"); + +// Security check +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); + +$object = new User($db); +if ($id > 0 || !empty($ref)) { + $result = $object->fetch($id, $ref, '', 1); + $object->getrights(); +} + +// Security check +$socid = 0; +if ($user->socid > 0) { + $socid = $user->socid; +} +$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); + +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); + +// If user is not the user that read and has no permission to read other users, we stop +if (($object->id != $user->id) && empty($user->rights->user->user->lire)) { + accessforbidden(); +} + +/* + * Actions + */ + +if ($action == 'update') { + $tmparray = array(); + $tmparray['USER_PUBLIC_COMPANY_NAME'] = (GETPOST('USER_PUBLIC_COMPANY_NAME') ? 1 : 0); + $tmparray['USER_PUBLIC_JOBPOSITION'] = (GETPOST('USER_PUBLIC_JOBPOSITION') ? 1 : 0); + $tmparray['USER_PUBLIC_EMAIL'] = (GETPOST('USER_PUBLIC_EMAIL') ? 1 : 0); + $tmparray['USER_PUBLIC_PHONE'] = (GETPOST('USER_PUBLIC_PHONE') ? 1 : 0); + $tmparray['USER_PUBLIC_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_SOCIALNETWORKS') ? 1 : 0); + $tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : ''); + + dol_set_user_param($db, $conf, $object, $tmparray); +} + +if ($action == 'setUSER_ENABLE_PUBLIC') { + if (GETPOST('value')) { + $tmparray = array('USER_ENABLE_PUBLIC' => 1); + } else { + $tmparray = array('USER_ENABLE_PUBLIC' => 0); + } + dol_set_user_param($db, $conf, $object, $tmparray); +} + + +/* + * View + */ + +$form = new Form($db); + +$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; +$title = $person_name." - ".$langs->trans('Info'); +$help_url = ''; +llxHeader('', $title, $help_url); + +$head = user_prepare_head($object); + +$title = $langs->trans("User"); +//print dol_get_fiche_head($head, 'info', $title, -1, 'user'); + + +$linkback = ''; + +if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; +} + +$morehtmlref = ''; +$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); +$morehtmlref .= ''; + +//dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); + + +print '
'; + +print '
'; + +/* + print ''.$langs->trans("VCard").'
'; + +print ''; +print img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); +print ''; + + +print '
'; +//print '
'; + +print '
'; +*/ + +print ''.$langs->trans("UserPublicPageDesc").'

'; + +$param = '&id='.((int) $object->id); + +$enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' '; +if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + // Button off, click to enable + $enabledisablehtml .= ''; + $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); + $enabledisablehtml .= ''; +} else { + // Button on, click to disable + $enabledisablehtml .= ''; + $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); + $enabledisablehtml .= ''; +} +print $enabledisablehtml; +print ''; + +print '

'; + +print '
'; +print ''; +print ''; +print ''; + +if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + print '
'; + //print $langs->trans('FollowingLinksArePublic').'
'; + print img_picto('', 'globe').' '.$langs->trans('PublicVirtualCardUrl').'
'; + + $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl(); + + print ''; + print ajax_autoselect('publicurluser'); + + print '
'; + + print '
'; + print ''; + + print ''; + print ''; + print ''; + print "\n"; + + // Company name + print '\n"; + + // Job position + print '\n"; + + // Email + print '\n"; + + // Phone + print '\n"; + + // Social networks + print '\n"; + + // More + print '\n"; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $langs->trans("Company"); + print ''; + //print ''; + print $form->selectyesno("USER_PUBLIC_COMPANY_NAME", (getDolUserInt('USER_PUBLIC_COMPANY_NAME', 0, $object) ? getDolUserInt('USER_PUBLIC_COMPANY_NAME', 0, $object) : 0), 1); + print "
'; + print $langs->trans("PostOrFunction"); + print ''; + print $form->selectyesno("USER_PUBLIC_JOBPOSITION", (getDolUserInt('USER_PUBLIC_JOBPOSITION', 0, $object) ? getDolUserInt('USER_PUBLIC_JOBPOSITION', 0, $object) : 0), 1); + print "
'; + print $langs->trans("Email"); + print ''; + print $form->selectyesno("USER_PUBLIC_EMAIL", (getDolUserInt('USER_PUBLIC_EMAIL', 0, $object) ? getDolUserInt('USER_PUBLIC_EMAIL', 0, $object) : 0), 1); + print "
'; + print $langs->trans("Phone"); + print ''; + print $form->selectyesno("USER_PUBLIC_PHONE", (getDolUserInt('USER_PUBLIC_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_PHONE', 0, $object) : 0), 1); + print "
'; + print $langs->trans("SocialNetworks"); + print ''; + print $form->selectyesno("USER_PUBLIC_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_SOCIALNETWORKS', 0, $object) : 0), 1); + print "
'; + print $langs->trans("More"); + print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); + $doleditor->Create(); + print "
'; + print '
'; + + print '
'; + print ''; + print '
'; +} + + +print dol_get_fiche_end(); + +print '
'; + + +print '
'; + + +print dol_get_fiche_end(); + +// End of page +llxFooter(); +$db->close(); From 2c9e4495dbd4afca5765e08d36a61fcbb8072ca7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 04:43:09 +0100 Subject: [PATCH 313/370] Fix url --- htdocs/public/recruitment/view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index de8297d3ef0..3626693ce89 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -223,7 +223,7 @@ if ($urllogo) { if (!empty($mysoc->url)) { print ''; } - print ''; + print ''; if (!empty($mysoc->url)) { print ''; } From 183552461c796b326264820aebc21ee6b3ced1e2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 7 Jan 2023 08:20:48 +0100 Subject: [PATCH 314/370] NEW Accountancy - Add an option to disable autolettering when transferring to accounting --- htdocs/accountancy/admin/index.php | 28 +++++++++++++++++++ htdocs/accountancy/journal/bankjournal.php | 2 +- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/langs/en_US/accountancy.lang | 1 + 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 244b6f72330..5caa92ec9ee 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -261,6 +261,20 @@ if ($action == 'setenablelettering') { } } +if ($action == 'setenableautolettering') { + $setenableautolettering = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View @@ -479,6 +493,7 @@ if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { print ''; print ''; +print '
'; // Lettering params print ''; @@ -499,6 +514,19 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { } print ''; +print ''; +print ''; +if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) { + print ''; +} else { + print ''; +} +print ''; + print '
'.$langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING").''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; print '
'; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 4aba6bfeda4..699002395ab 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -793,7 +793,7 @@ if (!$error && $action == 'writebookkeeping') { setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); } } else { - if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { + if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index a5b82e7b2d0..746383fef0b 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -376,7 +376,7 @@ if ($action == 'writebookkeeping') { setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); } } else { - if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { + if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 0519762baef..f67fd76b3f1 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -390,7 +390,7 @@ if ($action == 'writebookkeeping') { setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); } } else { - if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { + if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9822a52e8f0..5a1e51a2269 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -339,6 +339,7 @@ ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding & transfer in accountancy on ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountancy on purchases (vendor invoices will not be taken into account in accounting) ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ACCOUNTING_ENABLE_LETTERING=Enable the lettering function in the accounting +ACCOUNTING_ENABLE_AUTOLETTERING=Enable the automatic lettering when transferring to accounting ## Export NotExportLettering=Do not export the lettering when generating the file From 192d641b26e997b8a540eb3cd455b5704186cb7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 11:29:43 +0100 Subject: [PATCH 315/370] Update for doxygen generation from command line --- build/doxygen/dolibarr-doxygen-build.pl | 10 +- build/doxygen/dolibarr-doxygen.doxyfile | 98 +- build/doxygen/doxygen-awesome.css | 2413 +++++++++++++++++++++++ 3 files changed, 2477 insertions(+), 44 deletions(-) create mode 100644 build/doxygen/doxygen-awesome.css diff --git a/build/doxygen/dolibarr-doxygen-build.pl b/build/doxygen/dolibarr-doxygen-build.pl index 75a5cceddbe..5a4849a3a5b 100755 --- a/build/doxygen/dolibarr-doxygen-build.pl +++ b/build/doxygen/dolibarr-doxygen-build.pl @@ -17,9 +17,9 @@ use Cwd; my $dir = getcwd; print "Current dir is: $dir\n"; -print "Running dir for doxygen must be: $DIR\n"; +#print "Running dir for doxygen must be: $DIR\n"; -if (! -s $CONFFILE) +if (! -s "build/doxygen/$CONFFILE") { print "Error: current directory for building Dolibarr doxygen documentation is not correct.\n"; print "\n"; @@ -30,7 +30,7 @@ if (! -s $CONFFILE) exit 1; } -$SOURCE="../.."; +$SOURCE="."; # Get version $MAJOR, $MINOR and $BUILD $result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" ); @@ -47,8 +47,8 @@ $version=$MAJOR.".".$MINOR.".".$BUILD; print "Running doxygen for version ".$version.", please wait...\n"; -print "cat $CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n"; -$result=`cat $CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`; +print "cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n"; +$result=`cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`; print $result; diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 31400661ecc..6f668ebad7e 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -1,14 +1,17 @@ -# Doxyfile 1.7.3 +# Doxyfile 1.8.16 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project +# doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. # The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options @@ -38,7 +41,7 @@ PROJECT_NUMBER = x.y.z # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = ../../build +OUTPUT_DIRECTORY = build # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -114,7 +117,7 @@ FULL_PATH_NAMES = YES # If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = "../.." +STRIP_FROM_PATH = "/home/dolibarr/doxygen.dolibarr.org/" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells @@ -287,7 +290,7 @@ TYPEDEF_HIDES_STRUCT = NO # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols -SYMBOL_CACHE_SIZE = 0 +#SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options @@ -448,7 +451,7 @@ GENERATE_TODOLIST = NO # disable (NO) the test list. This list is created by putting \test # commands in the documentation. -GENERATE_TESTLIST = YES +GENERATE_TESTLIST = NO # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug @@ -487,7 +490,7 @@ SHOW_USED_FILES = YES # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. -SHOW_DIRECTORIES = YES +#SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the @@ -571,7 +574,7 @@ WARN_FORMAT = "$file:$line: $text" # and error messages should be written. If left blank the output is written # to stderr. -WARN_LOGFILE = doxygen_warnings.log +WARN_LOGFILE = build/html/doxygen_warnings.log #--------------------------------------------------------------------------- # configuration options related to the input files @@ -582,7 +585,7 @@ WARN_LOGFILE = doxygen_warnings.log # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ../../htdocs ../../scripts +INPUT = htdocs scripts # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -611,7 +614,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = ../../build ../../dev ../../doc ../../document ../../documents ../../htdocs/conf/conf.php ../../htdocs/custom ../../htdocs/document ../../htdocs/documents ../../htdocs/includes +EXCLUDE = build dev doc document documents htdocs/conf/conf.php htdocs/custom htdocs/document htdocs/documents htdocs/includes htdocs/install/doctemplates # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded @@ -625,7 +628,7 @@ EXCLUDE_SYMLINKS = YES # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = */CVS/* *google* *pibarcode* +EXCLUDE_PATTERNS = */CVS/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -639,27 +642,27 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = ../../htdocs/modulebuilder/template +#EXAMPLE_PATH = htdocs/modulebuilder/template # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = *.php +#EXAMPLE_PATTERNS = *.php # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. -EXAMPLE_RECURSIVE = NO +#EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = ../../doc/images +IMAGE_PATH = doc/images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -762,7 +765,7 @@ ALPHABETICAL_INDEX = YES # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) -COLS_IN_ALPHA_INDEX = 5 +#COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. @@ -775,14 +778,16 @@ IGNORE_PREFIX = # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html @@ -797,14 +802,14 @@ HTML_FILE_EXTENSION = .html # standard header. # Does not work with 1.7.3 -#HTML_HEADER = doxygen_header.html +#HTML_HEADER = build/doxygen/doxygen_header.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. # Does not work with 1.7.3 -HTML_FOOTER = doxygen_footer.html +HTML_FOOTER = build/doxygen/doxygen_footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to @@ -850,7 +855,18 @@ HTML_TIMESTAMP = YES # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. -HTML_ALIGN_MEMBERS = YES +#HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the @@ -858,7 +874,7 @@ HTML_ALIGN_MEMBERS = YES # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). -HTML_DYNAMIC_SECTIONS = YES +HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 @@ -1003,7 +1019,7 @@ QHG_LOCATION = # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. -GENERATE_ECLIPSEHELP = YES +GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have @@ -1035,7 +1051,7 @@ GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. -USE_INLINE_TREES = NO +#USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree @@ -1072,7 +1088,7 @@ FORMULA_TRANSPARENT = YES # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. -SEARCHENGINE = NO +SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client @@ -1082,7 +1098,7 @@ SEARCHENGINE = NO # full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. -SERVER_BASED_SEARCH = NO +SERVER_BASED_SEARCH = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output @@ -1260,13 +1276,13 @@ XML_OUTPUT = xml # which can be used by a validating XML parser to check the # syntax of the XML files. -XML_SCHEMA = +#XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. -XML_DTD = +#XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting @@ -1431,7 +1447,7 @@ EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). -PERL_PATH = /usr/bin/perl +#PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool @@ -1453,7 +1469,7 @@ CLASS_DIAGRAMS = NO # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. -MSCGEN_PATH = +#MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented @@ -1485,7 +1501,7 @@ DOT_NUM_THREADS = 0 # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. -DOT_FONTNAME = FreeSans.ttf +#DOT_FONTNAME = FreeSans.ttf # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. @@ -1634,3 +1650,7 @@ GENERATE_LEGEND = YES # the various graphs. DOT_CLEANUP = YES + + +FULL_SIDEBAR = NO +HTML_EXTRA_STYLESHEET = build/doxygen/doxygen-awesome.css diff --git a/build/doxygen/doxygen-awesome.css b/build/doxygen/doxygen-awesome.css new file mode 100644 index 00000000000..0b1c8c20892 --- /dev/null +++ b/build/doxygen/doxygen-awesome.css @@ -0,0 +1,2413 @@ +/** + +Doxygen Awesome +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 - 2022 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +html { + /* primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ... */ + --primary-color: #1779c4; + --primary-dark-color: #335c80; + --primary-light-color: #70b1e9; + + /* page base colors */ + --page-background-color: #ffffff; + --page-foreground-color: #2f4153; + --page-secondary-foreground-color: #6f7e8e; + + /* color for all separators on the website: hr, borders, ... */ + --separator-color: #dedede; + + /* border radius for all rounded components. Will affect many components, like dropdowns, memitems, codeblocks, ... */ + --border-radius-large: 8px; + --border-radius-small: 4px; + --border-radius-medium: 6px; + + /* default spacings. Most components reference these values for spacing, to provide uniform spacing on the page. */ + --spacing-small: 5px; + --spacing-medium: 10px; + --spacing-large: 16px; + + /* default box shadow used for raising an element above the normal content. Used in dropdowns, search result, ... */ + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.075); + + --odd-color: rgba(0,0,0,.028); + + /* font-families. will affect all text on the website + * font-family: the normal font for text, headlines, menus + * font-family-monospace: used for preformatted text in memtitle, code, fragments + */ + --font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif; + --font-family-monospace: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; + + /* font sizes */ + --page-font-size: 15.6px; + --navigation-font-size: 14.4px; + --toc-font-size: 13.4px; + --code-font-size: 14px; /* affects code, fragment */ + --title-font-size: 22px; + + /* content text properties. These only affect the page content, not the navigation or any other ui elements */ + --content-line-height: 27px; + /* The content is centered and constraint in it's width. To make the content fill the whole page, set the variable to auto.*/ + --content-maxwidth: 1050px; + --table-line-height: 24px; + --toc-sticky-top: var(--spacing-medium); + --toc-width: 200px; + --toc-max-height: calc(100vh - 2 * var(--spacing-medium) - 85px); + + /* colors for various content boxes: @warning, @note, @deprecated @bug */ + --warning-color: #f8d1cc; + --warning-color-dark: #b61825; + --warning-color-darker: #75070f; + --note-color: #faf3d8; + --note-color-dark: #f3a600; + --note-color-darker: #5f4204; + --todo-color: #e4f3ff; + --todo-color-dark: #1879C4; + --todo-color-darker: #274a5c; + --deprecated-color: #ecf0f3; + --deprecated-color-dark: #5b6269; + --deprecated-color-darker: #43454a; + --bug-color: #e4dafd; + --bug-color-dark: #5b2bdd; + --bug-color-darker: #2a0d72; + --invariant-color: #d8f1e3; + --invariant-color-dark: #44b86f; + --invariant-color-darker: #265532; + + /* blockquote colors */ + --blockquote-background: #f8f9fa; + --blockquote-foreground: #636568; + + /* table colors */ + --tablehead-background: #f1f1f1; + --tablehead-foreground: var(--page-foreground-color); + + /* menu-display: block | none + * Visibility of the top navigation on screens >= 768px. On smaller screen the menu is always visible. + * `GENERATE_TREEVIEW` MUST be enabled! + */ + --menu-display: block; + + --menu-focus-foreground: var(--page-background-color); + --menu-focus-background: var(--primary-color); + --menu-selected-background: rgba(0,0,0,.05); + + + --header-background: var(--page-background-color); + --header-foreground: var(--page-foreground-color); + + /* searchbar colors */ + --searchbar-background: var(--side-nav-background); + --searchbar-foreground: var(--page-foreground-color); + + /* searchbar size + * (`searchbar-width` is only applied on screens >= 768px. + * on smaller screens the searchbar will always fill the entire screen width) */ + --searchbar-height: 33px; + --searchbar-width: 210px; + --searchbar-border-radius: var(--searchbar-height); + + /* code block colors */ + --code-background: #f5f5f5; + --code-foreground: var(--page-foreground-color); + + /* fragment colors */ + --fragment-background: #F8F9FA; + --fragment-foreground: #37474F; + --fragment-keyword: #bb6bb2; + --fragment-keywordtype: #8258b3; + --fragment-keywordflow: #d67c3b; + --fragment-token: #438a59; + --fragment-comment: #969696; + --fragment-link: #5383d6; + --fragment-preprocessor: #46aaa5; + --fragment-linenumber-color: #797979; + --fragment-linenumber-background: #f4f4f5; + --fragment-linenumber-border: #e3e5e7; + --fragment-lineheight: 20px; + + /* sidebar navigation (treeview) colors */ + --side-nav-background: #fbfbfb; + --side-nav-foreground: var(--page-foreground-color); + --side-nav-arrow-opacity: 0; + --side-nav-arrow-hover-opacity: 0.9; + + --toc-background: var(--side-nav-background); + --toc-foreground: var(--side-nav-foreground); + + /* height of an item in any tree / collapsable table */ + --tree-item-height: 30px; + + --memname-font-size: var(--code-font-size); + --memtitle-font-size: 18px; + + --webkit-scrollbar-size: 7px; + --webkit-scrollbar-padding: 4px; + --webkit-scrollbar-color: var(--separator-color); +} + +@media screen and (max-width: 767px) { + html { + --page-font-size: 16px; + --navigation-font-size: 16px; + --toc-font-size: 15px; + --code-font-size: 15px; /* affects code, fragment */ + --title-font-size: 22px; + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #86a9c4; + --primary-light-color: #4779ac; + + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.35); + + --odd-color: rgba(100,100,100,.06); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #38393b; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #222325; + --blockquote-foreground: #7e8c92; + + --warning-color: #2e1917; + --warning-color-dark: #ad2617; + --warning-color-darker: #f5b1aa; + --note-color: #3b2e04; + --note-color-dark: #f1b602; + --note-color-darker: #ceb670; + --todo-color: #163750; + --todo-color-dark: #1982D2; + --todo-color-darker: #dcf0fa; + --deprecated-color: #2e323b; + --deprecated-color-dark: #738396; + --deprecated-color-darker: #abb0bd; + --bug-color: #2a2536; + --bug-color-dark: #7661b3; + --bug-color-darker: #ae9ed6; + --invariant-color: #303a35; + --invariant-color-dark: #76ce96; + --invariant-color-darker: #cceed5; + + --fragment-background: #282c34; + --fragment-foreground: #dbe4eb; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; + } +} + +/* dark mode variables are defined twice, to support both the dark-mode without and with doxygen-awesome-darkmode-toggle.js */ +html.dark-mode { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #86a9c4; + --primary-light-color: #4779ac; + + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.30); + + --odd-color: rgba(100,100,100,.06); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #38393b; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #222325; + --blockquote-foreground: #7e8c92; + + --warning-color: #2e1917; + --warning-color-dark: #ad2617; + --warning-color-darker: #f5b1aa; + --note-color: #3b2e04; + --note-color-dark: #f1b602; + --note-color-darker: #ceb670; + --todo-color: #163750; + --todo-color-dark: #1982D2; + --todo-color-darker: #dcf0fa; + --deprecated-color: #2e323b; + --deprecated-color-dark: #738396; + --deprecated-color-darker: #abb0bd; + --bug-color: #2a2536; + --bug-color-dark: #7661b3; + --bug-color-darker: #ae9ed6; + --invariant-color: #303a35; + --invariant-color-dark: #76ce96; + --invariant-color-darker: #cceed5; + + --fragment-background: #282c34; + --fragment-foreground: #dbe4eb; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; +} + +body { + color: var(--page-foreground-color); + background-color: var(--page-background-color); + font-size: var(--page-font-size); +} + +body, table, div, p, dl, #nav-tree .label, .title, +.sm-dox a, .sm-dox a:hover, .sm-dox a:focus, #projectname, +.SelectItem, #MSearchField, .navpath li.navelem a, +.navpath li.navelem a:hover, p.reference, p.definition { + font-family: var(--font-family); +} + +h1, h2, h3, h4, h5 { + margin-top: .9em; + font-weight: 600; + line-height: initial; +} + +p, div, table, dl, p.reference, p.definition { + font-size: var(--page-font-size); +} + +p.reference, p.definition { + color: var(--page-secondary-foreground-color); +} + +a:link, a:visited, a:hover, a:focus, a:active { + color: var(--primary-color) !important; + font-weight: 500; +} + +a.anchor { + scroll-margin-top: var(--spacing-large); + display: block; +} + +/* + Title and top navigation + */ + +#top { + background: var(--header-background); + border-bottom: 1px solid var(--separator-color); +} + +@media screen and (min-width: 768px) { + #top { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + } +} + +#main-nav { + flex-grow: 5; + padding: var(--spacing-small) var(--spacing-medium); +} + +#titlearea { + width: auto; + padding: var(--spacing-medium) var(--spacing-large); + background: none; + color: var(--header-foreground); + border-bottom: none; +} + +@media screen and (max-width: 767px) { + #titlearea { + padding-bottom: var(--spacing-small); + } +} + +#titlearea table tbody tr { + height: auto !important; +} + +#projectname { + font-size: var(--title-font-size); + font-weight: 600; +} + +#projectnumber { + font-family: inherit; + font-size: 60%; +} + +#projectbrief { + font-family: inherit; + font-size: 80%; +} + +#projectlogo { + vertical-align: middle; +} + +#projectlogo img { + max-height: calc(var(--title-font-size) * 2); + margin-right: var(--spacing-small); +} + +.sm-dox, .tabs, .tabs2, .tabs3 { + background: none; + padding: 0; +} + +.tabs, .tabs2, .tabs3 { + border-bottom: 1px solid var(--separator-color); + margin-bottom: -1px; +} + +.main-menu-btn-icon, .main-menu-btn-icon:before, .main-menu-btn-icon:after { + background: var(--page-secondary-foreground-color); +} + +@media screen and (max-width: 767px) { + .sm-dox a span.sub-arrow { + background: var(--code-background); + } + + #main-menu a.has-submenu span.sub-arrow { + color: var(--page-secondary-foreground-color); + border-radius: var(--border-radius-medium); + } + + #main-menu a.has-submenu:hover span.sub-arrow { + color: var(--page-foreground-color); + } +} + +@media screen and (min-width: 768px) { + .sm-dox li, .tablist li { + display: var(--menu-display); + } + + .sm-dox a span.sub-arrow { + border-color: var(--header-foreground) transparent transparent transparent; + } + + .sm-dox a:hover span.sub-arrow { + border-color: var(--menu-focus-foreground) transparent transparent transparent; + } + + .sm-dox ul a span.sub-arrow { + border-color: transparent transparent transparent var(--page-foreground-color); + } + + .sm-dox ul a:hover span.sub-arrow { + border-color: transparent transparent transparent var(--menu-focus-foreground); + } +} + +.sm-dox ul { + background: var(--page-background-color); + box-shadow: var(--box-shadow); + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium) !important; + padding: var(--spacing-small); + animation: ease-out 150ms slideInMenu; +} + +@keyframes slideInMenu { + from { + opacity: 0; + transform: translate(0px, -2px); + } + + to { + opacity: 1; + transform: translate(0px, 0px); + } +} + +.sm-dox ul a { + color: var(--page-foreground-color) !important; + background: var(--page-background-color); + font-size: var(--navigation-font-size); +} + +.sm-dox>li>ul:after { + border-bottom-color: var(--page-background-color) !important; +} + +.sm-dox>li>ul:before { + border-bottom-color: var(--separator-color) !important; +} + +.sm-dox ul a:hover, .sm-dox ul a:active, .sm-dox ul a:focus { + font-size: var(--navigation-font-size) !important; + color: var(--menu-focus-foreground) !important; + text-shadow: none; + background-color: var(--menu-focus-background); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a, .sm-dox a:focus, .tablist li, .tablist li a, .tablist li.current a { + text-shadow: none; + background: transparent; + background-image: none !important; + color: var(--header-foreground) !important; + font-weight: normal; + font-size: var(--navigation-font-size); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a:focus { + outline: auto; +} + +.sm-dox a:hover, .sm-dox a:active, .tablist li a:hover { + text-shadow: none; + font-weight: normal; + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; + border-radius: var(--border-radius-small) !important; + font-size: var(--navigation-font-size); +} + +.tablist li.current { + border-radius: var(--border-radius-small); + background: var(--menu-selected-background); +} + +.tablist li { + margin: var(--spacing-small) 0 var(--spacing-small) var(--spacing-small); +} + +.tablist a { + padding: 0 var(--spacing-large); +} + + +/* + Search box + */ + +#MSearchBox { + height: var(--searchbar-height); + background: var(--searchbar-background); + border-radius: var(--searchbar-border-radius); + border: 1px solid var(--separator-color); + overflow: hidden; + width: var(--searchbar-width); + position: relative; + box-shadow: none; + display: block; + margin-top: 0; +} + +/* until Doxygen 1.9.4 */ +.left img#MSearchSelect { + left: 0; + user-select: none; + padding-left: 8px; +} + +/* Doxygen 1.9.5 */ +.left span#MSearchSelect { + left: 0; + user-select: none; + margin-left: 8px; + padding: 0; +} + +.left #MSearchSelect[src$=".png"] { + padding-left: 0 +} + +.SelectionMark { + user-select: none; +} + +.tabs .left #MSearchSelect { + padding-left: 0; +} + +.tabs #MSearchBox { + position: absolute; + right: var(--spacing-medium); +} + +@media screen and (max-width: 767px) { + .tabs #MSearchBox { + position: relative; + right: 0; + margin-left: var(--spacing-medium); + margin-top: 0; + } +} + +#MSearchSelectWindow, #MSearchResultsWindow { + z-index: 9999; +} + +#MSearchBox.MSearchBoxActive { + border-color: var(--primary-color); + box-shadow: inset 0 0 0 1px var(--primary-color); +} + +#main-menu > li:last-child { + margin-right: 0; +} + +@media screen and (max-width: 767px) { + #main-menu > li:last-child { + height: 50px; + } +} + +#MSearchField { + font-size: var(--navigation-font-size); + height: calc(var(--searchbar-height) - 2px); + background: transparent; + width: calc(var(--searchbar-width) - 64px); +} + +.MSearchBoxActive #MSearchField { + color: var(--searchbar-foreground); +} + +#MSearchSelect { + top: calc(calc(var(--searchbar-height) / 2) - 11px); +} + +#MSearchBox span.left, #MSearchBox span.right { + background: none; + background-image: none; +} + +#MSearchBox span.right { + padding-top: calc(calc(var(--searchbar-height) / 2) - 12px); + position: absolute; + right: var(--spacing-small); +} + +.tabs #MSearchBox span.right { + top: calc(calc(var(--searchbar-height) / 2) - 12px); +} + +@keyframes slideInSearchResults { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } +} + +#MSearchResultsWindow { + left: auto !important; + right: var(--spacing-medium); + border-radius: var(--border-radius-large); + border: 1px solid var(--separator-color); + transform: translate(0, 20px); + box-shadow: var(--box-shadow); + animation: ease-out 280ms slideInSearchResults; + background: var(--page-background-color); +} + +iframe#MSearchResults { + margin: 4px; +} + +iframe { + color-scheme: normal; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) iframe#MSearchResults { + filter: invert() hue-rotate(180deg); + } +} + +html.dark-mode iframe#MSearchResults { + filter: invert() hue-rotate(180deg); +} + +#MSearchResults .SRPage { + background-color: transparent; +} + +#MSearchResults .SRPage .SREntry { + font-size: 10pt; + padding: var(--spacing-small) var(--spacing-medium); +} + +#MSearchSelectWindow { + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + box-shadow: var(--box-shadow); + background: var(--page-background-color); + padding-top: var(--spacing-small); + padding-bottom: var(--spacing-small); +} + +#MSearchSelectWindow a.SelectItem { + font-size: var(--navigation-font-size); + line-height: var(--content-line-height); + margin: 0 var(--spacing-small); + border-radius: var(--border-radius-small); + color: var(--page-foreground-color) !important; + font-weight: normal; +} + +#MSearchSelectWindow a.SelectItem:hover { + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; +} + +@media screen and (max-width: 767px) { + #MSearchBox { + margin-top: var(--spacing-medium); + margin-bottom: var(--spacing-medium); + width: calc(100vw - 30px); + } + + #main-menu > li:last-child { + float: none !important; + } + + #MSearchField { + width: calc(100vw - 110px); + } + + @keyframes slideInSearchResultsMobile { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } + } + + #MSearchResultsWindow { + left: var(--spacing-medium) !important; + right: var(--spacing-medium); + overflow: auto; + transform: translate(0, 20px); + animation: ease-out 280ms slideInSearchResultsMobile; + width: auto !important; + } + + /* + * Overwrites for fixing the searchbox on mobile in doxygen 1.9.2 + */ + label.main-menu-btn ~ #searchBoxPos1 { + top: 3px !important; + right: 6px !important; + left: 45px; + display: flex; + } + + label.main-menu-btn ~ #searchBoxPos1 > #MSearchBox { + margin-top: 0; + margin-bottom: 0; + flex-grow: 2; + float: left; + } +} + +/* + Tree view + */ + +#side-nav { + padding: 0 !important; + background: var(--side-nav-background); +} + +@media screen and (max-width: 767px) { + #side-nav { + display: none; + } + + #doc-content { + margin-left: 0 !important; + } +} + +#nav-tree { + background: transparent; +} + +#nav-tree .label { + font-size: var(--navigation-font-size); +} + +#nav-tree .item { + height: var(--tree-item-height); + line-height: var(--tree-item-height); +} + +#nav-sync { + bottom: 12px; + right: 12px; + top: auto !important; + user-select: none; +} + +#nav-tree .selected { + text-shadow: none; + background-image: none; + background-color: transparent; + position: relative; +} + +#nav-tree .selected::after { + content: ""; + position: absolute; + top: 1px; + bottom: 1px; + left: 0; + width: 4px; + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; + background: var(--primary-color); +} + + +#nav-tree a { + color: var(--side-nav-foreground) !important; + font-weight: normal; +} + +#nav-tree a:focus { + outline-style: auto; +} + +#nav-tree .arrow { + opacity: var(--side-nav-arrow-opacity); +} + +.arrow { + color: inherit; + cursor: pointer; + font-size: 45%; + vertical-align: middle; + margin-right: 2px; + font-family: serif; + height: auto; + text-align: right; +} + +#nav-tree div.item:hover .arrow, #nav-tree a:focus .arrow { + opacity: var(--side-nav-arrow-hover-opacity); +} + +#nav-tree .selected a { + color: var(--primary-color) !important; + font-weight: bolder; + font-weight: 600; +} + +.ui-resizable-e { + background: var(--separator-color); + width: 1px; +} + +/* + Contents + */ + +div.header { + border-bottom: 1px solid var(--separator-color); + background-color: var(--page-background-color); + background-image: none; +} + +@media screen and (min-width: 1000px) { + #doc-content > div > div.contents, + .PageDoc > div.contents { + display: flex; + flex-direction: row-reverse; + flex-wrap: nowrap; + align-items: flex-start; + } + + div.contents .textblock { + min-width: 200px; + flex-grow: 1; + } +} + +div.contents, div.header .title, div.header .summary { + max-width: var(--content-maxwidth); +} + +div.contents, div.header .title { + line-height: initial; + margin: calc(var(--spacing-medium) + .2em) auto var(--spacing-medium) auto; +} + +div.header .summary { + margin: var(--spacing-medium) auto 0 auto; +} + +div.headertitle { + padding: 0; +} + +div.header .title { + font-weight: 600; + font-size: 225%; + padding: var(--spacing-medium) var(--spacing-large); + word-break: break-word; +} + +div.header .summary { + width: auto; + display: block; + float: none; + padding: 0 var(--spacing-large); +} + +td.memSeparator { + border-color: var(--separator-color); +} + +span.mlabel { + background: var(--primary-color); + border: none; + padding: 4px 9px; + border-radius: 12px; + margin-right: var(--spacing-medium); +} + +span.mlabel:last-of-type { + margin-right: 2px; +} + +div.contents { + padding: 0 var(--spacing-large); +} + +div.contents p, div.contents li { + line-height: var(--content-line-height); +} + +div.contents div.dyncontent { + margin: var(--spacing-medium) 0; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) div.contents div.dyncontent img, + html:not(.light-mode) div.contents center img, + html:not(.light-mode) div.contents > table img, + html:not(.light-mode) div.contents div.dyncontent iframe, + html:not(.light-mode) div.contents center iframe, + html:not(.light-mode) div.contents table iframe { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode div.contents div.dyncontent img, +html.dark-mode div.contents center img, +html.dark-mode div.contents > table img, +html.dark-mode div.contents div.dyncontent iframe, +html.dark-mode div.contents center iframe, +html.dark-mode div.contents table iframe { + filter: hue-rotate(180deg) invert(); +} + +h2.groupheader { + border-bottom: 0px; + color: var(--page-foreground-color); + box-shadow: + 100px 0 var(--page-background-color), + -100px 0 var(--page-background-color), + 100px 0.75px var(--separator-color), + -100px 0.75px var(--separator-color), + 500px 0 var(--page-background-color), + -500px 0 var(--page-background-color), + 500px 0.75px var(--separator-color), + -500px 0.75px var(--separator-color), + 900px 0 var(--page-background-color), + -900px 0 var(--page-background-color), + 900px 0.75px var(--separator-color), + -900px 0.75px var(--separator-color), + 1400px 0 var(--page-background-color), + -1400px 0 var(--page-background-color), + 1400px 0.75px var(--separator-color), + -1400px 0.75px var(--separator-color), + 1900px 0 var(--page-background-color), + -1900px 0 var(--page-background-color), + 1900px 0.75px var(--separator-color), + -1900px 0.75px var(--separator-color); +} + +blockquote { + margin: 0 var(--spacing-medium) 0 var(--spacing-medium); + padding: var(--spacing-small) var(--spacing-large); + background: var(--blockquote-background); + color: var(--blockquote-foreground); + border-left: 0; + overflow: visible; + border-radius: var(--border-radius-medium); + overflow: visible; + position: relative; +} + +blockquote::before, blockquote::after { + font-weight: bold; + font-family: serif; + font-size: 360%; + opacity: .15; + position: absolute; +} + +blockquote::before { + content: "“"; + left: -10px; + top: 4px; +} + +blockquote::after { + content: "”"; + right: -8px; + bottom: -25px; +} + +blockquote p { + margin: var(--spacing-small) 0 var(--spacing-medium) 0; +} +.paramname { + font-weight: 600; + color: var(--primary-dark-color); +} + +.paramname > code { + border: 0; +} + +table.params .paramname { + font-weight: 600; + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); + padding-right: var(--spacing-small); + line-height: var(--table-line-height); +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px var(--primary-light-color); +} + +.alphachar a { + color: var(--page-foreground-color); +} + +/* + Table of Contents + */ + +div.contents .toc { + max-height: var(--toc-max-height); + min-width: var(--toc-width); + border: 0; + border-left: 1px solid var(--separator-color); + border-radius: 0; + background-color: transparent; + box-shadow: none; + position: sticky; + top: var(--toc-sticky-top); + padding: 0 var(--spacing-large); + margin: var(--spacing-small) 0 var(--spacing-large) var(--spacing-large); +} + +div.toc h3 { + color: var(--toc-foreground); + font-size: var(--navigation-font-size); + margin: var(--spacing-large) 0 var(--spacing-medium) 0; +} + +div.toc li { + padding: 0; + background: none; + line-height: var(--toc-font-size); + margin: var(--toc-font-size) 0 0 0; +} + +div.toc li::before { + display: none; +} + +div.toc ul { + margin-top: 0 +} + +div.toc li a { + font-size: var(--toc-font-size); + color: var(--page-foreground-color) !important; + text-decoration: none; +} + +div.toc li a:hover, div.toc li a.active { + color: var(--primary-color) !important; +} + +div.toc li a.aboveActive { + color: var(--page-secondary-foreground-color) !important; +} + + +@media screen and (max-width: 999px) { + div.contents .toc { + max-height: 45vh; + float: none; + width: auto; + margin: 0 0 var(--spacing-medium) 0; + position: relative; + top: 0; + position: relative; + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + background-color: var(--toc-background); + box-shadow: var(--box-shadow); + } + + div.contents .toc.interactive { + max-height: calc(var(--navigation-font-size) + 2 * var(--spacing-large)); + overflow: hidden; + } + + div.contents .toc > h3 { + -webkit-tap-highlight-color: transparent; + cursor: pointer; + position: sticky; + top: 0; + background-color: var(--toc-background); + margin: 0; + padding: var(--spacing-large) 0; + display: block; + } + + div.contents .toc.interactive > h3::before { + content: ""; + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 5px solid var(--primary-color); + display: inline-block; + margin-right: var(--spacing-small); + margin-bottom: calc(var(--navigation-font-size) / 4); + transform: rotate(-90deg); + transition: transform 0.25s ease-out; + } + + div.contents .toc.interactive.open > h3::before { + transform: rotate(0deg); + } + + div.contents .toc.interactive.open { + max-height: 45vh; + overflow: auto; + transition: max-height 0.2s ease-in-out; + } + + div.contents .toc a, div.contents .toc a.active { + color: var(--primary-color) !important; + } + + div.contents .toc a:hover { + text-decoration: underline; + } +} + +/* + Code & Fragments + */ + +code, div.fragment, pre.fragment { + border-radius: var(--border-radius-small); + border: 1px solid var(--separator-color); + overflow: hidden; +} + +code { + display: inline; + background: var(--code-background); + color: var(--code-foreground); + padding: 2px 6px; +} + +div.fragment, pre.fragment { + margin: var(--spacing-medium) 0; + padding: calc(var(--spacing-large) - (var(--spacing-large) / 6)) var(--spacing-large); + background: var(--fragment-background); + color: var(--fragment-foreground); + overflow-x: auto; +} + +@media screen and (max-width: 767px) { + div.fragment, pre.fragment { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: 0; + } + + .contents > div.fragment, + .textblock > div.fragment, + .textblock > pre.fragment, + .contents > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .doxygen-awesome-fragment-wrapper > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + border-radius: 0; + border-left: 0; + } + + .textblock li > .fragment, + .textblock li > .doxygen-awesome-fragment-wrapper > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + } + + .memdoc li > .fragment, + .memdoc li > .doxygen-awesome-fragment-wrapper > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + } + + .textblock ul, .memdoc ul { + overflow: initial; + } + + .memdoc > div.fragment, + .memdoc > pre.fragment, + dl dd > div.fragment, + dl dd pre.fragment, + .memdoc > .doxygen-awesome-fragment-wrapper > div.fragment, + .memdoc > .doxygen-awesome-fragment-wrapper > pre.fragment, + dl dd > .doxygen-awesome-fragment-wrapper > div.fragment, + dl dd .doxygen-awesome-fragment-wrapper > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + border-radius: 0; + border-left: 0; + } +} + +code, code a, pre.fragment, div.fragment, div.fragment .line, div.fragment span, div.fragment .line a, div.fragment .line span { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size) !important; +} + +div.line:after { + margin-right: var(--spacing-medium); +} + +div.fragment .line, pre.fragment { + white-space: pre; + word-wrap: initial; + line-height: var(--fragment-lineheight); +} + +div.fragment span.keyword { + color: var(--fragment-keyword); +} + +div.fragment span.keywordtype { + color: var(--fragment-keywordtype); +} + +div.fragment span.keywordflow { + color: var(--fragment-keywordflow); +} + +div.fragment span.stringliteral { + color: var(--fragment-token) +} + +div.fragment span.comment { + color: var(--fragment-comment); +} + +div.fragment a.code { + color: var(--fragment-link) !important; +} + +div.fragment span.preprocessor { + color: var(--fragment-preprocessor); +} + +div.fragment span.lineno { + display: inline-block; + width: 27px; + border-right: none; + background: var(--fragment-linenumber-background); + color: var(--fragment-linenumber-color); +} + +div.fragment span.lineno a { + background: none; + color: var(--fragment-link) !important; +} + +div.fragment .line:first-child .lineno { + box-shadow: -999999px 0px 0 999999px var(--fragment-linenumber-background), -999998px 0px 0 999999px var(--fragment-linenumber-border); +} + +div.line { + border-radius: var(--border-radius-small); +} + +div.line.glow { + background-color: var(--primary-light-color); + box-shadow: none; +} + +/* + dl warning, attention, note, deprecated, bug, ... + */ + +dl.bug dt a, dl.deprecated dt a, dl.todo dt a { + font-weight: bold !important; +} + +dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, dl.invariant, dl.pre, dl.todo, dl.remark { + padding: var(--spacing-medium); + margin: var(--spacing-medium) 0; + color: var(--page-background-color); + overflow: hidden; + margin-left: 0; + border-radius: var(--border-radius-small); +} + +dl.section dd { + margin-bottom: 2px; +} + +dl.warning, dl.attention { + background: var(--warning-color); + border-left: 8px solid var(--warning-color-dark); + color: var(--warning-color-darker); +} + +dl.warning dt, dl.attention dt { + color: var(--warning-color-dark); +} + +dl.note, dl.remark { + background: var(--note-color); + border-left: 8px solid var(--note-color-dark); + color: var(--note-color-darker); +} + +dl.note dt, dl.remark dt { + color: var(--note-color-dark); +} + +dl.todo { + background: var(--todo-color); + border-left: 8px solid var(--todo-color-dark); + color: var(--todo-color-darker); +} + +dl.todo dt { + color: var(--todo-color-dark); +} + +dl.bug dt a { + color: var(--todo-color-dark) !important; +} + +dl.bug { + background: var(--bug-color); + border-left: 8px solid var(--bug-color-dark); + color: var(--bug-color-darker); +} + +dl.bug dt a { + color: var(--bug-color-dark) !important; +} + +dl.deprecated { + background: var(--deprecated-color); + border-left: 8px solid var(--deprecated-color-dark); + color: var(--deprecated-color-darker); +} + +dl.deprecated dt a { + color: var(--deprecated-color-dark) !important; +} + +dl.section dd, dl.bug dd, dl.deprecated dd, dl.todo dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre { + background: var(--invariant-color); + border-left: 8px solid var(--invariant-color-dark); + color: var(--invariant-color-darker); +} + +dl.invariant dt, dl.pre dt { + color: var(--invariant-color-dark); +} + +/* + memitem + */ + +div.memdoc, div.memproto, h2.memtitle { + box-shadow: none; + background-image: none; + border: none; +} + +div.memdoc { + padding: 0 var(--spacing-medium); + background: var(--page-background-color); +} + +h2.memtitle, div.memitem { + border: 1px solid var(--separator-color); + box-shadow: var(--box-shadow); +} + +h2.memtitle { + box-shadow: 0px var(--spacing-medium) 0 -1px var(--fragment-background), var(--box-shadow); +} + +div.memitem { + transition: none; +} + +div.memproto, h2.memtitle { + background: var(--fragment-background); +} + +h2.memtitle { + font-weight: 500; + font-size: var(--memtitle-font-size); + font-family: var(--font-family-monospace); + border-bottom: none; + border-top-left-radius: var(--border-radius-medium); + border-top-right-radius: var(--border-radius-medium); + word-break: break-all; + position: relative; +} + +h2.memtitle:after { + content: ""; + display: block; + background: var(--fragment-background); + height: var(--spacing-medium); + bottom: calc(0px - var(--spacing-medium)); + left: 0; + right: -14px; + position: absolute; + border-top-right-radius: var(--border-radius-medium); +} + +h2.memtitle > span.permalink { + font-size: inherit; +} + +h2.memtitle > span.permalink > a { + text-decoration: none; + padding-left: 3px; + margin-right: -4px; + user-select: none; + display: inline-block; + margin-top: -6px; +} + +h2.memtitle > span.permalink > a:hover { + color: var(--primary-dark-color) !important; +} + +a:target + h2.memtitle, a:target + h2.memtitle + div.memitem { + border-color: var(--primary-light-color); +} + +div.memitem { + border-top-right-radius: var(--border-radius-medium); + border-bottom-right-radius: var(--border-radius-medium); + border-bottom-left-radius: var(--border-radius-medium); + overflow: hidden; + display: block !important; +} + +div.memdoc { + border-radius: 0; +} + +div.memproto { + border-radius: 0 var(--border-radius-small) 0 0; + overflow: auto; + border-bottom: 1px solid var(--separator-color); + padding: var(--spacing-medium); + margin-bottom: -1px; +} + +div.memtitle { + border-top-right-radius: var(--border-radius-medium); + border-top-left-radius: var(--border-radius-medium); +} + +div.memproto table.memname { + font-family: var(--font-family-monospace); + color: var(--page-foreground-color); + font-size: var(--memname-font-size); + text-shadow: none; +} + +div.memproto div.memtemplate { + font-family: var(--font-family-monospace); + color: var(--primary-dark-color); + font-size: var(--memname-font-size); + margin-left: 2px; + text-shadow: none; +} + +table.mlabels, table.mlabels > tbody { + display: block; +} + +td.mlabels-left { + width: auto; +} + +td.mlabels-right { + margin-top: 3px; + position: sticky; + left: 0; +} + +table.mlabels > tbody > tr:first-child { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.memname, .memitem span.mlabels { + margin: 0 +} + +/* + reflist + */ + +dl.reflist { + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-medium); + border: 1px solid var(--separator-color); + overflow: hidden; + padding: 0; +} + + +dl.reflist dt, dl.reflist dd { + box-shadow: none; + text-shadow: none; + background-image: none; + border: none; + padding: 12px; +} + + +dl.reflist dt { + font-weight: 500; + border-radius: 0; + background: var(--code-background); + border-bottom: 1px solid var(--separator-color); + color: var(--page-foreground-color) +} + + +dl.reflist dd { + background: none; +} + +/* + Table + */ + +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname), +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody { + display: inline-block; + max-width: 100%; +} + +.contents > table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname):not(.classindex) { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + max-width: calc(100% + 2 * var(--spacing-large)); +} + +table.fieldtable, +table.markdownTable tbody, +table.doxtable tbody { + border: none; + margin: var(--spacing-medium) 0; + box-shadow: 0 0 0 1px var(--separator-color); + border-radius: var(--border-radius-small); +} + +table.doxtable caption { + display: block; +} + +table.fieldtable { + border-collapse: collapse; + width: 100%; +} + +th.markdownTableHeadLeft, +th.markdownTableHeadRight, +th.markdownTableHeadCenter, +th.markdownTableHeadNone, +table.doxtable th { + background: var(--tablehead-background); + color: var(--tablehead-foreground); + font-weight: 600; + font-size: var(--page-font-size); +} + +th.markdownTableHeadLeft:first-child, +th.markdownTableHeadRight:first-child, +th.markdownTableHeadCenter:first-child, +th.markdownTableHeadNone:first-child, +table.doxtable tr th:first-child { + border-top-left-radius: var(--border-radius-small); +} + +th.markdownTableHeadLeft:last-child, +th.markdownTableHeadRight:last-child, +th.markdownTableHeadCenter:last-child, +th.markdownTableHeadNone:last-child, +table.doxtable tr th:last-child { + border-top-right-radius: var(--border-radius-small); +} + +table.markdownTable td, +table.markdownTable th, +table.fieldtable td, +table.fieldtable th, +table.doxtable td, +table.doxtable th { + border: 1px solid var(--separator-color); + padding: var(--spacing-small) var(--spacing-medium); +} + +table.markdownTable td:last-child, +table.markdownTable th:last-child, +table.fieldtable td:last-child, +table.fieldtable th:last-child, +table.doxtable td:last-child, +table.doxtable th:last-child { + border-right: none; +} + +table.markdownTable td:first-child, +table.markdownTable th:first-child, +table.fieldtable td:first-child, +table.fieldtable th:first-child, +table.doxtable td:first-child, +table.doxtable th:first-child { + border-left: none; +} + +table.markdownTable tr:first-child td, +table.markdownTable tr:first-child th, +table.fieldtable tr:first-child td, +table.fieldtable tr:first-child th, +table.doxtable tr:first-child td, +table.doxtable tr:first-child th { + border-top: none; +} + +table.markdownTable tr:last-child td, +table.markdownTable tr:last-child th, +table.fieldtable tr:last-child td, +table.fieldtable tr:last-child th, +table.doxtable tr:last-child td, +table.doxtable tr:last-child th { + border-bottom: none; +} + +table.markdownTable tr, table.doxtable tr { + border-bottom: 1px solid var(--separator-color); +} + +table.markdownTable tr:last-child, table.doxtable tr:last-child { + border-bottom: none; +} + +table.fieldtable th { + font-size: var(--page-font-size); + font-weight: 600; + background-image: none; + background-color: var(--tablehead-background); + color: var(--tablehead-foreground); +} + +table.fieldtable td.fieldtype, .fieldtable td.fieldname, .fieldtable td.fielddoc, .fieldtable th { + border-bottom: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); +} + +table.fieldtable tr:last-child td:first-child { + border-bottom-left-radius: var(--border-radius-small); +} + +table.fieldtable tr:last-child td:last-child { + border-bottom-right-radius: var(--border-radius-small); +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: var(--primary-light-color); + box-shadow: none; +} + +table.memberdecls { + display: block; + -webkit-tap-highlight-color: transparent; +} + +table.memberdecls tr[class^='memitem'] { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); +} + +table.memberdecls tr[class^='memitem'] .memTemplParams { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); + color: var(--primary-dark-color); + white-space: normal; +} + +table.memberdecls .memItemLeft, +table.memberdecls .memItemRight, +table.memberdecls .memTemplItemLeft, +table.memberdecls .memTemplItemRight, +table.memberdecls .memTemplParams { + transition: none; + padding-top: var(--spacing-small); + padding-bottom: var(--spacing-small); + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + background-color: var(--fragment-background); +} + +table.memberdecls .memTemplItemLeft, +table.memberdecls .memTemplItemRight { + padding-top: 2px; +} + +table.memberdecls .memTemplParams { + border-bottom: 0; + border-left: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); + border-radius: var(--border-radius-small) var(--border-radius-small) 0 0; + padding-bottom: var(--spacing-small); +} + +table.memberdecls .memTemplItemLeft { + border-radius: 0 0 0 var(--border-radius-small); + border-left: 1px solid var(--separator-color); + border-top: 0; +} + +table.memberdecls .memTemplItemRight { + border-radius: 0 0 var(--border-radius-small) 0; + border-right: 1px solid var(--separator-color); + padding-left: 0; + border-top: 0; +} + +table.memberdecls .memItemLeft { + border-radius: var(--border-radius-small) 0 0 var(--border-radius-small); + border-left: 1px solid var(--separator-color); + padding-left: var(--spacing-medium); + padding-right: 0; +} + +table.memberdecls .memItemRight { + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; + border-right: 1px solid var(--separator-color); + padding-right: var(--spacing-medium); + padding-left: 0; + +} + +table.memberdecls .mdescLeft, table.memberdecls .mdescRight { + background: none; + color: var(--page-foreground-color); + padding: var(--spacing-small) 0; +} + +table.memberdecls .memItemLeft, +table.memberdecls .memTemplItemLeft { + padding-right: var(--spacing-medium); +} + +table.memberdecls .memSeparator { + background: var(--page-background-color); + height: var(--spacing-large); + border: 0; + transition: none; +} + +table.memberdecls .groupheader { + margin-bottom: var(--spacing-large); +} + +table.memberdecls .inherit_header td { + padding: 0 0 var(--spacing-medium) 0; + text-indent: -12px; + color: var(--page-secondary-foreground-color); +} + +table.memberdecls img[src="closed.png"], +table.memberdecls img[src="open.png"], +div.dynheader img[src="open.png"], +div.dynheader img[src="closed.png"] { + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 5px solid var(--primary-color); + margin-top: 8px; + display: block; + float: left; + margin-left: -10px; + transition: transform 0.25s ease-out; +} + +table.memberdecls img { + margin-right: 10px; +} + +table.memberdecls img[src="closed.png"], +div.dynheader img[src="closed.png"] { + transform: rotate(-90deg); + +} + +.compoundTemplParams { + font-family: var(--font-family-monospace); + color: var(--primary-dark-color); + font-size: var(--code-font-size); +} + +@media screen and (max-width: 767px) { + + table.memberdecls .memItemLeft, + table.memberdecls .memItemRight, + table.memberdecls .mdescLeft, + table.memberdecls .mdescRight, + table.memberdecls .memTemplItemLeft, + table.memberdecls .memTemplItemRight, + table.memberdecls .memTemplParams { + display: block; + text-align: left; + padding-left: var(--spacing-large); + margin: 0 calc(0px - var(--spacing-large)) 0 calc(0px - var(--spacing-large)); + border-right: none; + border-left: none; + border-radius: 0; + white-space: normal; + } + + table.memberdecls .memItemLeft, + table.memberdecls .mdescLeft, + table.memberdecls .memTemplItemLeft { + border-bottom: 0; + padding-bottom: 0; + } + + table.memberdecls .memTemplItemLeft { + padding-top: 0; + } + + table.memberdecls .mdescLeft { + margin-bottom: calc(0px - var(--page-font-size)); + } + + table.memberdecls .memItemRight, + table.memberdecls .mdescRight, + table.memberdecls .memTemplItemRight { + border-top: 0; + padding-top: 0; + padding-right: var(--spacing-large); + overflow-x: auto; + } + + table.memberdecls tr[class^='memitem']:not(.inherit) { + display: block; + width: calc(100vw - 2 * var(--spacing-large)); + } + + table.memberdecls .mdescRight { + color: var(--page-foreground-color); + } + + table.memberdecls tr.inherit { + visibility: hidden; + } + + table.memberdecls tr[style="display: table-row;"] { + display: block !important; + visibility: visible; + width: calc(100vw - 2 * var(--spacing-large)); + animation: fade .5s; + } + + @keyframes fade { + 0% { + opacity: 0; + max-height: 0; + } + + 100% { + opacity: 1; + max-height: 200px; + } + } +} + + +/* + Horizontal Rule + */ + +hr { + margin-top: var(--spacing-large); + margin-bottom: var(--spacing-large); + height: 1px; + background-color: var(--separator-color); + border: 0; +} + +.contents hr { + box-shadow: 100px 0 0 var(--separator-color), + -100px 0 0 var(--separator-color), + 500px 0 0 var(--separator-color), + -500px 0 0 var(--separator-color), + 1500px 0 0 var(--separator-color), + -1500px 0 0 var(--separator-color), + 2000px 0 0 var(--separator-color), + -2000px 0 0 var(--separator-color); +} + +.contents img, .contents .center, .contents center, .contents div.image object { + max-width: 100%; + overflow: auto; +} + +@media screen and (max-width: 767px) { + .contents .dyncontent > .center, .contents > center { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + max-width: calc(100% + 2 * var(--spacing-large)); + } +} + +/* + Directories + */ +div.directory { + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + width: auto; +} + +table.directory { + font-family: var(--font-family); + font-size: var(--page-font-size); + font-weight: normal; + width: 100%; +} + +table.directory td.entry, table.directory td.desc { + padding: calc(var(--spacing-small) / 2) var(--spacing-small); + line-height: var(--table-line-height); +} + +table.directory tr.even td:last-child { + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; +} + +table.directory tr.even td:first-child { + border-radius: var(--border-radius-small) 0 0 var(--border-radius-small); +} + +table.directory tr.even:last-child td:last-child { + border-radius: 0 var(--border-radius-small) 0 0; +} + +table.directory tr.even:last-child td:first-child { + border-radius: var(--border-radius-small) 0 0 0; +} + +table.directory td.desc { + min-width: 250px; +} + +table.directory tr.even { + background-color: var(--odd-color); +} + +table.directory tr.odd { + background-color: transparent; +} + +.icona { + width: auto; + height: auto; + margin: 0 var(--spacing-small); +} + +.icon { + background: var(--primary-color); + border-radius: var(--border-radius-small); + font-size: var(--page-font-size); + padding: calc(var(--page-font-size) / 5); + line-height: var(--page-font-size); + transform: scale(0.8); + height: auto; + width: var(--page-font-size); + user-select: none; +} + +.iconfopen, .icondoc, .iconfclosed { + background-position: center; + margin-bottom: 0; + height: var(--table-line-height); +} + +.icondoc { + filter: saturate(0.2); +} + +@media screen and (max-width: 767px) { + div.directory { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) .iconfopen, html:not(.light-mode) .iconfclosed { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode .iconfopen, html.dark-mode .iconfclosed { + filter: hue-rotate(180deg) invert(); +} + +/* + Class list + */ + +.classindex dl.odd { + background: var(--odd-color); + border-radius: var(--border-radius-small); +} + +.classindex dl.even { + background-color: transparent; +} + +/* + Class Index Doxygen 1.8 +*/ + +table.classindex { + margin-left: 0; + margin-right: 0; + width: 100%; +} + +table.classindex table div.ah { + background-image: none; + background-color: initial; + border-color: var(--separator-color); + color: var(--page-foreground-color); + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-large); + padding: var(--spacing-small); +} + +div.qindex { + background-color: var(--odd-color); + border-radius: var(--border-radius-small); + border: 1px solid var(--separator-color); + padding: var(--spacing-small) 0; +} + +/* + Footer and nav-path + */ + +#nav-path { + width: 100%; +} + +#nav-path ul { + background-image: none; + background: var(--page-background-color); + border: none; + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + border-bottom: 0; + box-shadow: 0 0.75px 0 var(--separator-color); + font-size: var(--navigation-font-size); +} + +img.footer { + width: 60px; +} + +.navpath li.footer { + color: var(--page-secondary-foreground-color); +} + +address.footer { + color: var(--page-secondary-foreground-color); + margin-bottom: var(--spacing-large); +} + +#nav-path li.navelem { + background-image: none; + display: flex; + align-items: center; +} + +.navpath li.navelem a { + text-shadow: none; + display: inline-block; + color: var(--primary-color) !important; +} + +.navpath li.navelem b { + color: var(--primary-dark-color); + font-weight: 500; +} + +li.navelem { + padding: 0; + margin-left: -8px; +} + +li.navelem:first-child { + margin-left: var(--spacing-large); +} + +li.navelem:first-child:before { + display: none; +} + +#nav-path li.navelem:after { + content: ''; + border: 5px solid var(--page-background-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: translateY(-1px) scaleY(4.2); + z-index: 10; + margin-left: 6px; +} + +#nav-path li.navelem:before { + content: ''; + border: 5px solid var(--separator-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: translateY(-1px) scaleY(3.2); + margin-right: var(--spacing-small); +} + +.navpath li.navelem a:hover { + color: var(--primary-color); +} + +/* + Scrollbars for Webkit +*/ + +#nav-tree::-webkit-scrollbar, +div.fragment::-webkit-scrollbar, +pre.fragment::-webkit-scrollbar, +div.memproto::-webkit-scrollbar, +.contents center::-webkit-scrollbar, +.contents .center::-webkit-scrollbar, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar, +div.contents .toc::-webkit-scrollbar { + background: transparent; + width: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); + height: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); +} + +#nav-tree::-webkit-scrollbar-thumb, +div.fragment::-webkit-scrollbar-thumb, +pre.fragment::-webkit-scrollbar-thumb, +div.memproto::-webkit-scrollbar-thumb, +.contents center::-webkit-scrollbar-thumb, +.contents .center::-webkit-scrollbar-thumb, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-thumb, +div.contents .toc::-webkit-scrollbar-thumb { + background-color: transparent; + border: var(--webkit-scrollbar-padding) solid transparent; + border-radius: calc(var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); + background-clip: padding-box; +} + +#nav-tree:hover::-webkit-scrollbar-thumb, +div.fragment:hover::-webkit-scrollbar-thumb, +pre.fragment:hover::-webkit-scrollbar-thumb, +div.memproto:hover::-webkit-scrollbar-thumb, +.contents center:hover::-webkit-scrollbar-thumb, +.contents .center:hover::-webkit-scrollbar-thumb, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody:hover::-webkit-scrollbar-thumb, +div.contents .toc:hover::-webkit-scrollbar-thumb { + background-color: var(--webkit-scrollbar-color); +} + +#nav-tree::-webkit-scrollbar-track, +div.fragment::-webkit-scrollbar-track, +pre.fragment::-webkit-scrollbar-track, +div.memproto::-webkit-scrollbar-track, +.contents center::-webkit-scrollbar-track, +.contents .center::-webkit-scrollbar-track, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-track, +div.contents .toc::-webkit-scrollbar-track { + background: transparent; +} + +#nav-tree::-webkit-scrollbar-corner { + background-color: var(--side-nav-background); +} + +#nav-tree, +div.fragment, +pre.fragment, +div.memproto, +.contents center, +.contents .center, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, +div.contents .toc { + overflow-x: auto; + overflow-x: overlay; +} + +#nav-tree { + overflow-x: auto; + overflow-y: auto; + overflow-y: overlay; +} + +/* + Scrollbars for Firefox +*/ + +#nav-tree, +div.fragment, +pre.fragment, +div.memproto, +.contents center, +.contents .center, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, +div.contents .toc { + scrollbar-width: thin; +} + +/* + Optional Dark mode toggle button +*/ + +doxygen-awesome-dark-mode-toggle { + display: inline-block; + margin: 0 0 0 var(--spacing-small); + padding: 0; + width: var(--searchbar-height); + height: var(--searchbar-height); + background: none; + border: none; + border-radius: var(--searchbar-height); + vertical-align: middle; + text-align: center; + line-height: var(--searchbar-height); + font-size: 22px; + display: flex; + align-items: center; + justify-content: center; + user-select: none; + cursor: pointer; +} + +doxygen-awesome-dark-mode-toggle > svg { + transition: transform .1s ease-in-out; +} + +doxygen-awesome-dark-mode-toggle:active > svg { + transform: scale(.5); +} + +doxygen-awesome-dark-mode-toggle:hover { + background-color: rgba(0,0,0,.03); +} + +html.dark-mode doxygen-awesome-dark-mode-toggle:hover { + background-color: rgba(0,0,0,.18); +} + +/* + Optional fragment copy button +*/ +.doxygen-awesome-fragment-wrapper { + position: relative; +} + +doxygen-awesome-fragment-copy-button { + opacity: 0; + background: var(--fragment-background); + width: 28px; + height: 28px; + position: absolute; + right: calc(var(--spacing-large) - (var(--spacing-large) / 2.5)); + top: calc(var(--spacing-large) - (var(--spacing-large) / 2.5)); + border: 1px solid var(--fragment-foreground); + cursor: pointer; + border-radius: var(--border-radius-small); + display: flex; + justify-content: center; + align-items: center; +} + +.doxygen-awesome-fragment-wrapper:hover doxygen-awesome-fragment-copy-button, doxygen-awesome-fragment-copy-button.success { + opacity: .28; +} + +doxygen-awesome-fragment-copy-button:hover, doxygen-awesome-fragment-copy-button.success { + opacity: 1 !important; +} + +doxygen-awesome-fragment-copy-button:active:not([class~=success]) svg { + transform: scale(.91); +} + +doxygen-awesome-fragment-copy-button svg { + fill: var(--fragment-foreground); + width: 18px; + height: 18px; +} + +doxygen-awesome-fragment-copy-button.success svg { + fill: rgb(14, 168, 14); +} + +doxygen-awesome-fragment-copy-button.success { + border-color: rgb(14, 168, 14); +} + +@media screen and (max-width: 767px) { + .textblock > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .textblock li > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .memdoc li > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .memdoc > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + dl dd > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button { + right: 0; + } +} + +/* + Optional paragraph link button +*/ + +a.anchorlink { + font-size: 90%; + margin-left: var(--spacing-small); + color: var(--page-foreground-color) !important; + text-decoration: none; + opacity: .15; + display: none; + transition: opacity .1s ease-in-out, color .1s ease-in-out; +} + +a.anchorlink svg { + fill: var(--page-foreground-color); +} + +h3 a.anchorlink svg, h4 a.anchorlink svg { + margin-bottom: -3px; + margin-top: -4px; +} + +a.anchorlink:hover { + opacity: .45; +} + +h2:hover a.anchorlink, h1:hover a.anchorlink, h3:hover a.anchorlink, h4:hover a.anchorlink { + display: inline-block; +} + + +#MSearchBox .left { + background: none !important; +} +#MSearchBox .right { + background: none !important; +} From a89995b63f7598820e47c781f17541ab193a14f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2023 12:36:53 +0100 Subject: [PATCH 316/370] WIP Public virtual card --- htdocs/core/lib/functions.lib.php | 12 ++++++++---- htdocs/langs/en_US/main.lang | 3 ++- htdocs/main.inc.php | 20 ++++++++++++++------ htdocs/projet/card.php | 2 +- htdocs/public/users/view.php | 6 +++--- htdocs/user/card.php | 4 +--- htdocs/user/virtualcard.php | 1 + 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ac774209d30..e32cbc3ca9d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1731,11 +1731,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = * @param string $url Relative Url to open. For example '/project/card.php' * @param string $disabled Disabled text * @param string $morecss More CSS + * @param string $jsonopen Some JS code to execute on click/open of popup * @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect. * Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label' + * @param string $accesskey A key to use shortcut * @return string HTML component with button */ -function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $backtopagejsfields = '') +function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $jsonopen = '', $backtopagejsfields = '', $accesskey = '') { global $conf; @@ -1763,9 +1765,11 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di //print ''; $out .= ''; - $out .= 'use_javascript_ajax)) { $out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"'; + } elseif ($jsonopen) { + $out .= ' onclick="javascript:'.$jsonopen.'"'; } $out .= '>'.$buttonstring.''; @@ -2324,7 +2328,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi // Add alias for thirdparty if (!empty($object->name_alias)) { - $morehtmlref .= '
'.$object->name_alias.'
'; + $morehtmlref .= '
'.dol_escape_htmltag($object->name_alias).'
'; } // Add label @@ -2346,7 +2350,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) { $morehtmlref .= '
'; $morehtmlref .= '
'; - $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id; + $morehtmlref .= $langs->trans("TechnicalID").': '.((int) $object->id); $morehtmlref .= '
'; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index e747f004c87..daa01cfcfa4 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -226,6 +226,7 @@ NoUserGroupDefined=No user group defined Password=Password PasswordRetype=Repeat your password NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration. +YourUserFile=Your user file Name=Name NameSlashCompany=Name / Company Person=Person @@ -1213,4 +1214,4 @@ InternalUser=Internal user ExternalUser=External user NoSpecificContactAddress=No specific contact or address NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. - +AddToContacts=Add address to my contacts diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 17912f81101..a21082a8bc6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2280,12 +2280,14 @@ function top_menu_user($hideloginname = 0, $urllogout = '') if (empty($urllogout)) { $urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken(); } - $logoutLink = ' '.$langs->trans("Logout").''; - $profilLink = ' '.$langs->trans("Card").''; + // Defined the links for bottom of card + $profilLink = ' '.$langs->trans("Card").''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id); + $virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v'); + $logoutLink = ' '.$langs->trans("Logout").''; $profilName = $user->getFullName($langs).' ('.$user->login.')'; - if (!empty($user->admin)) { $profilName = ' '.$profilName; } @@ -2341,6 +2343,9 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
'.$profilLink.'
+
+ '.$virtuelcardLink.' +
'.$logoutLink.'
@@ -2363,12 +2368,15 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $btnUser .= ' '; @@ -111,7 +111,7 @@ print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; From 2f2c710a33b116f7ef0b86a73d062fde8f468e02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:34:59 +0100 Subject: [PATCH 355/370] Fix reposition when adding a contract line --- htdocs/contrat/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 79897cdc16d..12f53b49390 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2046,11 +2046,12 @@ if ($action == 'create') { $dateSelector = 1; print "\n"; - print '
+ print ' + '; print '
'; From 3769861a8adb54fd99306bf3f55f0508a4e3a921 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:46:11 +0100 Subject: [PATCH 356/370] NEW VAT can be modified during add of line --- htdocs/comm/propal/card.php | 27 +++++++------ htdocs/commande/card.php | 8 ++-- htdocs/compta/facture/card.php | 9 ++--- htdocs/contrat/card.php | 11 +++--- htdocs/core/class/html.form.class.php | 7 +--- htdocs/core/tpl/objectline_create.tpl.php | 35 ++++++++++++++++- htdocs/product/ajax/products.php | 48 ++++++++++++++--------- 7 files changed, 91 insertions(+), 54 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5fb464a6e8e..c2dcd19eb9b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -938,12 +938,12 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } + $tva_tx = GETPOST('tva_tx', 'alpha'); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); if (empty($remise_percent)) { @@ -992,6 +992,8 @@ if (empty($reshook)) { if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { $pu_ht = 0; $pu_ttc = 0; + $pu_ht_devise = 0; + $pu_ttc_devise = 0; $price_min = 0; $price_min_ttc = 0; $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); @@ -1002,7 +1004,6 @@ if (empty($reshook)) { // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit // Replaces $fk_unit with the product unit if (!empty($idprod) && $idprod > 0) { $prod = new Product($db); @@ -1011,11 +1012,11 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + /*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ // Price unique per product $pu_ht = $prod->price; @@ -1056,14 +1057,14 @@ if (empty($reshook)) { $price_min = price($prodcustprice->lines[0]->price_min); $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; - $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + /*$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; } $tva_npr = $prodcustprice->lines[0]->recuperableonly; if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ } } } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { @@ -1114,12 +1115,12 @@ if (empty($reshook)) { $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // Set unit price to use - if (!empty($price_ht) || $price_ht === '0') { + if (!empty($price_ht) || (string) $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } elseif (!empty($price_ttc) || $price_ttc === '0') { + $pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); + } elseif (!empty($price_ttc) || (string) $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { @@ -1416,12 +1417,12 @@ if (empty($reshook)) { //var_dump(price2num($price_min_ttc)); var_dump(price2num($pu_ttc)); var_dump($remise_percent);exit; if ($usermustrespectpricemin) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) { + if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { + } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ccf706c9ac7..c2ab4fcd3bc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -676,12 +676,11 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } + $tva_tx = GETPOST('tva_tx', 'alpha'); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; @@ -762,7 +761,6 @@ if (empty($reshook)) { // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit // Ecrase $base_price_type par celui du produit if (!empty($idprod) && $idprod > 0) { $prod = new Product($db); @@ -771,11 +769,11 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + /*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cc6b92f72cb..5f24ca87830 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2038,12 +2038,12 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } + $tva_tx = GETPOST('tva_tx', 'alpha'); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); if (empty($remise_percent)) { @@ -2137,7 +2137,6 @@ if (empty($reshook)) { // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit // Ecrase $base_price_type par celui du produit // Replaces $fk_unit with the product's if (!empty($idprod) && $idprod > 0) { @@ -2157,8 +2156,8 @@ if (empty($reshook)) { $price_min_ttc = $datapriceofproduct['price_min_ttc']; $price_base_type = $datapriceofproduct['price_base_type']; - $tva_tx = $datapriceofproduct['tva_tx']; - $tva_npr = $datapriceofproduct['tva_npr']; + //$tva_tx = $datapriceofproduct['tva_tx']; + //$tva_npr = $datapriceofproduct['tva_npr']; $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 12f53b49390..123366fd630 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -427,6 +427,7 @@ if (empty($reshook)) { } else { $idprod = GETPOST('idprod', 'int'); } + $tva_tx = GETPOST('tva_tx', 'alpha'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); @@ -474,11 +475,11 @@ if (empty($reshook)) { $prod->fetch($idprod); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + /*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ $price_min = $prod->price_min; $price_min_ttc = $prod->price_min_ttc; @@ -500,14 +501,14 @@ if (empty($reshook)) { if (count($prodcustprice->lines) > 0) { $price_min = price($prodcustprice->lines[0]->price_min); $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); - $tva_tx = $prodcustprice->lines[0]->tva_tx; + /*$tva_tx = $prodcustprice->lines[0]->tva_tx; if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; } $tva_npr = $prodcustprice->lines[0]->recuperableonly; if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ } } } @@ -699,7 +700,7 @@ if (empty($reshook)) { $date_end_real_update = $objectline->date_end_real; } - $vat_rate = GETPOST('eltva_tx'); + $vat_rate = GETPOST('eltva_tx', 'alpha'); // Define info_bits $info_bits = 0; if (preg_match('/\*/', $vat_rate)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1c54df24e06..369deba4455 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2344,11 +2344,7 @@ class Form } } // mode=1 means customers products - $urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; - //Price by customer - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { - $urloption .= '&socid='.$socid; - } + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); if (isModEnabled('variants') && is_array($selected_combinations)) { @@ -3247,6 +3243,7 @@ class Form // mode=2 means suppliers products $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').''; } else { print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 32a9f1cdaae..52761509890 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -40,6 +40,7 @@ if (empty($object) || !is_object($object)) { print "Error: this template page cannot be called directly as an URL"; exit; } + $usemargins = 0; if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { $usemargins = 1; @@ -48,6 +49,7 @@ if (!isset($dateSelector)) { global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) } global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; +global $mysoc; if (!isset($dateSelector)) { $dateSelector = 1; // For backward compatibility @@ -776,6 +778,35 @@ if (!empty($usemargins) && $user->rights->margins->creer) { var stringforvatrateselection = tva_tx; if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') { stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; + + console.log("MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code"); + console.log("mysoc->country_code=country_code; ?> thirdparty->country_code=thirdparty->country_code; ?>"); + new_default_vat_code = default_vat_code; + country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code == $object->thirdparty->state_code) { + // We are in India and states are same, we revert the vat code "I-x" into "CS-x" + ?> + console.log("Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code); + new_default_vat_code = default_vat_code.replace(/^I\-/, 'C+S-'); + country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code != $object->thirdparty->state_code) { + // We are in India and states differs, we revert the vat code "CS-x" into "I-x" + ?> + console.log("Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code); + new_default_vat_code = default_vat_code.replace(/^C\+S\-/, 'I-'); + + if (new_default_vat_code != default_vat_code && jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val()) { + console.log("We found en entry into VAT with new default_vat_code, we will use it"); + stringforvatrateselection = jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val(); + } + } // Set vat rate if field is an input box $('#tva_tx').val(tva_tx); @@ -1113,7 +1144,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { }); - /* Function to set fields from choice */ + /* Function to set fields visibility after selecting a free product */ function setforfree() { console.log("objectline_create.tpl::setforfree. We show most fields"); jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product @@ -1148,7 +1179,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#multicurrency_price_ttc").val('').hide(); jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); - jQuery("#tva_tx, #title_vat").hide(); + /* jQuery("#tva_tx, #title_vat").hide(); */ /* jQuery("#title_fourn_ref").hide(); */ jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index f61e92c56f3..e07aa4ab5c5 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -103,26 +103,36 @@ if ($action == 'fetch' && !empty($id)) { $price_level = 1; if ($socid > 0) { - $thirdpartytemp = new Societe($db); - $thirdpartytemp->fetch($socid); - - //Load translation description and label - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $newlang = $thirdpartytemp->default_lang; - - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; - $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; - } else { - $outdesc_trans = $object->description; - $outlabel_trans = $object->label; - } + $needchangeaccordingtothirdparty = 0; + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { + $needchangeaccordingtothirdparty = 1; } + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $needchangeaccordingtothirdparty = 1; + } + if ($needchangeaccordingtothirdparty) { + $thirdpartytemp = new Societe($db); + $thirdpartytemp->fetch($socid); - if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - $price_level = $thirdpartytemp->price_level; + //Load translation description and label according to thirdparty language + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { + $newlang = $thirdpartytemp->default_lang; + + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; + $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; + } else { + $outdesc_trans = $object->description; + $outlabel_trans = $object->label; + } + } + + //Set price level according to thirdparty + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $price_level = $thirdpartytemp->price_level; + } } } @@ -185,7 +195,7 @@ if ($action == 'fetch' && !empty($id)) { } // Price by customer - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($db); From 098e6c40759172bbb7e0d51305f246ad901ff3fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:49:51 +0100 Subject: [PATCH 357/370] Fix look and feel v17 --- htdocs/commande/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 98d2b59d6a3..9ef9072d16a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1526,16 +1526,16 @@ if ($resql) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; + print ''; } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; } // State if (!empty($arrayfields['state.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Country @@ -1723,18 +1723,18 @@ if ($resql) { } // Status billed if (!empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); print ''; } // Import key if (!empty($arrayfields['c.import_key']['checked'])) { - print ''; + print ''; print ''; } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; $liststatus = array( Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), @@ -1907,7 +1907,7 @@ if ($resql) { print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); @@ -2631,7 +2631,7 @@ if ($resql) { // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; if (!$i) { $totalarray['nbfield']++; } From c78ad19186f8c410b01a85678dc74db776fb6366 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 18:50:01 +0100 Subject: [PATCH 358/370] Fix warning php8 --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index e1afcc0c7a0..db076cd97b9 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -675,10 +675,18 @@ class pdf_azur extends ModelePDFPropales // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) { - $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) { + $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne; + } else { + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + } } if ($localtax2_type && $localtax2ligne != 0) { - $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) { + $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne; + } else { + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + } } if (($object->lines[$i]->info_bits & 0x01) == 0x01) { From 09a2028522f069acc032f36ee80d93b9dad8dc9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:27:56 +0100 Subject: [PATCH 359/370] Fix picto edit must not be visilbe in edit mode --- htdocs/core/tpl/objectline_title.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 7fe63613ea1..4640d710705 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -71,7 +71,7 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'vatforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; @@ -111,7 +111,7 @@ print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; From 00fce7eccd17d09074d1a6abb306d914b2b6217c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:34:59 +0100 Subject: [PATCH 360/370] Fix reposition when adding a contract line --- htdocs/contrat/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 38efdb3cca9..8af35072b93 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2046,11 +2046,12 @@ if ($action == 'create') { $dateSelector = 1; print "\n"; - print ' + print ' + '; print '
'; From 3c169ae09a96653be9c5d9bbf5c45c36b30810d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:49:51 +0100 Subject: [PATCH 361/370] Fix look and feel v17 --- htdocs/commande/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 42b71b14c86..93a0d302fbf 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1515,16 +1515,16 @@ if ($resql) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; + print ''; } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; } // State if (!empty($arrayfields['state.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Country @@ -1712,18 +1712,18 @@ if ($resql) { } // Status billed if (!empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); print ''; } // Import key if (!empty($arrayfields['c.import_key']['checked'])) { - print ''; + print ''; print ''; } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; $liststatus = array( Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), @@ -1896,7 +1896,7 @@ if ($resql) { print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); @@ -2604,7 +2604,7 @@ if ($resql) { // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; if (!$i) { $totalarray['nbfield']++; } From 313adba8f45382df6873c7749bb292192dd91d69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 22:06:03 +0100 Subject: [PATCH 362/370] Fix set job recruitement back to draft --- htdocs/recruitment/recruitmentjobposition_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index d1ca4ef2db1..34365e05792 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -401,7 +401,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print ''.$langs->trans("SetToDraft").''; + print ''.$langs->trans("SetToDraft").''; } } From 3e4da8a1c587dea5feb861ea23dc2f7caa94f125 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 22:25:41 +0100 Subject: [PATCH 363/370] Fix standardize code --- .../recruitmentjobposition_card.php | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 34365e05792..b33ce55808e 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -108,7 +108,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); } } } @@ -130,7 +130,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'RECRUITMENTJOBPOSITION_MODIFY'); + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOST('projectid', 'int')); @@ -257,8 +257,6 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals(); - $head = recruitmentjobpositionPrepareHead($object); print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentJobPosition"), -1, $object->picto); @@ -395,31 +393,27 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print ''.$langs->trans('SendMail').''."\n"; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print ''.$langs->trans("SetToDraft").''; + print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } } // Modify - if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; - } else { - print ''.$langs->trans('Modify').''."\n"; - } + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); } } } @@ -442,9 +436,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* if ($permissiontoadd) { if ($object->status == $object::STATUS_ENABLED) { - print ''.$langs->trans("Disable").''."\n"; + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); } else { - print ''.$langs->trans("Enable").''."\n"; + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd); + } } }*/ if ($permissiontoadd) { @@ -454,7 +449,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + $params = array(); + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params); } print '
'."\n"; } From c5a83972ca9e7c1234799c8a5005b30060e33c0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 23:47:47 +0100 Subject: [PATCH 364/370] Fix return warnings --- htdocs/core/class/stats.class.php | 2 +- htdocs/projet/class/projectstats.class.php | 12 ++++++------ htdocs/projet/class/taskstats.class.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index c8dbca747b9..60cdc5d5226 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -237,7 +237,7 @@ abstract class Stats /** * @param int $year year number - * @return int value + * @return array array of values */ protected abstract function getAverageByMonth($year); diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 65d673a9ad2..e2b6c5129ff 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -298,7 +298,7 @@ class ProjectStats extends Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $wonlostfilter Add a filter on status won/lost - * @return array Array of values + * @return array|int Array of values or <0 if error */ public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1) { @@ -411,10 +411,10 @@ class ProjectStats extends Stats /** * Return amount of elements by month for several years * - * @param int $endyear End year - * @param int $startyear Start year - * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) - * @return array of values + * @param int $endyear End year + * @param int $startyear Start year + * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) + * @return array|int Array of values or <0 if error */ public function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0) { @@ -549,7 +549,7 @@ class ProjectStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return int value + * @return array */ protected function getAverageByMonth($year) { diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index ce7c6c4f4c5..6ff56fd8132 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -212,7 +212,7 @@ class TaskStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return int value + * @return array array of values */ protected function getAverageByMonth($year) { From e50a56290cd73811e10306ef6dadb876214252e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 23:49:31 +0100 Subject: [PATCH 365/370] Fix warning --- htdocs/comm/propal/class/propal.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2b429d0e8d1..b0aa5dba54c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2903,7 +2903,7 @@ class Propal extends CommonObject * @param int $offset For pagination * @param string $sortfield Sort criteria * @param string $sortorder Sort order - * @return int -1 if KO, array with result if OK + * @return array|int -1 if KO, array with result if OK */ public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC') { @@ -2982,8 +2982,8 @@ class Propal extends CommonObject /** * Returns an array with id and ref of related invoices * - * @param int $id Id propal - * @return array Array of invoices id + * @param int $id Id propal + * @return array|int Array of invoices id */ public function InvoiceArrayList($id) { From 52f80737f593f7e199d106a4032adc2b0844e7ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 00:37:00 +0100 Subject: [PATCH 366/370] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 289f44333cc..b9e35e1e9ea 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -49,7 +49,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { --colortextbacktab: #; --colorboxiconbg: #eee; --refidnocolor:#444; - --tableforfieldcolor:#666; + --tableforfieldcolor:#888; --amountremaintopaycolor:#880000; --amountpaymentcomplete:#008800; --amountremaintopaybackcolor:none; From 33917e97b6bf5093cdaf80390d4d2e2b26ee16ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 01:12:08 +0100 Subject: [PATCH 367/370] NEW Increment website counter on each page access in website module --- htdocs/core/lib/website.lib.php | 27 +++++++++++++++++++++++++++ htdocs/core/lib/website2.lib.php | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index c258e3198ce..32a6d9d962a 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -423,6 +423,33 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') print $content; } +/** + * Increase the website counter of page access. + * + * @param int $websiteid ID of website + * @param string $websitepagetype Type of page ('blogpost', 'page', ...) + * @param int $websitepageid ID of page + * @return int <0 if KO, >0 if OK + */ +function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid) +{ + if (!getDolGlobalInt('WEBSITE_PERF_DISABLE_COUNTERS')) { + //dol_syslog("dolWebsiteIncrementCounter websiteid=".$websiteid." websitepagetype=".$websitepagetype." websitepageid=".$websitepageid); + if (in_array($websitepagetype, array('blogpost', 'page'))) { + global $db; + + $sql = "UPDATE ".$db->prefix()."website SET pageviews_total = pageviews_total + 1, lastaccess = '".$db->idate(dol_now())."'"; + $sql .= " WHERE rowid = ".((int) $websiteid); + $resql = $db->query($sql); + if (! $resql) { + return -1; + } + } + } + + return 1; +} + /** * Format img tags to introduce viewimage on img src. diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 05727a1e539..c7099e8d2ed 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -271,7 +271,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ''."\n"; $tplcontent .= 'id.');'."\n"; + $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.'); dolWebsiteIncrementCounter('.$object->id.', "'.$objectpage->type_container.'", '.$objectpage->id.');'."\n"; $tplcontent .= "// END PHP ?>\n"; //var_dump($filetpl);exit; From 8f5edcab02d45dcfaa84200013d36c9fad807be9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 11 Jan 2023 06:11:41 +0100 Subject: [PATCH 368/370] Use isModEnabled() --- htdocs/bookcal/class/booking.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/menus/init_menu_auguria.sql | 42 +++++++++---------- .../class/conferenceorbooth.class.php | 2 +- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- .../class/fournisseur.facture-rec.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 2 +- .../template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 16 files changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/bookcal/class/booking.class.php b/htdocs/bookcal/class/booking.class.php index a74cb87a43d..51799fa09da 100644 --- a/htdocs/bookcal/class/booking.class.php +++ b/htdocs/bookcal/class/booking.class.php @@ -104,7 +104,7 @@ class Booking extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1.2, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1b3df25c7d2..596e6e708aa 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -301,7 +301,7 @@ class Propal extends CommonObject 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>23), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 73988594e6f..f6b304a7a52 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -306,7 +306,7 @@ class Commande extends CommonOrder 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26), 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25), 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a586dfc3e5..6d7d2117147 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30), //'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4352364452b..cc9f3319a5d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -232,7 +232,7 @@ class Contrat extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>70), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75), 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e6fc16a62d6..0308d52f67d 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -12,7 +12,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- Top-Menu -- old: (module, enabled, rowid, ...) insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '(isModEnabled("societe") && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->project->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); @@ -83,36 +83,36 @@ 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 ('', '$leftmenu=="users"', __HANDLER__, 'left', 408__+MAX_llx_menu__, 'home', '', 407__+MAX_llx_menu__, '/user/group/card.php?mainmenu=home&leftmenu=users&action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__); -- Third parties -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->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 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->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->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->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->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->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 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->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 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->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->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 ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->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 ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -- Third parties - Contacts -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->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 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->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->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->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->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->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->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->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->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 ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->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 ('', 'isModEnabled("societe")', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); -- Third parties - Category customer -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->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->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->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 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 ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->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 ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category supplier insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->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 ('', '(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category contact -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->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->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->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 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 ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->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 ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Product - Product 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->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__); diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index cdb67a2c37b..2d7d56ec65d 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -106,7 +106,7 @@ class ConferenceOrBooth extends ActionComm 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 595eaf67eeb..f1e4fe2f3d5 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -108,7 +108,7 @@ class ConferenceOrBoothAttendee extends CommonObject 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index e36598d04bc..a7c3e43f599 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -38,7 +38,7 @@ class Fichinter extends CommonObject { public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>20), 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4fc242bdbcc..0cfff5a8297 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -254,7 +254,7 @@ class CommandeFournisseur extends CommonOrder 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>235), 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>240), 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>1, 'notnull'=>1, 'position'=>46), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>1, 'notnull'=>1, 'position'=>46), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), 'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700), diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 738e27a84e9..53066afc0b7 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -181,7 +181,7 @@ class FactureFournisseurRec extends CommonInvoice 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'ref_supplier' =>array('type'=>'varchar(180)', 'label'=>'RefSupplier', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>20), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>30), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>30), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>35), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index adf9fac3bde..524b50a5061 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -275,7 +275,7 @@ class FactureFournisseur extends CommonInvoice 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>30), 'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>40), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'datef' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>55), diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2fe7d983513..086420ef653 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -119,7 +119,7 @@ class MyObject extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 8624713c689..1aaf51808b8 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -106,7 +106,7 @@ class Mo extends CommonObject 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 7a9d077f910..fb34e33376e 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -124,7 +124,7 @@ class RecruitmentJobPosition extends CommonObject 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php:t.statut = 1', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'isModEnabled("societe")', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,), 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 2aacffefcd1..ac6abea95d3 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -280,7 +280,7 @@ class Ticket extends CommonObject 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'csslist'=>'maxwidth125 tdoverflowmax50'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100 tdoverflowmax200'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), //'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ? From 62d33484715766b6c22ef3788327cc27d2d3052d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 16:56:06 +0100 Subject: [PATCH 369/370] Make module Paybox deprecated --- htdocs/core/modules/modPaybox.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php index cf6ef512873..3df0b8f6a1d 100644 --- a/htdocs/core/modules/modPaybox.class.php +++ b/htdocs/core/modules/modPaybox.class.php @@ -54,7 +54,7 @@ class modPayBox extends DolibarrModules // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Module to offer an online payment page by credit card with PayBox"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; + $this->version = 'dolibarr_deprecated'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. From 2eb054a170fcc4706ab42a94c0a0e569efde6d1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 17:06:23 +0100 Subject: [PATCH 370/370] Fix try fix function not found of qodana --- htdocs/api/index.php | 12 ++++++------ htdocs/core/class/dolgeoip.class.php | 6 ++++-- htdocs/core/class/translate.class.php | 6 ++++-- htdocs/core/lib/files.lib.php | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index ba195b82c08..4e4da2c94cc 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -389,13 +389,13 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING'])); $foundonealgorithm = 0; if ($usecompression) { - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress')) { $foundonealgorithm++; } - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) { $foundonealgorithm++; } - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) { $foundonealgorithm++; } if (!$foundonealgorithm) { @@ -413,13 +413,13 @@ $result = $api->r->handle(); if (Luracast\Restler\Defaults::$returnResponse) { // We try to compress the data received data - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress') && defined('BROTLI_TEXT')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress') && defined('BROTLI_TEXT')) { header('Content-Encoding: br'); $result = brotli_compress($result, 11, constant('BROTLI_TEXT')); - } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) { + } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) { header('Content-Encoding: bz'); $result = bzcompress($result, 9); - } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) { + } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) { header('Content-Encoding: gzip'); $result = gzencode($result, 9); } else { diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index a2eea7023d9..e5001270131 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -144,10 +144,12 @@ class DolGeoIP return ''; } } else { - if (!function_exists('geoip_country_code_by_addr_v6')) { + if (function_exists('geoip_country_code_by_addr_v6')) { + return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); + } elseif (function_exists('geoip_country_code_by_name_v6')) { return strtolower(geoip_country_code_by_name_v6($this->gi, $ip)); } - return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); + return ''; } } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 3f2f756977d..2315428b37a 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -932,8 +932,10 @@ class Translate $fonc = 'numberwords'; if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) { include_once $newdir.'/functions_'.$fonc.'.lib.php'; - $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount); - break; + if (function_exists('numberwords_getLabelFromNumber')) { + $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount); + break; + } } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ad7d7cecfa5..207f5bafeb7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2058,13 +2058,13 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile); $data = implode("", file(dol_osencode($inputfile))); - if ($mode == 'gz') { + if ($mode == 'gz' && function_exists('gzencode')) { $foundhandler = 1; $compressdata = gzencode($data, 9); - } elseif ($mode == 'bz') { + } elseif ($mode == 'bz' && function_exists('bzcompress')) { $foundhandler = 1; $compressdata = bzcompress($data, 9); - } elseif ($mode == 'zstd') { + } elseif ($mode == 'zstd' && function_exists('zstd_compress')) { $foundhandler = 1; $compressdata = zstd_compress($data, 9); } elseif ($mode == 'zip') {