From 9957b8aed5a1a7863c4d9992d6190c870acaeea3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 15 Apr 2019 09:07:36 +0200 Subject: [PATCH 001/409] WIP - FEC - Validate --- htdocs/accountancy/closure/index.html | 0 htdocs/accountancy/closure/index.php | 416 ++++++++++++++++++++++++ htdocs/core/menus/standard/eldy.lib.php | 13 +- 3 files changed, 427 insertions(+), 2 deletions(-) create mode 100644 htdocs/accountancy/closure/index.html create mode 100644 htdocs/accountancy/closure/index.php diff --git a/htdocs/accountancy/closure/index.html b/htdocs/accountancy/closure/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php new file mode 100644 index 00000000000..9786734ab82 --- /dev/null +++ b/htdocs/accountancy/closure/index.php @@ -0,0 +1,416 @@ + + * + * 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/accountancy/customer/index.php + * \ingroup Accountancy + * \brief Home closure page + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("compta","bills","other","main","accountancy")); + +// Security check +if (empty($conf->accounting->enabled)) { + accessforbidden(); +} +if ($user->societe_id > 0) + accessforbidden(); +if (! $user->rights->accounting->closure->read) + accessforbidden(); + + +$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1); +if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); +else +{ + $year_start = dol_print_date(dol_now(), '%Y'); + if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year +} +$year_end = $year_start + 1; +$month_end = $month_start - 1; +if ($month_end < 1) +{ + $month_end = 12; + $year_end--; +} +$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start); +$search_date_end = dol_get_last_day($year_end, $month_end); +$year_current = $year_start; + +// Validate History +$action = GETPOST('action', 'aZ09'); + + +/* + * Actions + */ + +if ($action == 'clean' || $action == 'validatehistory') +{ + // Clean database + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; + $sql1 .= " SET fk_code_ventilation = 0"; + $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN'; + $sql1 .= ' (SELECT accnt.rowid '; + $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; + $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; + $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ' AND accnt.entity = '.$conf->entity.')'; + $sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture WHERE entity = '.$conf->entity.')'; + $sql1 .= ' AND fk_code_ventilation <> 0'; + + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } else { + $db->commit(); + } + // End clean database +} + +if ($action == 'validatehistory') { + + $error = 0; + $db->begin(); + + // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind + if ($db->type == 'pgsql') { + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; + $sql1 .= " SET fk_code_ventilation = accnt.rowid"; + $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; + $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; + $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; + $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0"; + } else { + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; + $sql1 .= " SET fk_code_ventilation = accnt.rowid"; + $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; + $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; + $sql1 .= " AND fd.fk_code_ventilation = 0"; + } + + dol_syslog('htdocs/accountancy/customer/index.php'); + + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } else { + $db->commit(); + setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); + } +} + + +/* + * View + */ + +llxHeader('', $langs->trans("CustomersVentilation")); + +$textprevyear = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; + + +print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); + +print $langs->trans("DescVentilCustomer") . '
'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; +print '
'; + + +$y = $year_current; + +$buttonbind = '' . $langs->trans("ValidateHistory") . ''; + +print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); + +print '
'; +print ''; +print ''; +print ''; +for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + print ''; +} +print ''; + +$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,"; +$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,"; +for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; +} +$sql .= " SUM(fd.total_ht) as total"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; +$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; +$sql .= " AND f.fk_statut > 0"; +$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy +$sql .= " AND aa.account_number IS NULL"; +if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; +} else { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; +} +$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; + +dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG); +$resql = $db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); + + while ( $row = $db->fetch_row($resql)) { + + print ''; + print ''; + for($i = 2; $i <= 12; $i ++) { + print ''; + } + print ''; + print ''; + print ''; + } + $db->free($resql); +} else { + print $db->lasterror(); // Show last sql error +} +print "
' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
'; + if ($row[0] == 'tobind') + { + print $langs->trans("Unknown"); + } + else print length_accountg($row[0]); + print ''; + if ($row[0] == 'tobind') + { + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); + } + else print $row[1]; + print '' . price($row[$i]) . '' . price($row[13]) . '' . price($row[14]) . '
\n"; +print '
'; + + +print '
'; + + +print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); + +print '
'; +print ''; +print ''; +print ''; +for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + print ''; +} +print ''; + +$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,"; +$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,"; +for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; +} +$sql .= " SUM(fd.total_ht) as total"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; +$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; +$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy +$sql .= " AND f.fk_statut > 0"; +if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; +} else { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; +} +$sql .= " AND aa.account_number IS NOT NULL"; +$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; + +dol_syslog('htdocs/accountancy/customer/index.php'); +$resql = $db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); + + while ( $row = $db->fetch_row($resql)) { + + print ''; + + print ''; + + for($i = 2; $i <= 12; $i++) { + print ''; + } + print ''; + print ''; + print ''; + } + $db->free($resql); +} else { + print $db->lasterror(); // Show last sql error +} +print "
' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
'; + if ($row[0] == 'tobind') + { + print $langs->trans("Unknown"); + } + else print length_accountg($row[0]); + print ''; + if ($row[0] == 'tobind') + { + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); + } + else print $row[1]; + print '' . price($row[$i]) . '' . price($row[13]) . '' . price($row[14]) . '
\n"; +print '
'; + + +if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ? +{ + print '
'; + print '
'; + + print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); + //print load_fiche_titre($langs->trans("OtherInfo"), '', ''); + + print '
'; + print ''; + print ''; + for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + print ''; + } + print ''; + + $sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,"; + for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; + } + $sql .= " SUM(fd.total_ht) as total"; + $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; + $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; + $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; + $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy + $sql .= " AND f.fk_statut > 0"; + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; + } else { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; + } + + dol_syslog('htdocs/accountancy/customer/index.php'); + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + + while ($row = $db->fetch_row($resql)) { + print ''; + for($i = 1; $i <= 12; $i ++) { + print ''; + } + print ''; + print ''; + } + $db->free($resql); + } else { + print $db->lasterror(); // Show last sql error + } + print "
' . $langs->trans("TotalVente") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[$i]) . '' . price($row[13]) . '
\n"; + print '
'; + + + if (! empty($conf->margin->enabled)) { + print "
\n"; + print '
'; + print ''; + print ''; + for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + print ''; + } + print ''; + + $sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,"; + for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; + } + $sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total"; + $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; + $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; + $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; + $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy + $sql .= " AND f.fk_statut > 0"; + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; + } else { + $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; + } + + dol_syslog('htdocs/accountancy/customer/index.php'); + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + + while ($row = $db->fetch_row($resql)) { + + print ''; + for($i = 1; $i <= 12; $i ++) { + print ''; + } + print ''; + print ''; + } + $db->free($resql); + } else { + print $db->lasterror(); // Show last sql error + } + print "
' . $langs->trans("TotalMarge") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price(price2num($row[$i])) . '' . price(price2num($row[13])) . '
\n"; + print '
'; + } +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7491556bebd..9382e3d4984 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1303,9 +1303,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); } @@ -1335,6 +1335,15 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } } + // Closure + if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("Closure"), 1, $user->rights->accounting->closure->read, '', $mainmenu, 'closure'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_closure/', $leftmenu)) { + $newmenu->add("/accountancy/closure/validation.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->closure->read); + } + } + // Accountancy (simple) if (! empty($conf->comptabilite->enabled)) { From d7abad4566ee63b1879fdad75664320e0160ef8e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 29 Apr 2019 17:40:59 +0200 Subject: [PATCH 002/409] NEW : mass email action on invoice list use billing contact if exists --- htdocs/core/actions_massactions.inc.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 55dda5a5934..819683af55e 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -70,6 +70,7 @@ if (! $error && $massaction == 'confirm_presend') $listofobjectid=array(); $listofobjectthirdparties=array(); + $listofobjectcontacts = array(); $listofobjectref=array(); if (! $error) @@ -94,6 +95,16 @@ if (! $error && $massaction == 'confirm_presend') if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user; if (empty($thirdpartyid)) $thirdpartyid=0; + if ($objectclass == 'Facture') { + $tmparraycontact = array(); + $tmparraycontact = $objecttmp->liste_contact(-1, 'external', 0, 'BILLING'); + if (is_array($tmparraycontact) && count($tmparraycontact) > 0) { + foreach ($tmparraycontact as $data_email) { + $listofobjectcontacts[$toselectid][$data_email['id']] = $data_email['email']; + } + } + } + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; } @@ -216,7 +227,7 @@ if (! $error && $massaction == 'confirm_presend') $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; continue; // Payment done or started or canceled } - if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT) + if ($objectclass == 'Commande' && $objectobj->statut == Commande::STATUS_DRAFT) { $langs->load("errors"); $nbignored++; @@ -245,6 +256,16 @@ if (! $error && $massaction == 'confirm_presend') $fuser = new User($db); $fuser->fetch($objectobj->fk_user); $sendto = $fuser->email; + } elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) { + $emails_to_sends = array(); + $objectobj->fetch_thirdparty(); + foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) { + + $emails_to_sends[] = $objectobj->thirdparty->contact_get_property((int)$contactemailid, 'email'); + } + if (count($emails_to_sends) > 0) { + $sendto = implode(',', $emails_to_sends); + } } else { From 8dc494890a8514ba5f988cf62bc9434ed07dcbbe Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 3 May 2019 16:24:25 +0200 Subject: [PATCH 003/409] =?UTF-8?q?=09modifi=C3=A9=C2=A0:=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20../core/actions=5Fmassactions.inc.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ef76611359a..2a0795a60ed 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -261,7 +261,7 @@ if (! $error && $massaction == 'confirm_presend') $objectobj->fetch_thirdparty(); foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) { - $emails_to_sends[] = $objectobj->thirdparty->contact_get_property((int)$contactemailid, 'email'); + $emails_to_sends[] = $objectobj->thirdparty->contact_get_property((int) $contactemailid, 'email'); } if (count($emails_to_sends) > 0) { $sendto = implode(',', $emails_to_sends); From 7af203e519b0fe7cd4b5963dcf914cd303326b8d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 3 May 2019 16:28:44 +0200 Subject: [PATCH 004/409] =?UTF-8?q?=09modifi=C3=A9=C2=A0:=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20../core/actions=5Fmassactions.inc.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/actions_massactions.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2a0795a60ed..26e168c3dc6 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -72,6 +72,7 @@ if (! $error && $massaction == 'confirm_presend') $listofobjectthirdparties=array(); $listofobjectcontacts = array(); $listofobjectref=array(); + $contactidtosend=array(); if (! $error) { @@ -259,9 +260,13 @@ if (! $error && $massaction == 'confirm_presend') } elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) { $emails_to_sends = array(); $objectobj->fetch_thirdparty(); + $contactidtosend=array(); foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) { - $emails_to_sends[] = $objectobj->thirdparty->contact_get_property((int) $contactemailid, 'email'); + $emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid, 'email'); + if (!in_array($contactemailid, $contactidtosend)) { + $contactidtosend[] = $contactemailid; + } } if (count($emails_to_sends) > 0) { $sendto = implode(',', $emails_to_sends); @@ -480,7 +485,7 @@ if (! $error && $massaction == 'confirm_presend') $actionmsg2=''; // Initialisation donnees - $objectobj2->sendtoid = 0; + $objectobj2->sendtoid = (empty($contactidtosend)?0:$contactidtosend); $objectobj2->actionmsg = $actionmsg; // Long text $objectobj2->actionmsg2 = $actionmsg2; // Short text $objectobj2->fk_element = $objid2; From 4e16992796061f3c4a0f051dfd721934a93b6f00 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 5 May 2019 14:07:42 +0200 Subject: [PATCH 005/409] WIP --- htdocs/accountancy/closure/index.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- htdocs/core/modules/modAccounting.class.php | 8 ++++++++ htdocs/langs/en_US/accountancy.lang | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 9786734ab82..8d2b93ccb6f 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -36,7 +36,7 @@ if (empty($conf->accounting->enabled)) { } if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->closure->read) +if (! $user->rights->accounting->fiscalyear->closure) accessforbidden(); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6e935d4bc49..0ccd2b671a1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1304,10 +1304,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Closure if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { - $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("Closure"), 1, $user->rights->accounting->closure->read, '', $mainmenu, 'closure'); + $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->closure, '', $mainmenu, 'closure'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_closure/', $leftmenu)) { - $newmenu->add("/accountancy/closure/validation.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->closure->read); + $newmenu->add("/accountancy/closure/validation.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->closure); } } diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 8250549b9e1..54187b16d6c 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -228,6 +228,14 @@ class modAccounting extends DolibarrModules $this->rights[$r][5] = ''; $r++; + $this->rights[$r][0] = 50431; + $this->rights[$r][1] = 'Validate movements of a fiscal year'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'fiscalyear'; + $this->rights[$r][5] = 'closure'; + $r++; + // Menus //------- diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index a2195784bef..ffc097f23a0 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -97,6 +97,8 @@ MenuExpenseReportAccounts=Expense report accounts MenuLoanAccounts=Loan accounts MenuProductsAccounts=Product accounts MenuClosureAccounts=Closure accounts +MenuAccountancyClosure=Closure +MenuAccountancyValidationMovements=Validate movements ProductsBinding=Products accounts TransferInAccounting=Transfer in accounting RegistrationInAccounting=Registration in accounting From b30929af6d7d63344d9a003d11ce4b3f1247eef7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 6 May 2019 11:05:00 +0200 Subject: [PATCH 006/409] WIP --- htdocs/accountancy/closure/index.php | 217 +-------------------------- 1 file changed, 2 insertions(+), 215 deletions(-) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 8d2b93ccb6f..25fdf013f9a 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/accountancy/customer/index.php + * \file htdocs/accountancy/closure/index.php * \ingroup Accountancy * \brief Home closure page */ @@ -140,7 +140,6 @@ $textnextyear = ' trans("DescVentilCustomer") . '
'; -print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; print '
'; @@ -149,12 +148,9 @@ $y = $year_current; $buttonbind = '
' . $langs->trans("ValidateHistory") . ''; print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); -//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print '
'; print ''; -print ''; -print ''; for($i = 1; $i <= 12; $i ++) { $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; if ($j > 12) $j-=12; @@ -178,11 +174,6 @@ $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; $sql .= " AND f.fk_statut > 0"; $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy $sql .= " AND aa.account_number IS NULL"; -if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; -} else { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; -} $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG); @@ -192,20 +183,7 @@ if ($resql) { while ( $row = $db->fetch_row($resql)) { - print ''; - print ''; + print ''; for($i = 2; $i <= 12; $i ++) { print ''; } @@ -220,197 +198,6 @@ if ($resql) { print "
' . $langs->trans("Account") . '' . $langs->trans("Label") . '
'; - if ($row[0] == 'tobind') - { - print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); - print ''; - if ($row[0] == 'tobind') - { - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; - print '
' . price($row[$i]) . '
\n"; print '
'; - -print '
'; - - -print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); -//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); - -print '
'; -print ''; -print ''; -print ''; -for($i = 1; $i <= 12; $i ++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; - if ($j > 12) $j-=12; - print ''; -} -print ''; - -$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,"; -$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,"; -for($i = 1; $i <= 12; $i ++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; - if ($j > 12) $j-=12; - $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; -} -$sql .= " SUM(fd.total_ht) as total"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; -$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; -$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy -$sql .= " AND f.fk_statut > 0"; -if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; -} else { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; -} -$sql .= " AND aa.account_number IS NOT NULL"; -$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; - -dol_syslog('htdocs/accountancy/customer/index.php'); -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - - while ( $row = $db->fetch_row($resql)) { - - print ''; - - print ''; - - for($i = 2; $i <= 12; $i++) { - print ''; - } - print ''; - print ''; - print ''; - } - $db->free($resql); -} else { - print $db->lasterror(); // Show last sql error -} -print "
' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
'; - if ($row[0] == 'tobind') - { - print $langs->trans("Unknown"); - } - else print length_accountg($row[0]); - print ''; - if ($row[0] == 'tobind') - { - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); - } - else print $row[1]; - print '' . price($row[$i]) . '' . price($row[13]) . '' . price($row[14]) . '
\n"; -print '
'; - - -if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ? -{ - print '
'; - print '
'; - - print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); - //print load_fiche_titre($langs->trans("OtherInfo"), '', ''); - - print '
'; - print ''; - print ''; - for($i = 1; $i <= 12; $i ++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; - if ($j > 12) $j-=12; - print ''; - } - print ''; - - $sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,"; - for($i = 1; $i <= 12; $i ++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; - if ($j > 12) $j-=12; - $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; - } - $sql .= " SUM(fd.total_ht) as total"; - $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; - $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; - $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; - $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy - $sql .= " AND f.fk_statut > 0"; - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; - } else { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; - } - - dol_syslog('htdocs/accountancy/customer/index.php'); - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - - while ($row = $db->fetch_row($resql)) { - print ''; - for($i = 1; $i <= 12; $i ++) { - print ''; - } - print ''; - print ''; - } - $db->free($resql); - } else { - print $db->lasterror(); // Show last sql error - } - print "
' . $langs->trans("TotalVente") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[$i]) . '' . price($row[13]) . '
\n"; - print '
'; - - - if (! empty($conf->margin->enabled)) { - print "
\n"; - print '
'; - print ''; - print ''; - for($i = 1; $i <= 12; $i ++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; - if ($j > 12) $j-=12; - print ''; - } - print ''; - - $sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,"; - for($i = 1; $i <= 12; $i ++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; - if ($j > 12) $j-=12; - $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; - } - $sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total"; - $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; - $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; - $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; - $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy - $sql .= " AND f.fk_statut > 0"; - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; - } else { - $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; - } - - dol_syslog('htdocs/accountancy/customer/index.php'); - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - - while ($row = $db->fetch_row($resql)) { - - print ''; - for($i = 1; $i <= 12; $i ++) { - print ''; - } - print ''; - print ''; - } - $db->free($resql); - } else { - print $db->lasterror(); // Show last sql error - } - print "
' . $langs->trans("TotalMarge") . '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price(price2num($row[$i])) . '' . price(price2num($row[13])) . '
\n"; - print '
'; - } -} - // End of page llxFooter(); $db->close(); From 876e1147d134386d87aff4ad74e096f29aa0558e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 18 May 2019 09:41:29 +0200 Subject: [PATCH 007/409] WIP Correct right on fiscal year --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 0ccd2b671a1..d0962f454be 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1317,8 +1317,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10); // Fiscal year - Not really yet used. In a future will lock some periods. - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear', 20); + if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'fiscalyear', 20); } $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); From 65070afce447d2ad7d728d1f6063b2759347bc91 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 22 May 2019 17:22:49 +0200 Subject: [PATCH 008/409] WIP --- htdocs/accountancy/closure/index.php | 103 +++----------------- htdocs/core/menus/standard/eldy.lib.php | 4 +- htdocs/core/modules/modAccounting.class.php | 2 +- htdocs/langs/en_US/accountancy.lang | 4 + 4 files changed, 23 insertions(+), 90 deletions(-) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 25fdf013f9a..f060be19440 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2019 Open-DSI * * 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 @@ -58,96 +58,32 @@ $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start); $search_date_end = dol_get_last_day($year_end, $month_end); $year_current = $year_start; -// Validate History -$action = GETPOST('action', 'aZ09'); - - /* * Actions */ -if ($action == 'clean' || $action == 'validatehistory') -{ - // Clean database - $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql1 .= " SET fk_code_ventilation = 0"; - $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN'; - $sql1 .= ' (SELECT accnt.rowid '; - $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; - $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; - $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ' AND accnt.entity = '.$conf->entity.')'; - $sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture WHERE entity = '.$conf->entity.')'; - $sql1 .= ' AND fk_code_ventilation <> 0'; - - dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); - } else { - $db->commit(); - } - // End clean database -} - -if ($action == 'validatehistory') { - - $error = 0; - $db->begin(); - - // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - if ($db->type == 'pgsql') { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; - $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; - $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0"; - } else { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; - $sql1 .= " AND fd.fk_code_ventilation = 0"; - } - - dol_syslog('htdocs/accountancy/customer/index.php'); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); - } else { - $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); - } -} - /* * View */ -llxHeader('', $langs->trans("CustomersVentilation")); +llxHeader('', $langs->trans("Closure")); $textprevyear = '' . img_previous() . ''; $textnextyear = ' ' . img_next() . ''; -print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); +print load_fiche_titre($langs->trans("Closure") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); -print $langs->trans("DescVentilCustomer") . '
'; +print $langs->trans("DescClosure") . '
'; print '
'; $y = $year_current; -$buttonbind = '' . $langs->trans("ValidateHistory") . ''; +$buttonbind = '' . $langs->trans("ValidateMovements") . ''; -print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); +print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print '
'; print ''; @@ -158,25 +94,19 @@ for($i = 1; $i <= 12; $i ++) { } print ''; -$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,"; -$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,"; +$sql = "SELECT COUNT(b.rowid) as detail,"; for($i = 1; $i <= 12; $i ++) { $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; if ($j > 12) $j-=12; - $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; + $sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; } -$sql .= " SUM(fd.total_ht) as total"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; -$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; -$sql .= " AND f.fk_statut > 0"; -$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy -$sql .= " AND aa.account_number IS NULL"; -$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= " COUNT(b.rowid) as total"; +$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; +$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'"; +$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'"; +$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy -dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG); +dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -184,11 +114,10 @@ if ($resql) { while ( $row = $db->fetch_row($resql)) { print ''; - for($i = 2; $i <= 12; $i ++) { + for($i = 1; $i <= 12; $i ++) { print ''; } - print ''; - print ''; + print ''; print ''; } $db->free($resql); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 47ff76d6b56..a432069c9fa 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1298,7 +1298,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->closure, '', $mainmenu, 'closure'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_closure/', $leftmenu)) { - $newmenu->add("/accountancy/closure/validation.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->closure); + $newmenu->add("/accountancy/closure/validate.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->closure); } } @@ -1309,7 +1309,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Fiscal year - Not really yet used. In a future will lock some periods. if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'fiscalyear', 20); + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20); } $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 956f7ea24fc..d1a9de7bef4 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -225,7 +225,7 @@ class modAccounting extends DolibarrModules $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'fiscalyear'; - $this->rights[$r][5] = ''; + $this->rights[$r][5] = 'write'; $r++; $this->rights[$r][0] = 50431; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 17bbfc41f66..01c5752f4b5 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -242,6 +242,10 @@ DescVentilExpenseReport=Consult here the list of expense report lines bound (or DescVentilExpenseReportMore=If you setup accounting account on type of expense report lines, the application will be able to make all the binding between your expense report lines and the accounting account of your chart of accounts, just in one click with the button "%s". If account was not set on fees dictionary or if you still have some lines not bound to any account, you will have to make a manual binding from the menu "%s". DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account +DescClosure=Consult here the number of movements by month who are not validated & fiscal years already open +OverviewOfMovementsNotValidated=Step 1/ Overview of movements not validated. (Necessary to close a fiscal year) +ValidateMovements=Validate movements + ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic binding done From d4384f507d48c6f92d276de930d0110d86a419e1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 23 May 2019 09:25:09 +0200 Subject: [PATCH 009/409] WIP --- htdocs/accountancy/closure/index.php | 4 +- htdocs/accountancy/closure/validate.php | 158 ++++++++++++++++++++++++ htdocs/langs/en_US/accountancy.lang | 2 + 3 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 htdocs/accountancy/closure/validate.php diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index f060be19440..1c9fa255fed 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -115,9 +115,9 @@ if ($resql) { print ''; for($i = 1; $i <= 12; $i ++) { - print ''; + print ''; } - print ''; + print ''; print ''; } $db->free($resql); diff --git a/htdocs/accountancy/closure/validate.php b/htdocs/accountancy/closure/validate.php new file mode 100644 index 00000000000..7271ef4d98e --- /dev/null +++ b/htdocs/accountancy/closure/validate.php @@ -0,0 +1,158 @@ + + * + * 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/accountancy/closure/validate.php + * \ingroup Accountancy + * \brief Validate entries page + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("compta","bills","other","main","accountancy")); + +// Security check +if (empty($conf->accounting->enabled)) { + accessforbidden(); +} +if ($user->societe_id > 0) + accessforbidden(); +if (! $user->rights->accounting->fiscalyear->closure) + accessforbidden(); + + +$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1); +if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); +else +{ + $year_start = dol_print_date(dol_now(), '%Y'); + if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year +} +$year_end = $year_start + 1; +$month_end = $month_start - 1; +if ($month_end < 1) +{ + $month_end = 12; + $year_end--; +} +$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start); +$search_date_end = dol_get_last_day($year_end, $month_end); +$year_current = $year_start; + +/* + * Actions + */ + +if ($action == 'validate') +{ + $now = dol_now(); + + // Update database + $db->begin(); + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; + $sql .= " SET b.date_validated = '" . $db->idate($now) . "'"; + $sql .= ' WHERE b.date_validated IS NULL'; + + dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG); + $resql = $db->query($sql); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } else { + $db->commit(); + } + // End clean database +} + + +/* + * View + */ + +llxHeader('', $langs->trans("ValidateMovements")); + +$textprevyear = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; + + +print load_fiche_titre($langs->trans("ValidateMovements") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); + +print $langs->trans("DescValidateMovements") . '
'; +print '
'; + + +$y = $year_current; + +print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1); + +print '
'; +print '
' . $langs->trans("Total") . '
' . price($row[$i]) . '' . price($row[13]) . '' . price($row[14]) . '' . price($row[13]) . '
' . price($row[$i]) . '' . $row[$i] . '' . price($row[13]) . '' . $row[13] . '
'; +print ''; +for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + print ''; +} +print ''; + +print ''; +$sql = "SELECT COUNT(b.rowid) as detail,"; +for($i = 1; $i <= 12; $i ++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1; + if ($j > 12) $j-=12; + $sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ","; +} +$sql .= " COUNT(b.rowid) as total"; +$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; +$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'"; +$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'"; +$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy + +dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG); +$resql = $db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); + + while ( $row = $db->fetch_row($resql)) { + + for($i = 1; $i <= 12; $i ++) { + print '' ; + } + print ''; + } + print + $db->free($resql); +} else { + print $db->lasterror(); // Show last sql error +} +print ''; +print "
' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[$i] . '

'; + print ''; + print '
' . $row[13] . '
\n"; + +print '
'; +print '
'; + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 01c5752f4b5..2819ff372ec 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -245,6 +245,8 @@ DescVentilDoneExpenseReport=Consult here the list of the lines of expenses repor DescClosure=Consult here the number of movements by month who are not validated & fiscal years already open OverviewOfMovementsNotValidated=Step 1/ Overview of movements not validated. (Necessary to close a fiscal year) ValidateMovements=Validate movements +DescValidateMovements=Any modification or deletion of writing, lettering and deletes will be prohibited. All entries for an exercise must be validated otherwise closing will not be possible +SelectMonthAndValidate=Select month and validate movements ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic binding done From b01bd979b544c929483c61bd29e9250fae5f193c Mon Sep 17 00:00:00 2001 From: ATM john Date: Mon, 30 Sep 2019 21:10:16 +0200 Subject: [PATCH 010/409] Unlock title button feature --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 287623c6c55..e860938398a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8262,7 +8262,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $class = 'btnTitle'; // hidden conf keep during button transition TODO: remove this block - if (empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)) { + if (!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)) { $class = 'butActionNew'; } if (! empty($params['morecss'])) $class.=' '.$params['morecss']; @@ -8280,7 +8280,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $attr['class'] .= ' refused'; // hidden conf keep during button transition TODO: remove this block - if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + if(!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)){ $attr['class'] = 'butActionNewRefused'; } @@ -8342,7 +8342,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $button.= ''; // hidden conf keep during button transition TODO: remove this block - if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + if(!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)){ $button='<'.$tag.' '.$compiledAttributes.' >'.$label.''; $button.= ''; $button.= ''; From 55410a55ef0f83f294783275fb6d12350746b592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 4 Oct 2019 00:45:57 +0200 Subject: [PATCH 011/409] Update list.php --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0014cb7999c..699276ed683 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -272,7 +272,7 @@ $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.tota $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +foreach ($extralabels as $key => $val) $sql.=($extrafields->attribute_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 From 37f6aa3395316006f239a1dceec8ebc718960552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Oct 2019 15:52:33 +0200 Subject: [PATCH 012/409] Update list.php --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 699276ed683..db36aacf542 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -272,7 +272,7 @@ $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.tota $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo"; // Add fields from extrafields -foreach ($extralabels as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +foreach ($extrafields->attributes['expensereport']['type'] as $key => $val) $sql.=($extrafields->attribute_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 From 8c024b3786eb34537fd7c662063fd9dd3dee4419 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 7 Oct 2019 11:26:10 +0200 Subject: [PATCH 013/409] FIX : missing "$this->id" in "fetch" function --- htdocs/core/class/link.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 8413725ab11..db2c1009a3f 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -334,6 +334,7 @@ class Link extends CommonObject if($this->db->num_rows($resql) > 0) { $obj = $this->db->fetch_object($resql); + $this->id = $obj->rowid; $this->entity = $obj->entity; $this->datea = $this->db->jdate($obj->datea); $this->url = $obj->url; From 2aee62ea28726d0247147fd3e145a936222cfdb5 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Mon, 7 Oct 2019 17:32:52 +0200 Subject: [PATCH 014/409] FIX: $from and $sendto variables are unescaped in the sending error message This causes addresses like Tom not to be shown in the message. --- htdocs/core/actions_sendmails.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 17f1a70d555..088c30aaf31 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -460,7 +460,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $mesg='
'; if ($mailfile->error) { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.=$langs->transnoentities('ErrorFailedToSendMail',dol_escape_htmltag($from),dol_escape_htmltag($sendto)); $mesg.='
'.$mailfile->error; } else From 2b9be13a7cd38906edf0d3ce40bbfdcd6fc06e6e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 9 Oct 2019 15:26:55 +0200 Subject: [PATCH 015/409] Update card.php --- htdocs/product/card.php | 60 ++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ef144c10e0d..22a8af0d270 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -17,6 +17,7 @@ * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Thibault FOUCART * * 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 @@ -297,16 +298,18 @@ if (empty($reshook)) $object->duration_unit = $duration_unit; $object->fk_default_warehouse = GETPOST('fk_default_warehouse'); $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0; - $object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0; + $object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0; $object->canvas = GETPOST('canvas'); + $object->net_measure = GETPOST('net_measure'); + $object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit $object->weight = GETPOST('weight'); $object->weight_units = GETPOST('weight_units'); // This is not the fk_unit but the power of unit $object->length = GETPOST('size'); $object->length_units = GETPOST('size_units'); // This is not the fk_unit but the power of unit $object->width = GETPOST('sizewidth'); $object->height = GETPOST('sizeheight'); - $object->surface = GETPOST('surface'); - $object->surface_units = GETPOST('surface_units'); // This is not the fk_unit but the power of unit + $object->surface = GETPOST('surface'); + $object->surface_units = GETPOST('surface_units'); // This is not the fk_unit but the power of unit $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); // This is not the fk_unit but the power of unit $object->finished = GETPOST('finished', 'alpha'); @@ -403,6 +406,8 @@ if (empty($reshook)) $object->duration_unit = GETPOST('duration_unit', 'alpha'); $object->canvas = GETPOST('canvas'); + $object->net_measure = GETPOST('net_measure'); + $object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit $object->weight = GETPOST('weight'); $object->weight_units = GETPOST('weight_units'); // This is not the fk_unit but the power of unit $object->length = GETPOST('size'); @@ -1053,13 +1058,20 @@ else $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1); print ''; + + // Net Measure + print ''.$langs->trans("NetMeasure").''; + print ''; + print $formproduct->selectMeasuringUnits("net_measure_units", "net_measure", GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); + print ''; - // Weight + // Brut Weight print ''.$langs->trans("Weight").''; print ''; print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units')?GETPOST('weight_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); print ''; - // Length + + // Brut Length if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; @@ -1071,7 +1083,7 @@ else } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { - // Surface + // Brut Surface print ''.$langs->trans("Surface").''; print ''; print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units')?GETPOST('surface_units', 'alpha'):'0', 0, 2); @@ -1079,7 +1091,7 @@ else } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - // Volume + // Brut Volume print ''.$langs->trans("Volume").''; print ''; print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units')?GETPOST('volume_units', 'alpha'):'0', 0, 2); @@ -1426,15 +1438,22 @@ else $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); print $form->selectarray('finished', $statutarray, $object->finished); print ''; + + // Net Measure + print ''.$langs->trans("NetMeasure").''; + print ' '; + print $form->selectUnits($object->net_measure_units, 'units'); + //print $formproduct->selectMeasuringUnits("net_measure_units", "weight", $object->net_measure_units, 0, 2); + print ''; - // Weight + // Brut Weight print ''.$langs->trans("Weight").''; print ' '; print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2); print ''; if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Length + // Brut Length print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; print 'x'; print 'x'; @@ -1444,7 +1463,7 @@ else } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { - // Surface + // Brut Surface print ''.$langs->trans("Surface").''; print ' '; print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units, 0, 2); @@ -1452,7 +1471,7 @@ else } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - // Volume + // Brut Volume print ''.$langs->trans("Volume").''; print ' '; print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2); @@ -1833,8 +1852,19 @@ else print ''.$langs->trans("Nature").''; print $object->getLibFinished(); print ''; + + // Net Measure + print ''.$langs->trans("NetMeasure").''; + if ($object->net_measure != '') + { + print $object->net_measure." ".measuring_units_string(0, "weight", $object->net_measure_units); + } + else + { + print ' '; + } - // Weight + // Brut Weight print ''.$langs->trans("Weight").''; if ($object->weight != '') { @@ -1847,7 +1877,7 @@ else print "\n"; if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Length + // Brut Length print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; if ($object->length != '' || $object->width != '' || $object->height != '') { @@ -1864,7 +1894,7 @@ else } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { - // Surface + // Brut Surface print ''.$langs->trans("Surface").''; if ($object->surface != '') { @@ -1878,7 +1908,7 @@ else } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - // Volume + // Brut Volume print ''.$langs->trans("Volume").''; if ($object->volume != '') { From d77f7556d8f19f4f622083eebf771e75962a6acb Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 9 Oct 2019 16:00:14 +0200 Subject: [PATCH 016/409] NEW add parent category id or label in import category module --- .../modules/import/import_csv.modules.php | 6 +++++- .../modules/import/import_xlsx.modules.php | 6 +++++- htdocs/core/modules/modCategorie.class.php | 20 ++++++++++++++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index de428900ba9..734f516fa78 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -459,10 +459,14 @@ class ImportCsv extends ModeleImports $error++; }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } elseif ($class == 'Categorie') { + if ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { + $param_array = array('', $newval, $arrayrecord[1]['val']); + } } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label - if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') + if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel' && $class!='Categorie') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index c4799ba557e..1a92062b15f 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -486,10 +486,14 @@ class ImportXlsx extends ModeleImports $error++; }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } elseif ($class == 'Categorie') { + if ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { + $param_array = array('', $newval, $arrayrecord[1]['val']); + } } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label - if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') + if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel' && $class!='Categorie') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index c04a4d6b346..e8a1bd218cd 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -406,15 +406,29 @@ class modCategorie extends DolibarrModules $this->import_icon[$r]=$this->picto; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); - $this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description"); - + $this->import_fields_array[$r]=array( + 'ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description", + 'ca.fk_parent' => 'Parent' + ); $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); + $this->import_convertvalue_array[$r] = array( + 'ca.fk_parent' => array( + 'rule' => 'fetchidfromcodeorlabel', + 'classfile' => '/categories/class/categorie.class.php', + 'class' => 'Categorie', + 'method' => 'fetch', + 'element' => 'category' + ) + ); $typeexample=""; if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; } if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; } if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } - $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category"); + $this->import_examplevalues_array[$r] = array( + 'ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category", + 'ca.fk_parent' => '0' + ); if (! empty($conf->product->enabled)) { From 04dc9e957f1dfc1f049b97d8fc5a89ebd1f99841 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 9 Oct 2019 16:33:57 +0200 Subject: [PATCH 017/409] Update new LDCompta Export --- .../class/accountancyexport.class.php | 202 +++++++++++------- 1 file changed, 121 insertions(+), 81 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index dac238f97d6..f90d5797d09 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -926,91 +926,131 @@ class AccountancyExport * * @return void */ - public function exportLDCompta($objectLines) - { + public function exportLDCompta($objectLines) + { - $separator = ';'; - $end_line = "\n"; + $separator = ';'; + $end_line = "\r\n"; - foreach ($objectLines as $line) { + foreach ($objectLines as $line) { - $date_document = dol_print_date($line->doc_date, '%Y%m%d'); - $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); + $date_document = dol_print_date($line->doc_date, '%Y%m%d'); + $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); - // TYPE - $type_enregistrement = 'E'; // For write movement - print $type_enregistrement . $separator; - // JNAL - print substr($line->code_journal, 0, 2) . $separator; - // NECR - print $line->id . $separator; - // NPIE - print $line->piece_num . $separator; - // DATP - print $date_document . $separator; - // LIBE - print $line->label_operation . $separator; - // DATH - print $line->date_lim_reglement . $separator; - // CNPI - if ($line->doc_type == 'supplier_invoice') { - if ($line->montant < 0) { - $nature_piece = 'AF'; - } else { - $nature_piece = 'FF'; - } - } elseif ($line->doc_type == 'customer_invoice') { - if ($line->montant < 0) { - $nature_piece = 'AC'; - } else { - $nature_piece = 'FC'; - } - } else { - $nature_piece = ''; - } - print $nature_piece . $separator; - // RACI - /* - if (! empty($line->subledger_account)) { - if ($line->doc_type == 'supplier_invoice') { - $racine_subledger_account = '40'; - } elseif ($line->doc_type == 'customer_invoice') { - $racine_subledger_account = '41'; - } else { - $nature_piece = ''; - } - print $racine_subledger_account . $separator; - } else { - print $separator; - } - */ - // MONT - print price(abs($line->montant)) . $separator; - // CODC - print $line->sens . $separator; - // CPTG - print length_accountg($line->numero_compte) . $separator; - // DATE - print $date_creation . $separator; - // CLET - print $line->lettering_code . $separator; - // DATL - print $line->date_lettering . $separator; - // CPTA - if (! empty($line->subledger_account)) { - print length_accounta($line->subledger_account) . $separator; - } - // CNAT - if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) { - print 'F'; - } elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) { - print 'C'; - } else { - print ''; - } - print $end_line; - } - } + // TYPE + $type_enregistrement = 'E'; // For write movement + print $type_enregistrement . $separator; + // JNAL + print substr($line->code_journal, 0, 2) . $separator; + // NECR + print $line->id . $separator; + // NPIE + print $line->piece_num . $separator; + // DATP + print $date_document . $separator; + // LIBE + print $line->label_operation . $separator; + // DATH + print $line->date_lim_reglement . $separator; + // CNPI + if ($line->doc_type == 'supplier_invoice') { + if ($line->montant < 0) { + $nature_piece = 'AF'; + } else { + $nature_piece = 'FF'; + } + } elseif ($line->doc_type == 'customer_invoice') { + if ($line->montant < 0) { + $nature_piece = 'AC'; + } else { + $nature_piece = 'FC'; + } + } else { + $nature_piece = ''; + } + print $nature_piece . $separator; + // RACI + /* + if (! empty($line->subledger_account)) { + if ($line->doc_type == 'supplier_invoice') { + $racine_subledger_account = '40'; + } elseif ($line->doc_type == 'customer_invoice') { + $racine_subledger_account = '41'; + } else { + $nature_piece = ''; + } + print $racine_subledger_account . $separator; + } else { + print $separator; + } + */ + print $separator; // deprecated CPTG & CPTA use instead + // MONT + print price(abs($line->montant), 0, '', 1, 2) . $separator; + // CODC + print $line->sens . $separator; + // CPTG + print length_accountg($line->numero_compte) . $separator; + // DATE + print $date_creation . $separator; + // CLET + print $line->lettering_code . $separator; + // DATL + print $line->date_lettering . $separator; + // CPTA + if (! empty($line->subledger_account)) { + print length_accounta($line->subledger_account) . $separator; + } else { + print $separator; + } + // CNAT + if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) { + print 'F' . $separator; + } elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) { + print 'C' . $separator; + } else { + print $separator; + } + // SECT + print $separator; + // CTRE + print $separator; + // NORL + print $separator; + // DATV + print $separator; + // REFD + print $line->doc_ref . $separator; + // CODH + print $separator; + // NSEQ + print $separator; + // MTDV + print '0' . $separator; + // CODV + print $separator; + // TXDV + print '0' . $separator; + // MOPM + print $separator; + // BONP + print $separator; + // BQAF + print $separator; + // ECES + print $separator; + // TXTL + print $separator; + // ECRM + print $separator; + // DATK + print $separator; + // HEUK + print $separator; + + print $end_line; + } + } /** * Export format : Charlemagne From 0c8331b6d798eb83a1ad3c05059dcc0c79803102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Oct 2019 18:47:25 +0200 Subject: [PATCH 018/409] doxygen --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e4140357370..adf00d69d82 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3506,7 +3506,7 @@ class Facture extends CommonInvoice * @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 */ function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') { @@ -3577,7 +3577,7 @@ class Facture extends CommonInvoice * (Status validated or abandonned for a reason 'other') + not payed + no payment at all + not already replaced * * @param int $socid Id thirdparty - * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) + * @return array|int Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ function list_replacable_invoices($socid=0) { From 6f7e4fd15c9f8919d43c701638a4a0ba1895324d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Oct 2019 22:02:58 +0200 Subject: [PATCH 019/409] Update list.php --- htdocs/holiday/list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 1854cce2800..882f59dbee6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2018 Laurent Destailleur * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2019 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 @@ -273,7 +274,9 @@ $sql.= " ua.login as validator_login,"; $sql.= " ua.statut as validator_statut,"; $sql.= " ua.photo as validator_photo"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 From 6bb14bdb0c4d36e7f849ffc5f1ad3a91e2fe8e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Oct 2019 22:07:52 +0200 Subject: [PATCH 020/409] Update list.php --- htdocs/expensereport/list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index daadfa913ec..2b4a2a9a983 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2019 Juanjo Menent + * Copyright (C) 2019 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 @@ -279,7 +280,9 @@ $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.tota $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 From d4757a0b5be7220ee35f015943d4c4c871764e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Oct 2019 23:20:15 +0200 Subject: [PATCH 021/409] globe fontawesome --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ded274a8683..7c907885d27 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3032,7 +3032,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h', 'bookmark', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note', 'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', - 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', + 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe', 'jabber','skype','twitter','facebook','linkedin', 'chevron-left','chevron-right','chevron-down','chevron-top', 'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'project', 'hrm', 'members', 'ticket', 'generic', @@ -3126,11 +3126,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (preg_match('/selected/', $pictowithouttext)) $facolor = '#888'; $marginleftonlyshort = 1; } - elseif ($pictowithouttext == 'sign-out') { + elseif ($pictowithouttext == 'sign-out') { $fakey = 'fa-sign-out-alt'; $marginleftonlyshort=0; } - elseif ($pictowithouttext == 'unlink') { + elseif ($pictowithouttext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor = '#555'; } From 43c7917108097c0d504e4546786e80930a03d77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Oct 2019 23:59:12 +0200 Subject: [PATCH 022/409] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4536cdc5bbd..56ad1f9481f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -684,7 +684,7 @@ class CommandeFournisseur extends CommonOrder $billedtext = ' - '.$langs->trans("Billed"); } - $statusLong = $langs->trans($this->statuts_long[$status]).$billedtext; + $statusLong = $langs->trans($this->statuts[$status]).$billedtext; $statusShort = $langs->trans($this->statutshort[$status]); return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); From 90257dc08714c6e8317ac8d6efd9daa48160e2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Oct 2019 08:09:39 +0200 Subject: [PATCH 023/409] Update box_factures_imp.php --- htdocs/core/boxes/box_factures_imp.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 494950927a9..3c4ba1c9736 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2019 Frederic 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 @@ -82,6 +82,8 @@ class box_factures_imp extends ModeleBoxes $facturestatic = new Facture($this->db); $societestatic = new Societe($this->db); + $langs->load("bills"); + $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max)); if ($user->rights->facture->lire) From be005767174c10c171b8f4b3c8abb50a971829b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Oct 2019 08:22:14 +0200 Subject: [PATCH 024/409] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ded274a8683..b0dc822bb56 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3031,7 +3031,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h', 'bookmark', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note', 'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', - 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', + 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats', 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'jabber','skype','twitter','facebook','linkedin', 'chevron-left','chevron-right','chevron-down','chevron-top', @@ -3046,7 +3046,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotofa = array( 'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap', 'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open', - 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'bookmark'=>'star', + 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'bookmark'=>'star', 'stats' => 'chart-bar', 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork', 'object_list'=>'list-alt','object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', @@ -3081,6 +3081,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext]; $facolor = '#444'; } + elseif ($pictowithouttext == 'stats') { + $fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext]; + $facolor = '#444'; + } elseif ($pictowithouttext == 'delete') { $fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext]; $facolor = '#444'; From d43f2bbfaec85c10cdb3893d1d6d22912393a083 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 10 Oct 2019 11:44:21 +0200 Subject: [PATCH 025/409] NEW : Accountancy - List by account - Modify sortfield, nowrap on amount and sum of sous-total --- htdocs/accountancy/bookkeeping/listbyaccount.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d3dc9b4a190..2b9fc4fde29 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -71,7 +71,7 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if ($sortorder == "") $sortorder = "ASC"; -if ($sortfield == "") $sortfield = "t.rowid"; +if ($sortfield == "") $sortfield = "t.doc_date"; if (empty($search_date_start) && empty($search_date_end)) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; @@ -376,8 +376,8 @@ while ($i < min($num, $limit)) print strlen(length_accounta($line->subledger_account)) == 0 ? '' . $line->label_operation . '' : '' . $line->label_operation . '
(' . length_accounta($line->subledger_account) . ')'; - print '' . ($line->debit ? price($line->debit) :''). ''; - print '' . ($line->credit ? price($line->credit) : '') . ''; + print '' . ($line->debit ? price($line->debit) :''). ''; + print '' . ($line->credit ? price($line->credit) : '') . ''; $accountingjournal = new AccountingJournal($db); $result = $accountingjournal->fetch('', $line->code_journal); @@ -400,18 +400,19 @@ while ($i < min($num, $limit)) // Affiche un Sous-Total du dernier compte comptable affiché print ''; print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''; -print " \n"; -print " \n"; +print ''; +print price($sous_total_debit - $sous_total_credit); +print '\n'; print ''; // Affiche le Total print ''; print ''.$langs->trans("Total").':'; -print ''; +print ''; print price($total_debit); print ''; -print ''; +print ''; print price($total_credit); print ''; print ''; From 612c80b290ff2abc52bc9437ea80a227a071865b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 10 Oct 2019 13:07:19 +0200 Subject: [PATCH 026/409] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 66 +++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index dd0a08039ef..9552380f090 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -358,6 +358,70 @@ class Setup extends DolibarrApi } + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of events types : '.$this->db->lasterror()); + } + + return $list; + } + + /** + * Get the list of contacts types. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $type To filter on type of contact + * @param string $module To filter on module contacts + * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return array List of Contacts types + * + * @url GET dictionary/contact_types + * + * @throws RestException + */ + public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid, code, element as type, libelle as label, source, module, position"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as t"; + $sql.= " WHERE t.active = ".$active; + if ($type) $sql.=" AND type LIKE '%" . $this->db->escape($type) . "%'"; + if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $this->db->order($sortfield, $sortorder); if ($limit) { @@ -394,7 +458,7 @@ class Setup extends DolibarrApi * @param string $module To filter on module events * @param int $active Payment term is active or not {@min 0} {@max 1} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" - * @return array List of civility types + * @return array List of civility types * * @url GET dictionary/civilities * From 56b6223bba5149115b125d16d1a59c678e0f8880 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 10 Oct 2019 14:23:18 +0200 Subject: [PATCH 027/409] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 9552380f090..4ef09e5ae78 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -329,7 +329,7 @@ class Setup extends DolibarrApi * @param int $page Page number (starting from zero) * @param string $type To filter on type of event * @param string $module To filter on module events - * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param int $active Event's type is active or not {@min 0} {@max 1} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of events types * @@ -393,7 +393,7 @@ class Setup extends DolibarrApi * @param int $page Page number (starting from zero) * @param string $type To filter on type of contact * @param string $module To filter on module contacts - * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param int $active Contact's type is active or not {@min 0} {@max 1} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of Contacts types * @@ -456,7 +456,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number (starting from zero) * @param string $module To filter on module events - * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param int $active Civility is active or not {@min 0} {@max 1} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of civility types * From 015d51c16994f1e605c67501d8c97f63d0b98e00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 15:10:41 +0200 Subject: [PATCH 028/409] NEW Add column of module source and POS terminal in invoice list. --- htdocs/compta/facture/list.php | 124 ++++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c11d5796109..93d4e28d5c8 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -89,6 +89,8 @@ $search_montant_ttc=GETPOST('search_montant_ttc', 'alpha'); $search_status=GETPOST('search_status', 'intcomma'); $search_paymentmode=GETPOST('search_paymentmode', 'int'); $search_paymentterms=GETPOST('search_paymentterms', 'int'); +$search_module_source=GETPOST('search_module_source', 'alpha'); +$search_pos_source=GETPOST('search_pos_source', 'alpha'); $search_town=GETPOST('search_town', 'alpha'); $search_zip=GETPOST('search_zip', 'alpha'); $search_state=trim(GETPOST("search_state")); @@ -157,37 +159,39 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( - 'f.ref'=>array('label'=>"Ref", 'checked'=>1), - 'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1), - 'f.type'=>array('label'=>"Type", 'checked'=>0), - 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1), - 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1), - 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)), - 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), - 's.town'=>array('label'=>"Town", 'checked'=>1), - 's.zip'=>array('label'=>"Zip", 'checked'=>1), - 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1), - 'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1), - 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), - 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), - 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")), - 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1")), - 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0), - 'rtp'=>array('label'=>"Rest", 'checked'=>0), + 'f.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), + 'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1, 'position'=>10), + 'f.type'=>array('label'=>"Type", 'checked'=>0, 'position'=>15), + 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1, 'position'=>20), + 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1, 'position'=>25), + 'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>30), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1), 'position'=>40), + 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1), 'position'=>40), + 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50), + 's.town'=>array('label'=>"Town", 'checked'=>1, 'position'=>55), + 's.zip'=>array('label'=>"Zip", 'checked'=>1, 'position'=>60), + 'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>65), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0, 'position'=>70), + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75), + 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80), + 'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85), + 'f.module_source'=>array('label'=>"Module", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->POS_EXTERNAL_ENABLED), 'position'=>90), + 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->POS_EXTERNAL_ENABLED), 'position'=>91), + 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95), + 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100), + 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1"), 'position'=>110), + 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1"), 'position'=>120), + 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130), + 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140), + 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) { - $arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0); + $arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86); } // Extra fields @@ -236,6 +240,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_status=''; $search_paymentmode=''; $search_paymentterms=''; + $search_module_source=''; + $search_pos_source=''; $search_town=''; $search_zip=""; $search_state=""; @@ -381,13 +387,10 @@ $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; -$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; +$sql.= ' f.datef as df, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,'; $sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; -if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) -{ - $sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,'; -} +$sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; @@ -475,8 +478,10 @@ if ($search_status != '-1' && $search_status != '') $sql.= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } -if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); +if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); +if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); +if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); $sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); $sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; @@ -496,9 +501,10 @@ if (! $sall) { $sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total, f.tva, f.total_ttc,'; $sql.= ' f.localtax1, f.localtax2,'; - $sql.= ' f.datef, f.date_lim_reglement,'; + $sql.= ' f.datef, f.date_lim_reglement, f.module_source, f.pos_source,'; $sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.datec, f.tms, f.date_closing,'; + $sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql.= ' typent.code,'; $sql.= ' state.code_departement, state.nom,'; @@ -591,6 +597,8 @@ if ($resql) if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); + if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); + if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); if ($show_files) $param.='&show_files='.urlencode($show_files); if ($option) $param.="&search_option=".urlencode($option); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -804,17 +812,31 @@ if ($resql) // Payment mode if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''; + print ''; $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); print ''; } // Payment terms if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) { - print ''; + print ''; $form->select_conditions_paiements($search_paymentterms, 'search_paymentterms', -1, 1, 1); print ''; } + // Module source + if (! empty($arrayfields['f.module_source']['checked'])) + { + print ''; + print ''; + print ''; + } + // POS Terminal + if (! empty($arrayfields['f.pos_source']['checked'])) + { + print ''; + print ''; + print ''; + } if (! empty($arrayfields['f.total_ht']['checked'])) { // Amount @@ -923,6 +945,8 @@ if ($resql) if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['f.module_source']['checked'])) print_liste_field_titre($arrayfields['f.module_source']['label'], $_SERVER["PHP_SELF"], "f.module_source", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['f.pos_source']['checked'])) print_liste_field_titre($arrayfields['f.pos_source']['label'], $_SERVER["PHP_SELF"], "f.pos_source", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder); @@ -1107,14 +1131,14 @@ if ($resql) if (! empty($arrayfields['s.nom']['checked'])) { print ''; - if ($contextpage == 'poslist') - { - print $thirdpartystatic->name; - } - else - { - print $thirdpartystatic->getNomUrl(1, 'customer'); - } + if ($contextpage == 'poslist') + { + print $thirdpartystatic->name; + } + else + { + print $thirdpartystatic->getNomUrl(1, 'customer'); + } print ''; if (! $i) $totalarray['nbfield']++; } @@ -1186,6 +1210,24 @@ if ($resql) if (! $i) $totalarray['nbfield']++; } + // Module Source + if (! empty($arrayfields['f.module_source']['checked'])) + { + print ''; + print $obj->module_source; + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // POS Terminal + if (! empty($arrayfields['f.pos_source']['checked'])) + { + print ''; + print $obj->pos_source; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) { From d9a0dc2986a6a3bc01676b16d92a747eb0c848cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 15:20:44 +0200 Subject: [PATCH 029/409] Fix trans --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index b1b10f34ffb..fccc7f365e2 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -234,7 +234,7 @@ class modFacture extends DolibarrModules } if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS_IN_EXPORT)) { - $this->export_fields_array[$r]['f.module_source']='POSModule'; + $this->export_fields_array[$r]['f.module_source']='Module'; $this->export_fields_array[$r]['f.pos_source']='POSTerminal'; } $this->export_TypeFields_array[$r] = array( From b34cbfad74a7d7dde02ca61461b43db8b7547c68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 15:23:45 +0200 Subject: [PATCH 030/409] Rename const --- htdocs/compta/facture/list.php | 4 ++-- htdocs/core/modules/modFacture.class.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 93d4e28d5c8..77abac6e4d1 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -175,8 +175,8 @@ $arrayfields=array( 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75), 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80), 'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85), - 'f.module_source'=>array('label'=>"Module", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->POS_EXTERNAL_ENABLED), 'position'=>90), - 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->POS_EXTERNAL_ENABLED), 'position'=>91), + 'f.module_source'=>array('label'=>"Module", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>90), + 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>91), 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95), 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1"), 'position'=>110), diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index fccc7f365e2..01c80265e46 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -232,7 +232,7 @@ class modFacture extends DolibarrModules $this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; } - if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS_IN_EXPORT)) + if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS)) { $this->export_fields_array[$r]['f.module_source']='Module'; $this->export_fields_array[$r]['f.pos_source']='POSTerminal'; @@ -248,7 +248,7 @@ class modFacture extends DolibarrModules 'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', 'p.accountancy_code_sell'=>'Text' ); - if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS_IN_EXPORT)) + if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS)) { $this->export_TypeFields_array[$r]['f.module_source']='Text'; $this->export_TypeFields_array[$r]['f.pos_source']='Text'; @@ -314,7 +314,7 @@ class modFacture extends DolibarrModules $this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; } - if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS_IN_EXPORT)) + if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS)) { $this->export_fields_array[$r]['f.module_source']='POSModule'; $this->export_fields_array[$r]['f.pos_source']='POSTerminal'; @@ -328,7 +328,7 @@ class modFacture extends DolibarrModules 'pj.ref'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.title'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', 'p.fk_bank'=>'Numeric', 'p.note'=>'Text', 'pt.code'=>'Text', 'pt.libelle'=>'text', 'ba.ref'=>'Text' ); - if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS_IN_EXPORT)) + if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS)) { $this->export_fields_array[$r]['f.module_source']='POSModule'; $this->export_fields_array[$r]['f.pos_source']='POSTerminal'; From 3b56cf5e1938b4d515eed7ace261726bf5b421d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 15:24:26 +0200 Subject: [PATCH 031/409] Trans --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 0f4d3c30ddf..c8b7db19236 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ Following changes may create regressions for some external modules, but were nec * If you have developed your own emailing target selector and used parent::add_to_target(...), you must now use parent::addToTargets(...) * Removed function dol_micro_time. Use native PHP microtime instead. * The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE. +* The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS. ***** ChangeLog for 10.0.2 compared to 10.0.1 ***** From 060452ecf29771079ad19684bce9295e3fc13a0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 15:29:27 +0200 Subject: [PATCH 032/409] Fix link --- htdocs/takepos/admin/setup.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index d891b88f775..6289f382273 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -165,14 +165,14 @@ print "\n"; // Use Takepos printing print ''; -print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("TakeposConnectorNecesary").')'; +print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("TakeposConnectorNecesary").')'; print ''; print $form->selectyesno("TAKEPOSCONNECTOR", $conf->global->TAKEPOSCONNECTOR, 1); print "\n"; -if ($conf->global->TAKEPOSCONNECTOR){ +if ($conf->global->TAKEPOSCONNECTOR) { print ''; - print $langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print $langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; print ''; print ''; print ''; @@ -189,7 +189,7 @@ print "\n"; if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){ print ''; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; print ''; print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); print ''; From e5cb9bc22eaa7f8e014aee1ae8bcd3b5e6b2fe2f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 10 Oct 2019 15:56:36 +0200 Subject: [PATCH 033/409] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 4ef09e5ae78..1d4bb6a8cb7 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -442,7 +442,7 @@ class Setup extends DolibarrApi $list[] = $this->db->fetch_object($result); } } else { - throw new RestException(503, 'Error when retrieving list of events types : '.$this->db->lasterror()); + throw new RestException(503, 'Error when retrieving list of contacts types : '.$this->db->lasterror()); } return $list; From 2149b155d196a826e485b0b40526a16534df685e Mon Sep 17 00:00:00 2001 From: "ro@t.com" Date: Thu, 10 Oct 2019 15:57:26 +0200 Subject: [PATCH 034/409] ADD option MAIN_DONT_KEEP_NOTE_ON_CLONING to remove note on cloning --- htdocs/comm/propal/class/propal.class.php | 6 +++++- htdocs/compta/facture/class/facture.class.php | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e9d969e5ab8..6babe8076a8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1287,7 +1287,11 @@ class Propal extends CommonObject $object->datep = $now; // deprecated $object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600); if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $object->ref_client = ''; - + if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING==1) + { + $object->note_private = ''; + $object->note_public = ''; + } // Create clone $object->context['createfromclone']='createfromclone'; $result=$object->create($user); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 09d3351fb4d..7f5432682ab 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1046,6 +1046,11 @@ class Facture extends CommonInvoice $object->close_code = ''; $object->close_note = ''; $object->products = $object->lines; // For backward compatibility + if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING==1) + { + $object->note_private = ''; + $object->note_public = ''; + } // Loop on each line of new invoice foreach($object->lines as $i => $line) From e2113c2f3342452852e6dbcbfb1a06c27558596f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 16:41:24 +0200 Subject: [PATCH 035/409] Fix sort lost after uploading a file --- htdocs/core/class/html.formfile.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 76eec464399..7f9ada37e7d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -118,9 +118,11 @@ class FormFile if (empty($usewithoutform)) { $out .= '
'; + $out .= ''; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; } $out .= ''; From a8676e63c8d69e500c7810708842074e991d4a21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 16:46:50 +0200 Subject: [PATCH 036/409] CSS --- htdocs/comm/card.php | 4 +--- htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 3f50c6ab6c8..576851b7e2e 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -403,7 +403,7 @@ if ($object->id > 0) print '
'; if ($user->rights->societe->creer && !$user->societe_id > 0) { - print ''.img_edit($langs->trans("Modify")).''; + print ''.img_edit($langs->trans("Modify")).''; } print '
'; print ''; @@ -425,8 +425,6 @@ if ($object->id > 0) print ''; $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); - //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); - print ''; print ''; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7f9ada37e7d..8a0341135c7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -115,7 +115,7 @@ class FormFile if (empty($title)) $title=$langs->trans("AttachANewFile"); if ($title != 'none') $out.=load_fiche_titre($title, null, null); - if (empty($usewithoutform)) + if (empty($usewithoutform)) // Try to avoid this and set instead the form by the caller. { $out .= ''; $out .= ''; From 9a2fabff6fb77949be0ec027d82ed424f71dde58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Oct 2019 18:42:29 +0200 Subject: [PATCH 037/409] doxygen --- .../modules/security/generate/modGeneratePassPerso.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php index 5a7d22670c7..8abcc41c263 100644 --- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -177,7 +177,7 @@ class modGeneratePassPerso extends ModeleGenPassword * Validate a password * * @param string $password Password to check - * @return int 0 if KO, >0 if OK + * @return bool false if KO, true if OK */ public function validatePassword($password) { From ebf73c857c325c931a32b93d55bcbd574b44622a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Oct 2019 21:09:08 +0200 Subject: [PATCH 038/409] get relative path for favicon --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2d612f5808d..aa778a111bc 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1224,7 +1224,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; // Favicon - $favicon = DOL_MAIN_URL_ROOT . '/theme/'.$conf->theme.'/img/favicon.ico'; + $favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; if (empty($conf->dol_use_jmobile)) print ''."\n"; // Not required into an Android webview //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; From 3bf6fac505bf6bbe8f0b96f14f25bb338ca2f52b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 22:05:34 +0200 Subject: [PATCH 039/409] NEW Can filter on label on invoice in accounting vendor binding pages --- htdocs/accountancy/supplier/lines.php | 9 ++++----- htdocs/accountancy/supplier/list.php | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 97f1c771122..a815e5b858b 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -192,12 +192,12 @@ if ($search_lineid) { if (strlen(trim($search_invoice))) { $sql .= natural_search("f.ref", $search_invoice); } +if (strlen(trim($search_label))) { + $sql .= natural_search("f.libelle", $search_label); +} if (strlen(trim($search_ref))) { $sql .= natural_search("p.ref", $search_ref); } -if (strlen(trim($search_label))) { - $sql .= natural_search("p.label", $search_label); -} if (strlen(trim($search_desc))) { $sql .= natural_search("l.description", $search_desc); } @@ -300,14 +300,13 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; print ''; - //print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 6ba3e244582..fc453a94250 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -234,12 +234,12 @@ if ($search_lineid) { if (strlen(trim($search_invoice))) { $sql .= natural_search("f.ref", $search_invoice); } +if (strlen(trim($search_label))) { + $sql .= natural_search("f.libelle", $search_label); +} if (strlen(trim($search_ref))) { $sql .= natural_search("p.ref", $search_ref); } -if (strlen(trim($search_label))) { - $sql .= natural_search("p.label", $search_label); -} if (strlen(trim($search_desc))) { $sql .= natural_search("l.description", $search_desc); } @@ -317,6 +317,7 @@ if ($result) { if ($search_year) $param.='&search_year='.urlencode($search_year); if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_label) $param.='&search_label='.urlencode($search_label); if ($search_desc) $param.='&search_desc='.urlencode($search_desc); if ($search_amount) $param.='&search_amount='.urlencode($search_amount); if ($search_vat) $param.='&search_vat='.urlencode($search_vat); @@ -362,14 +363,13 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; print ''; - //print ''; print ''; print ''; print ''; From f82f4162c3abffe3bac4e15693dc37d4cb9de65a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 22:42:23 +0200 Subject: [PATCH 040/409] NEW Look and fill v11: Introduce CSS "trforbreak" --- htdocs/accountancy/bookkeeping/balance.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 4 +++- htdocs/theme/md/style.css.php | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3c04548d7c6..7d48790348d 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -279,8 +279,8 @@ if ($action != 'export_csv') print ''; } - // Affiche le compte comptable en debut de ligne - print ""; + // Show first line of a break + print ''; print '' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . ''; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 69865d7ab1b..ddd865cbbb2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2942,7 +2942,9 @@ td.evenodd, tr.nohoverpair td, #trlinefordates td { background: # !important; } .trforbreak td { - background-color: # !important; + font-weight: bold; + border-bottom: 1pt solid black !important; + /* background-color: # !important; */ } table.dataTable td { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8c6bd8d4d77..dc666d77a02 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3046,7 +3046,9 @@ td.evenodd, tr.nohoverpair td { background: # !important; } .trforbreak td { - background-color: # !important; + font-weight: bold; + border-bottom: 1pt solid black !important; + /* background-color: # !important; */ } table.dataTable td { From 5dc6e7d1a09de22b7d0d6cd63c1993323f3fcdc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 22:45:04 +0200 Subject: [PATCH 041/409] CSS --- htdocs/theme/md/info-box.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index fafa2978865..95e057e68f1 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -6,6 +6,11 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> * Component: Info Box * ------------------- */ + +span.info-box-icon-text { /* hide box text number due to problems */ + display: none; +} + .info-box { display: block; min-height: 90px; From fce07cf8ca195c5ccd8594dba0bffcc34e4abcf6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 22:52:11 +0200 Subject: [PATCH 042/409] CSS --- htdocs/theme/md/style.css.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dc666d77a02..93f71d3a47e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1782,7 +1782,7 @@ div.mainmenu { position : relative; background-repeat:no-repeat; background-position:center top; - height: px; + height: px; margin-left: 0px; min-width: 40px; } @@ -3973,7 +3973,7 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } .cal_peruserviewname { max-width: 140px; height: 22px; } .topmenuimage { - background-size: 28px auto; + background-size: 24px auto; } /* ============================================================================== */ @@ -5684,7 +5684,7 @@ border-top-right-radius: 6px; } .menuhider { - width: px; + width: px; } /* nboftopmenuentries = , fontsize= */ @@ -5703,7 +5703,7 @@ border-top-right-radius: 6px; font-size: 12px; } .topmenuimage { - background-size: 26px auto; + background-size: 24px auto; margin-top: 0px; } li.tmenu, li.tmenusel { From e7f56b67d84f2ab6d7a382a7329bf6ed1a2ac463 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Oct 2019 23:00:33 +0200 Subject: [PATCH 043/409] Look and feel v11 --- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/theme/md/style.css.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index ef875675ed7..b4140ba90a7 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -399,7 +399,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); else $title=$langs->trans("ShowPreview"); - print ''.$title.''; + print ''.$title.''; print '
'; if ($subdir == $selected_theme) { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 93f71d3a47e..72974ded51f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3215,6 +3215,10 @@ tr.liste_sub_total, tr.liste_sub_total td { -webkit-box-shadow: 0px 0px 0px #f4f4f4 !important; box-shadow: 0px 0px 0px #f4f4f4 !important; } +.shadow { + -webkit-box-shadow: 2px 2px 5px #CCC !important; + box-shadow: 2px 2px 5px #CCC !important; +} div.tabBar .noborder { -webkit-box-shadow: 0px 0px 0px #f4f4f4 !important; From c80d055af31d21131c1fe02c19889f2ef45017f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Oct 2019 23:51:54 +0200 Subject: [PATCH 044/409] fix search by roles --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 36657d48dbc..76606c4a54e 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1052,12 +1052,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) + if (! empty($arrayfields['t.'.$key]['checked']) || ! empty($arrayfields['sc.'.$key]['checked'])) { print ''; if (in_array($key, array('statut'))){ print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0, 1),'1'=>$contactstatic->LibStatut(1, 1)), $search_status); - }elseif (in_array($key, array('role'))) { + } elseif (in_array($key, array('role'))) { print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles); } else { print ''; From 9194eb4bec9bb95e1afb4b96b631f60df50f9617 Mon Sep 17 00:00:00 2001 From: John Botella Date: Fri, 11 Oct 2019 09:14:10 +0200 Subject: [PATCH 045/409] Fix block title height if no button --- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/theme/eldy/global.inc.php | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b9e6d17ccf5..450afe47a65 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4120,9 +4120,9 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict if ($picto == 'setup') $picto='generic'; $return.= "\n"; - $return.= ''; // maring bottom must be same than into print_barre_list - if ($picto) $return.= ''; - $return.= '
'.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).''; + $return.= ''; // maring bottom must be same than into print_barre_list + if ($picto) $return.= ''; + $return.= ''; if (dol_strlen($morehtmlcenter)) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ddd865cbbb2..8d1b73080de 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3587,6 +3587,10 @@ div.titre, .secondary { color: rgb(); } +table.table-fiche-title .col-title div.titre{ + line-height: 40px; +} + #dolpaymenttable { min-width: 320px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */ #tablepublicpayment { border: 1px solid #CCCCCC !important; width: 100%; padding: 20px; } #tablepublicpayment .CTableRow1 { background-color: #F0F0F0 !important; } From 535a09e85699229d9b1d9e9d5de52e431cd1b3a1 Mon Sep 17 00:00:00 2001 From: John Botella Date: Fri, 11 Oct 2019 09:17:17 +0200 Subject: [PATCH 046/409] Fix block title height if no button MD --- htdocs/theme/md/style.css.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 72974ded51f..75c47ebe6f0 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3625,6 +3625,10 @@ div.titre, .secondary { color: rgb(); } +table.table-fiche-title .col-title div.titre{ + line-height: 40px; +} + #dolpaymenttable { min-width: 320px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */ #tablepublicpayment { border: 1px solid #CCCCCC !important; width: 100%; padding: 20px; } #tablepublicpayment .CTableRow1 { background-color: #F0F0F0 !important; } From af88f44fd9ab99fc1b62ae1f3144cd230bef7618 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 11 Oct 2019 09:51:17 +0200 Subject: [PATCH 047/409] fix some translations --- htdocs/core/class/commondocgenerator.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 74253a19f51..cd117f3ca07 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -316,7 +316,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Define array with couple subtitution key => subtitution value + * Define array with couple substitution key => substitution value * * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code @@ -445,7 +445,7 @@ abstract class CommonDocGenerator $array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs), $array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'), - // Remain to pay with all know infrmation (except open direct debit requests) + // Remain to pay with all know information (except open direct debit requests) $array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs), $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT') ); @@ -479,7 +479,7 @@ abstract class CommonDocGenerator $totalUp = 0; foreach ($object->lines as $line) { - // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility + // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward compatibility if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); @@ -868,7 +868,7 @@ abstract class CommonDocGenerator /** - * uasort callback function to Sort colums fields + * uasort callback function to Sort columns fields * * @param array $a PDF lines array fields configs * @param array $b PDF lines array fields configs @@ -907,7 +907,7 @@ abstract class CommonDocGenerator // Positionning $curX = $this->page_largeur-$this->marge_droite; // start from right - // Array witdh + // Array width $arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche; // Count flexible column @@ -915,10 +915,10 @@ abstract class CommonDocGenerator $countFlexCol = 0; foreach ($this->cols as $colKey =>& $colDef) { - if(!$this->getColumnStatus($colKey)) continue; // continue if desable + if(!$this->getColumnStatus($colKey)) continue; // continue if desabled if(!empty($colDef['scale'])){ - // In case of column widht is defined by percentage + // In case of column width is defined by percentage $colDef['width'] = abs($arrayWidth * $colDef['scale'] / 100); } From 13115a55a209d7fb70f5d6f6dbdde10d4e69a8cc Mon Sep 17 00:00:00 2001 From: John Botella Date: Fri, 11 Oct 2019 10:02:59 +0200 Subject: [PATCH 048/409] Fix logo background and hidden conf --- htdocs/core/menus/standard/eldy.lib.php | 9 ++++++++- htdocs/theme/eldy/global.inc.php | 10 ++++++---- htdocs/theme/md/style.css.php | 10 ++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dbf56429086..878d7e13cd1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -480,6 +480,12 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = { $mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); + + $logoContainerAdditionalClass = 'backgroundforcompanylogo'; + if(!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)){ + $logoContainerAdditionalClass = ''; + } + if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); @@ -497,7 +503,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = print "\n".''."\n"; print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo"', 1); - print ''."\n"; + + print ''."\n"; print_end_menu_entry(4); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ddd865cbbb2..2fef266ab2e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1085,19 +1085,21 @@ div.blockvmenulogo { border-bottom: 0 !important; } -.backgroundforcompanylogo { +.menu-logo-container { margin: px; margin-left: 8px; margin-right: 8px; - background-color: rgba(255,255,255,0.7); padding: 0; - border-radius: 5px; height: px; /* width: 100px; */ max-width: 100px; vertical-align: middle; } -.backgroundforcompanylogo img.mycompany { +.backgroundforcompanylogo { + background-color: rgba(255,255,255,0.7); + border-radius: 5px; +} +.menu-logo-container img.mycompany { object-fit: contain; width: inherit; height: inherit; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 72974ded51f..9ee1f3d56e7 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2253,19 +2253,21 @@ div.blockvmenulogo { border-bottom: 0 !important; } -.backgroundforcompanylogo { +.menu-logo-container { margin: px; margin-left: 12px; margin-right: 6px; - background-color: rgba(255,255,255,0.7); padding: 0; - border-radius: 5px; height: px; /* width: 100px; */ max-width: 100px; vertical-align: middle; } -.backgroundforcompanylogo img.mycompany { +.backgroundforcompanylogo { + background-color: rgba(255,255,255,0.7); + border-radius: 5px; +} +.menu-logo-container img.mycompany { object-fit: contain; width: inherit; height: inherit; From 4873cbd071664e3a2f9d735c7f39a9c3afe88ad8 Mon Sep 17 00:00:00 2001 From: John Botella Date: Fri, 11 Oct 2019 10:10:12 +0200 Subject: [PATCH 049/409] Fix css name --- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 878d7e13cd1..d1ec07a2152 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -504,7 +504,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo"', 1); - print ''."\n"; + print ''."\n"; print_end_menu_entry(4); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2fef266ab2e..fe4dcd376f2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1085,7 +1085,7 @@ div.blockvmenulogo { border-bottom: 0 !important; } -.menu-logo-container { +.menulogocontainer { margin: px; margin-left: 8px; margin-right: 8px; @@ -1099,7 +1099,7 @@ div.blockvmenulogo background-color: rgba(255,255,255,0.7); border-radius: 5px; } -.menu-logo-container img.mycompany { +.menulogocontainer img.mycompany { object-fit: contain; width: inherit; height: inherit; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9ee1f3d56e7..87d39529e92 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2253,7 +2253,7 @@ div.blockvmenulogo { border-bottom: 0 !important; } -.menu-logo-container { +.menulogocontainer { margin: px; margin-left: 12px; margin-right: 6px; @@ -2267,7 +2267,7 @@ div.blockvmenulogo background-color: rgba(255,255,255,0.7); border-radius: 5px; } -.menu-logo-container img.mycompany { +.menulogocontainer img.mycompany { object-fit: contain; width: inherit; height: inherit; From bcb7365a5a371142af6db2d4ae08117568ed3fc7 Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Fri, 11 Oct 2019 10:13:21 +0200 Subject: [PATCH 050/409] Update commondocgenerator.class.php --- 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 cd117f3ca07..84f49bafe3f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -915,7 +915,7 @@ abstract class CommonDocGenerator $countFlexCol = 0; foreach ($this->cols as $colKey =>& $colDef) { - if(!$this->getColumnStatus($colKey)) continue; // continue if desabled + if(!$this->getColumnStatus($colKey)) continue; // continue if disabled if(!empty($colDef['scale'])){ // In case of column width is defined by percentage From 25b9be9de7b6db279a0797e2a9429f53c1c32d76 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 11 Oct 2019 10:19:58 +0200 Subject: [PATCH 051/409] update code --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index c678f0380fd..3049214679e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -198,13 +198,9 @@ class pdf_cyan extends ModelePDFPropales if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("bills"); - $outputlangs->load("propal"); - $outputlangs->load("products"); + + // Translations + $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); $nblines = count($object->lines); From de107fb02e93431ecfad06f8e8606767124d572b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:27:05 +0200 Subject: [PATCH 052/409] NEW Can set a squarred icon on your company setup --- htdocs/admin/company.php | 212 ++++++++++++------ .../install/mysql/migration/10.0.0-11.0.0.sql | 2 + htdocs/install/mysql/tables/llx_societe.sql | 1 + htdocs/langs/en_US/admin.lang | 3 + htdocs/societe/class/societe.class.php | 16 +- htdocs/theme/eldy/global.inc.php | 16 +- htdocs/theme/md/style.css.php | 4 + 7 files changed, 182 insertions(+), 72 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index a3534d3bc5a..9da2e550501 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -105,69 +105,79 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity); - $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/'; - if ($_FILES[$varforimage]["tmp_name"]) + $dirforimage=$conf->mycompany->dir_output.'/logos/'; + + $arrayofimages = array('logo', 'logo_squarred'); + + foreach($arrayofimages as $varforimage) { - if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) + if ($_FILES[$varforimage]["tmp_name"]) { - $original_file=$reg[1]; - - $isimage=image_format_supported($original_file); - if ($isimage >= 0) + $reg = array(); + if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { - dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); - if (! is_dir($dirforimage)) - { - dol_mkdir($dirforimage); - } - $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); - if ($result > 0) - { - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO", $original_file, 'chaine', 0, '', $conf->entity); + $original_file=$reg[1]; - // Create thumbs of logo (Note that PDF use original file and not thumbs) - if ($isimage > 0) + $isimage=image_format_supported($original_file); + if ($isimage >= 0) + { + dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); + if (! is_dir($dirforimage)) { - // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... - - // Create small thumb, Used on logon for example - $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); - if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) - { - $imgThumbSmall = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); - } - else dol_syslog($imgThumbSmall); - - // Create mini thumb, Used on menu or for setup page for example - $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); - if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) - { - $imgThumbMini = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); - } - else dol_syslog($imgThumbMini); + dol_mkdir($dirforimage); + } + $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); + if ($result > 0) + { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($varforimage == 'logo_squarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + + dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity); + + // Create thumbs of logo (Note that PDF use original file and not thumbs) + if ($isimage > 0) + { + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + + // Create small thumb, Used on logon for example + $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) + { + $imgThumbSmall = $reg[1]; // Save only basename + dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); + } + else dol_syslog($imgThumbSmall); + + // Create mini thumb, Used on menu or for setup page for example + $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); + if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) + { + $imgThumbMini = $reg[1]; // Save only basename + dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); + } + else dol_syslog($imgThumbMini); + } + else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); + } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { + $error++; + $langs->load("errors"); + $tmparray=explode(':', $result); + setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + } + else + { + $error++; + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } - else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); - } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { - $error++; - $langs->load("errors"); - $tmparray=explode(':', $result); - setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); } else { $error++; - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } } - else - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); - } } } @@ -247,7 +257,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) } } -if ($action == 'addthumb') // Regenerate thumbs +if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumbs { if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"])) { @@ -256,15 +266,20 @@ if ($action == 'addthumb') // Regenerate thumbs // Create thumbs of logo if ($isimage > 0) { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($action == 'addthumbsquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + + $reg = array(); + // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... // Create small thumb. Used on logon for example $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { $imgThumbSmall = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); } else dol_syslog($imgThumbSmall); @@ -273,7 +288,7 @@ if ($action == 'addthumb') // Regenerate thumbs if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) { $imgThumbMini = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); } else dol_syslog($imgThumbMini); @@ -297,24 +312,37 @@ if ($action == 'addthumb') // Regenerate thumbs } } -if ($action == 'removelogo') + +if ($action == 'removelogo' || $action == 'removelogosquarred') { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($action == 'removelogosquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; - if ($mysoc->logo != '') dol_delete_file($logofile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO", $conf->entity); - $mysoc->logo=''; + $logofilename = $mysoc->logo; + if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred; + $logofile=$conf->mycompany->dir_output.'/logos/'.$logofilename; + if ($logofilename != '') dol_delete_file($logofile); + dolibarr_del_const($db, $constant, $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred=''; + else $mysoc->logo=''; - $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; - if ($mysoc->logo_small != '') dol_delete_file($logosmallfile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $conf->entity); - $mysoc->logo_small=''; + $logofilename = $mysoc->logo_small; + if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_small; + $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; + if ($logofilename != '') dol_delete_file($logosmallfile); + dolibarr_del_const($db, $constant."_SMALL", $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred_small=''; + else $mysoc->logo_small=''; - $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini; - if ($mysoc->logo_mini != '') dol_delete_file($logominifile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $conf->entity); - $mysoc->logo_mini=''; + $logofilename = $mysoc->logo_mini; + if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_mini; + $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; + if ($logofilename != '') dol_delete_file($logominifile); + dolibarr_del_const($db, $constant."_MINI", $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini=''; + else $mysoc->logo_mini=''; } @@ -434,7 +462,7 @@ if ($action == 'edit' || $action == 'updateedit') // Logo print ''; + // Logo (squarred) + print ''; + // Note print ''; @@ -829,7 +874,7 @@ else // Logo - print ''; + // Logo (squarred) + print ''; + + // Note print ''; print '
'.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).''; $return.= '
'.$titre.'
'; $return.= '
'; print '
'; - print ''; + print ''; print ''; if (! empty($mysoc->logo_mini)) { print ''.img_delete($langs->trans("Delete")).''; @@ -448,6 +476,23 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print '
'; + print '
'; + print ''; + print ''; + if (! empty($mysoc->logo_squarred_mini)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { + print '   '; + print ''; + } + } else { + print ''; + } + print '
'; + print '
'; print '
'.$langs->trans("Logo").''; + print '
'.$form->textwithpicto($langs->trans("Logo"), $langs->trans("LogoDesc")).''; $tagtd='tagtd '; if ($conf->browser->layout == 'phone') $tagtd=''; @@ -854,7 +899,34 @@ else print '
'.$form->textwithpicto($langs->trans("LogoSquarred"), $langs->trans("LogoSquarredDesc")).''; + + $tagtd='tagtd '; + if ($conf->browser->layout == 'phone') $tagtd=''; + print '
'; + print $mysoc->logo_squarred; + print '
'; + + // It offers the generation of the thumbnail if it does not exist + if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i', $mysoc->logo_squarred)) + { + print '  '; + } + elseif ($mysoc->logo_squarred_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) + { + print ''; + } + else + { + print ''; + } + print '
'; + + print '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 1948ce28a57..a857898f5dc 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -76,6 +76,8 @@ ALTER TABLE llx_holiday_extrafields ADD INDEX idx_holiday_extrafields (fk_object ALTER TABLE llx_societe_rib MODIFY label varchar(200); +ALTER TABLE llx_societe ADD COLUMN logo_squarred varchar(255); + insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300); create table llx_entrepot_extrafields diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 4db88defc68..f312015a662 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -107,6 +107,7 @@ create table llx_societe supplier_order_min_amount double(24,8) DEFAULT NULL, -- min amount for supplier orders default_lang varchar(6), -- default language logo varchar(255) DEFAULT NULL, + logo_squarred varchar(255) DEFAULT NULL, canvas varchar(32) DEFAULT NULL, -- type of canvas if used (null by default) fk_entrepot integer DEFAULT 0, -- if we need a link between third party and warehouse webservices_url varchar(255), -- supplier webservice url diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index afce2e4fa34..b34ca99013d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1070,6 +1070,9 @@ CompanyCountry=Country CompanyCurrency=Main currency CompanyObject=Object of the company Logo=Logo +LogoDesc=Main logo of company. Will be used into generated documents (PDF, ...) +LogoSquarred=Logo (squarred) +LogoSquarredDesc=Must be a squarred icon (width = height). This logo will be used as the favorite icon or other need like for the top menu bar (if not disabled into disaply setup). DoNotSuggestPaymentMode=Do not suggest NoActiveBankAccountDefined=No active bank account defined OwnerOfBankAccount=Owner of bank account %s diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c4c702bc73b..2b4ae2bb7a0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -465,6 +465,9 @@ class Societe extends CommonObject public $logo; public $logo_small; public $logo_mini; + public $logo_squarred; + public $logo_squarred_small; + public $logo_squarred_mini; public $array_options; @@ -1072,6 +1075,7 @@ class Societe extends CommonObject $sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null"); $sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->db->escape($this->default_lang)."'":"null"); $sql .= ",logo = ".(! empty($this->logo)?"'".$this->db->escape($this->logo)."'":"null"); + $sql .= ",logo_squarred = ".(! empty($this->logo_squarred)?"'".$this->db->escape($this->logo_squarred)."'":"null"); $sql .= ",outstanding_limit= ".($this->outstanding_limit!=''?$this->outstanding_limit:'null'); $sql .= ",order_min_amount= ".($this->order_min_amount!=''?$this->order_min_amount:'null'); $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount!=''?$this->supplier_order_min_amount:'null'); @@ -1266,7 +1270,7 @@ class Societe extends CommonObject $sql .= ', s.webservices_url, s.webservices_key'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj'; - $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; + $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.logo_squarred'; $sql .= ', s.fk_shipping_method'; $sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms'; $sql .= ', s.order_min_amount, s.supplier_order_min_amount'; @@ -1420,6 +1424,7 @@ class Societe extends CommonObject $this->modelpdf = $obj->model_pdf; $this->default_lang = $obj->default_lang; $this->logo = $obj->logo; + $this->logo_squarred = $obj->logo_squarred; $this->webservices_url = $obj->webservices_url; $this->webservices_key = $obj->webservices_key; @@ -2110,6 +2115,12 @@ class Societe extends CommonObject $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. $label.= '
'; } + elseif (! empty($this->logo_squarred) && class_exists('Form')) + { + /*$label.= '
'; + $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. + $label.= '
';*/ + } $label.= '
'; @@ -3522,6 +3533,9 @@ class Societe extends CommonObject $this->logo=empty($conf->global->MAIN_INFO_SOCIETE_LOGO)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO; $this->logo_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; $this->logo_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; + $this->logo_squarred=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; + $this->logo_squarred_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; + $this->logo_squarred_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; // Define if company use vat or not $this->tva_assuj=$conf->global->FACTURE_TVAOPTION; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ddd865cbbb2..1e69bdf1ecc 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -902,6 +902,17 @@ table[summary="list_of_modules"] .fa-cog { font-size: !important; } + div#login_left, div#login_right { + min-width: 150px !important; + max-width: 200px !important; + padding-left: 5px !important; + padding-right: 5px !important; + } + + div.login_block { + height: 64px !important; + } + .divmainbodylarge { margin-left: 20px !important; margin-right: 20px !important; } .tdoverflowonsmartphone { @@ -923,11 +934,14 @@ table[summary="list_of_modules"] .fa-cog { padding-bottom: 5px; } + .login_table .tdinputlogin { + min-width: unset !important; + } input, input[type=text], input[type=password], select, textarea { min-width: 20px; } .trinputlogin input[type=text], input[type=password] { - max-width: 180px; + max-width: 140px; } .vmenu .searchform input { max-width: 138px; /* length of input text in the quick search box when using a smartphone and without dolidroid */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 72974ded51f..ba97c329073 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1061,6 +1061,10 @@ table[summary="list_of_modules"] .fa-cog { font-size: px !important; } + .login_vertical_align { + padding-left: 0; + } + .divmainbodylarge { margin-left: 20px; margin-right: 20px; } .tdoverflowonsmartphone { From fc886b9950b03088597a58dc16825d08835fc021 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:29:39 +0200 Subject: [PATCH 053/409] 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 1e69bdf1ecc..22515f9a76f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1105,7 +1105,7 @@ div.blockvmenulogo margin-right: 8px; background-color: rgba(255,255,255,0.7); padding: 0; - border-radius: 5px; + border-radius: 4px; height: px; /* width: 100px; */ max-width: 100px; From ab8199f71aa00a2e4b32d7130f84c2a2f877fa00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:38:49 +0200 Subject: [PATCH 054/409] Fix avoid deletion of file if we still need it --- htdocs/admin/company.php | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 9da2e550501..46bd2352b46 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -321,25 +321,43 @@ if ($action == 'removelogo' || $action == 'removelogosquarred') require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $logofilename = $mysoc->logo; - if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred; + $logofilenamebis = $mysoc->logo_squarred; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred; + $logofilenamebis = $mysoc->logo; + } + $logofile=$conf->mycompany->dir_output.'/logos/'.$logofilename; - if ($logofilename != '') dol_delete_file($logofile); + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logofile); dolibarr_del_const($db, $constant, $conf->entity); if ($action == 'removelogosquarred') $mysoc->logo_squarred=''; else $mysoc->logo=''; $logofilename = $mysoc->logo_small; - if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_small; + $logofilenamebis = $mysoc->logo_squarred_small; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred_small; + $logofilenamebis = $mysoc->logo_small; + } + $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; - if ($logofilename != '') dol_delete_file($logosmallfile); + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logosmallfile); dolibarr_del_const($db, $constant."_SMALL", $conf->entity); if ($action == 'removelogosquarred') $mysoc->logo_squarred_small=''; else $mysoc->logo_small=''; $logofilename = $mysoc->logo_mini; - if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_mini; + $logofilenamebis = $mysoc->logo_squarred_mini; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred_mini; + $logofilenamebis = $mysoc->logo_mini; + } + $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; - if ($logofilename != '') dol_delete_file($logominifile); + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logominifile); dolibarr_del_const($db, $constant."_MINI", $conf->entity); if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini=''; else $mysoc->logo_mini=''; From 4db57f53f9e77d831351c94820ab2ea8200e3c1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:39:33 +0200 Subject: [PATCH 055/409] typo --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b34ca99013d..93bf4b90f94 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1072,7 +1072,7 @@ CompanyObject=Object of the company Logo=Logo LogoDesc=Main logo of company. Will be used into generated documents (PDF, ...) LogoSquarred=Logo (squarred) -LogoSquarredDesc=Must be a squarred icon (width = height). This logo will be used as the favorite icon or other need like for the top menu bar (if not disabled into disaply setup). +LogoSquarredDesc=Must be a squarred icon (width = height). This logo will be used as the favorite icon or other need like for the top menu bar (if not disabled into display setup). DoNotSuggestPaymentMode=Do not suggest NoActiveBankAccountDefined=No active bank account defined OwnerOfBankAccount=Owner of bank account %s From 2fb776ee347e3e051ff0a9e52f93773aa46cd6af Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 11 Oct 2019 11:57:11 +0200 Subject: [PATCH 056/409] NEW add new rule fetchidfromcodeandlabel for categories import --- .../modules/import/import_csv.modules.php | 49 +++++++++++++++++-- .../modules/import/import_xlsx.modules.php | 49 +++++++++++++++++-- htdocs/core/modules/modCategorie.class.php | 11 +++-- 3 files changed, 94 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 734f516fa78..cb3ae176026 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -381,6 +381,11 @@ class ImportCsv extends ModeleImports //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } + // array of fields to column index + $arrayfield = array(); + foreach($sort_array_match_file_to_database as $key => $val) { + $arrayfield[$val] = ($key-1); + } // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) foreach($sort_array_match_file_to_database as $key => $val) @@ -459,14 +464,10 @@ class ImportCsv extends ModeleImports $error++; }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. - } elseif ($class == 'Categorie') { - if ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { - $param_array = array('', $newval, $arrayrecord[1]['val']); - } } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label - if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel' && $class!='Categorie') + if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); @@ -489,6 +490,44 @@ class ImportCsv extends ModeleImports } } } + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeandlabel') + { + $isidorref='id'; + if (! is_numeric($newval) && $newval != '' && ! preg_match('/^id:/i', $newval)) $isidorref='ref'; + $newval=preg_replace('/^(id|ref):/i', '', $newval); + + if ($isidorref == 'ref') { + $file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']); + $class = $objimport->array_import_convertvalue[0][$val]['class']; + $method = $objimport->array_import_convertvalue[0][$val]['method']; + $codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield']; + $code = $arrayrecord[$arrayfield[$codefromfield]]['val']; + if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') { + $newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval]; + } else { + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code); + break; + } + $classinstance = new $class($this->db); + // Try the fetch from code and ref + $param_array = array('', $newval, $code); + call_user_func_array(array($classinstance, $method), $param_array); + $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id; + if ($classinstance->id > 0) // we found record + { + $newval = $classinstance->id; + } else { + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } + } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='zeroifnull') { if (empty($newval)) $newval='0'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1a92062b15f..c5fcc1441e3 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -408,6 +408,11 @@ class ImportXlsx extends ModeleImports //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } + // array of fields to column index + $arrayfield = array(); + foreach($sort_array_match_file_to_database as $key => $val) { + $arrayfield[$val] = ($key-1); + } // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) foreach($sort_array_match_file_to_database as $key => $val) @@ -486,14 +491,10 @@ class ImportXlsx extends ModeleImports $error++; }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. - } elseif ($class == 'Categorie') { - if ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { - $param_array = array('', $newval, $arrayrecord[1]['val']); - } } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label - if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel' && $class!='Categorie') + if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); @@ -516,6 +517,44 @@ class ImportXlsx extends ModeleImports } } } + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeandlabel') + { + $isidorref='id'; + if (! is_numeric($newval) && $newval != '' && ! preg_match('/^id:/i', $newval)) $isidorref='ref'; + $newval=preg_replace('/^(id|ref):/i', '', $newval); + + if ($isidorref == 'ref') { + $file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']); + $class = $objimport->array_import_convertvalue[0][$val]['class']; + $method = $objimport->array_import_convertvalue[0][$val]['method']; + $codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield']; + $code = $arrayrecord[$arrayfield[$codefromfield]]['val']; + if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') { + $newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval]; + } else { + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code); + break; + } + $classinstance = new $class($this->db); + // Try the fetch from code and ref + $param_array = array('', $newval, $code); + call_user_func_array(array($classinstance, $method), $param_array); + $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id; + if ($classinstance->id > 0) // we found record + { + $newval = $classinstance->id; + } else { + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } + } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='zeroifnull') { if (empty($newval)) $newval='0'; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index e8a1bd218cd..eb9e2c6b4a1 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -413,11 +413,12 @@ class modCategorie extends DolibarrModules $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); $this->import_convertvalue_array[$r] = array( 'ca.fk_parent' => array( - 'rule' => 'fetchidfromcodeorlabel', - 'classfile' => '/categories/class/categorie.class.php', - 'class' => 'Categorie', - 'method' => 'fetch', - 'element' => 'category' + 'rule' => 'fetchidfromcodeandlabel', + 'classfile' => '/categories/class/categorie.class.php', + 'class' => 'Categorie', + 'method' => 'fetch', + 'element' => 'category', + 'codefromfield' => 'ca.type' ) ); $typeexample=""; From 5801d09dbeb7480e59bb59d6b31249e1f6fe7390 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 12:28:13 +0200 Subject: [PATCH 057/409] NEW Use the squarre logo as favicon of pages --- ChangeLog | 1 + htdocs/core/lib/security2.lib.php | 5 +++- htdocs/core/menus/standard/eldy.lib.php | 6 ++-- htdocs/main.inc.php | 37 ++++++++++++------------- htdocs/public/test/test_arrays.php | 1 - htdocs/theme/eldy/manifest.json.php | 10 +++---- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8b7db19236..ede0e10a89f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ Following changes may create regressions for some external modules, but were nec * Removed function dol_micro_time. Use native PHP microtime instead. * The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE. * The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS. +* If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu. ***** ChangeLog for 10.0.2 compared to 10.0.1 ***** diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 07eecf0f352..c81ea9d98d7 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -282,8 +282,11 @@ if (! function_exists('dol_loginfunction')) // Set jquery theme $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:''); - $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1); + + $favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png'; + if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; + $jquerytheme = 'base'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dbf56429086..0bfc9f9b7b9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -478,16 +478,16 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Show logo company if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); + //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); } - elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - } + }*/ else { $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2d612f5808d..33c0e289aed 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1195,7 +1195,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) */ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $disablejmobile = 0, $disablenofollow = 0) { - global $db, $conf, $langs, $user, $hookmanager; + global $db, $conf, $langs, $user, $mysoc, $hookmanager; top_httphead(); @@ -1224,9 +1224,11 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; // Favicon - $favicon = DOL_MAIN_URL_ROOT . '/theme/'.$conf->theme.'/img/favicon.ico'; + $favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png'; + if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; if (empty($conf->dol_use_jmobile)) print ''."\n"; // Not required into an Android webview + //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; @@ -1614,9 +1616,6 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead print '
'; - print '
'; - print ''; - print '     '; - print ''; - print '
'; - print '
'; +print '
'; +print ''; +//print '     '; +//print ''; +print '
'; +//print '
'; - print ''; -} -else -{ - /* - * Show parameters - */ +print ''; - // Actions buttons - //print '
'; - //print ''.$langs->trans("Modify").''; - //print '

'; - - print '
'; - print ''; - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; - print $conf->global->MAIN_INFO_ACCOUNTANT_NAME; - print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '
'.$langs->trans("CompanyCountry").''; - if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY)) - { - $code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2); - $img=picto_from_langcode($code); - print $img?$img.' ':''; - print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 1); - } - print '
'.$langs->trans("Region-State").''; - else print '
'.$langs->trans("State").''; - if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE)) print getState($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); - else print ' '; - print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE, $mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX, $mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL, 0, 0, 0, 80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB, '_blank', 80) . '
'.$langs->trans("AccountantFileNumber").'' . $conf->global->MAIN_INFO_ACCOUNTANT_CODE . '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '
'; - print "
"; - - print ''; - - // Actions buttons - print '
'; - print ''; - print '
'; -} llxFooter(); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 46bd2352b46..dde962fe9bc 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -383,919 +383,423 @@ $head = company_admin_prepare_head(); dol_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company'); -print ''.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Modify"), $langs->transnoentities("Save"))."
\n"; +print ''.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."
\n"; print "
\n"; -if ($action == 'edit' || $action == 'updateedit') + +/** + * Edit parameters + */ +print "\n".''."\n"; + +print '
'; +print ''; +print ''; + +print ''; +print ''."\n"; + +// Name + +print ''."\n"; + +// Addresse + +print ''."\n"; + + +print ''."\n"; + + +print ''."\n"; + +// Country + +print ''."\n"; + + +print ''; +} +// ProfId5 +if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') +{ + + print ''; +} + +// ProfId6 +if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') +{ + + print ''; +} + +// TVA Intra + +print ''; + +// Object of the company + +print ''; +print ''; + +print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; +print '
'; +print '
'; +print '
'; +print '
'; +//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization +print $form->select_country($mysoc->country_id, 'country_id'); +if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); +print '
'; +$state_id=0; +if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) { - /** - * Edition des parametres - */ - print "\n".''."\n"; - - print ''; - print ''; - print ''; - - print ''; - print ''."\n"; - - // Name - - print ''."\n"; - - // Addresse - - print ''."\n"; + $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; +} +$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id'); +print ''."\n"; - print ''."\n"; +print ''."\n"; - print ''."\n"; - - // Country - - print ''."\n"; +print ''; +print ''."\n"; - print ''; +print ''."\n"; + + +print ''; +print ''."\n"; + +// Web +print ''; +print ''."\n"; + +// Barcode +if (! empty($conf->barcode->enabled)) { + + print ''; + print ''; +} + +// Logo +print ''; + +// Logo (squarred) +print ''; + +// Note +print ''; +print ''; + +print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; - print '
'; - print '
'; - print '
'; +print $form->selectCurrency($conf->currency, "currency"); +print '
'; - print '
'; - //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization - print $form->select_country($mysoc->country_id, 'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'; +print '
'; - $state_id=0; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) +print '
'; +print '
'; +print '
'; +print '
'; + print '
'; +print '
'; +print ''; +print ''; +if (! empty($mysoc->logo_mini)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { + print '   '; + print ''; + } +} else { + print ''; +} +print '
'; +print '
'; +print '
'; +print ''; +print ''; +if (! empty($mysoc->logo_squarred_mini)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { + print '   '; + print ''; + } +} else { + print ''; +} +print '
'; +print '
'; +print '
'; + +print '
'; + +// IDs of the company (country-specific) +print ''; +print ''; + +$langs->load("companies"); + +// Managing Director(s) + +print ''; + +// GDPR contact + +print ''; + +// Capital + +print ''; + +// Juridical Status + +print ''; + +// ProfID1 +if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') +{ + + print ''."\n"; - - - print ''."\n"; - - - print ''; - print ''."\n"; - - - print ''; - print ''."\n"; - - - print ''; - print ''."\n"; - - // Web - print ''; - print ''."\n"; - - // Barcode - if (! empty($conf->barcode->enabled)) { - - print ''; - print ''; - } - - // Logo - print ''; - - // Logo (squarred) - print ''; - - // Note - print ''; - print ''; - - print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; +print '
'; +print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); +print ''; +print '
'; +print '
'; +if ($mysoc->country_code) { + print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code'); +} else { + print $countrynotdefined; +} +print '
'; + if (! empty($mysoc->country_code)) { - $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); - $state_id=$tmp[0]; + print ''; } - $formcompany->select_departement($state_id, $mysoc->country_code, 'state_id'); - print '
'; - print $form->selectCurrency($conf->currency, "currency"); - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print ''; - print ''; - if (! empty($mysoc->logo_mini)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print '   '; - print ''; - } - } else { - print ''; - } - print '
'; - print '
'; - print '
'; - print ''; - print ''; - if (! empty($mysoc->logo_squarred_mini)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { - print '   '; - print ''; - } - } else { - print ''; - } - print '
'; - print '
'; - print '
'; - - print '
'; - - // IDs of the company (country-specific) - print ''; - print ''; - - $langs->load("companies"); - - // Managing Director(s) - - print ''; - - // GDPR contact - - print ''; - - // Capital - - print ''; - - // Juridical Status - - print ''; - - // ProfID1 - if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId2 - if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId3 - if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId4 - if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId5 - if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId6 - if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') - { - - print ''; - } - - // TVA Intra - - print ''; - - // Object of the company - - print ''; - print ''; - - print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; - print '
'; - print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); - print ''; - print '
'; - print '
'; - if ($mysoc->country_code) { - print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code'); - } else { + else + { print $countrynotdefined; } print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - print ''; - print '
'; - print '
'; - - - // Fiscal year start - print '
'; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - - print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'; - print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '
"; - - - // Fiscal options - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ""; - print '\n"; - - - print ""; - print '\n"; - - print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'; - print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; - print "
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
"; - print "
'; - print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; - print "
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
"; - print "
"; - - /* - * Local Taxes - */ - if ($mysoc->useLocalTax(1)) - { - // Local Tax 1 - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - // Note: When option is not set, it must not appears as set on on, because there is no default value for this option - print ""; - print '\n"; - - - print ""; - print '\n"; - print "
'.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; - print ''; - print ""; - $example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsUsedExample"?"\n":""); - if(! isOnlyOneLocalTax(1)) - { - print ''; - } - - $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc")); - - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
: '; - $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); - print '
'.$langs->trans("CalcLocaltax").': '; - print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); - print '
"; - print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - } - if ($mysoc->useLocalTax(2)) - { - // Local Tax 2 - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - // Note: When option is not set, it must not appears as set on on, because there is no default value for this option - print ""; - print '\n"; - - - print ""; - print '\n"; - print "
'.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ''; - print ""; - $example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsUsedExample"?"\n":""); - if(! isOnlyOneLocalTax(2)) - { - print ''; - } - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
: '; - $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); - print '
: '; - print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); - print '
"; - print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - } - - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - print '
'; - - print ''; } -else + +// ProfId2 +if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { - /* - * Show parameters - */ - // Actions buttons - //print '
'; - //print ''.$langs->trans("Modify").''; - //print '

'; - - print '
'; - print ''; - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - // Web - - print ''; - - // Barcode - - if (! empty($conf->barcode->enabled)) - { - print ''; - } - - // Logo - - print ''; +} - // Logo (squarred) +// ProfId3 +if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') +{ - print ''; +} - // Note - print ''; +// ProfId4 +if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') +{ - print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM; - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyName")).''; - print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyCountry").''; - if ($mysoc->country_code) + print '
'; + if (! empty($mysoc->country_code)) { - $img=picto_from_langcode($mysoc->country_code); - print $img?$img.' ':''; - print getCountry($mysoc->country_code, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - print '
'.$langs->trans("Region-State").''; - else print '
'.$langs->trans("State").''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) - { - $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); - $state_id=$tmp[0]; - print getState($state_id, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); - } - print '
'.$langs->trans("CompanyCurrency").''; - print currency_name($conf->currency, 0); - print ' ('.$conf->currency; - print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : ''); - print ')'; - print ' - '.$langs->trans("PriceFormatInCurrentLanguage", $langs->defaultlang).' : '.price(price2num('99.333333333', 'MT'), 1, $langs, 1, -1, -1, $conf->currency); - print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL, $mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX, $mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL, 0, 0, 0, 80) . '
'.$langs->trans("Web").''; - $arrayofurl = preg_split('/\s/', $conf->global->MAIN_INFO_SOCIETE_WEB); - foreach($arrayofurl as $urltoshow) - { - if ($urltoshow) print dol_print_url($urltoshow, '_blank', 80); - } - print '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$form->textwithpicto($langs->trans("Logo"), $langs->trans("LogoDesc")).''; - - $tagtd='tagtd '; - if ($conf->browser->layout == 'phone') $tagtd=''; - print '
'; - print $mysoc->logo; - print '
'; - - // It offers the generation of the thumbnail if it does not exist - if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i', $mysoc->logo)) - { - print '  '; - } - elseif ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - print ''; + print ''; } else { - print ''; + print $countrynotdefined; } - print '
'; - print '
'.$form->textwithpicto($langs->trans("LogoSquarred"), $langs->trans("LogoSquarredDesc")).''; - - $tagtd='tagtd '; - if ($conf->browser->layout == 'phone') $tagtd=''; - print '
'; - print $mysoc->logo_squarred; - print '
'; - - // It offers the generation of the thumbnail if it does not exist - if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i', $mysoc->logo_squarred)) + print '
'; + if (! empty($mysoc->country_code)) { - print '  '; - } - elseif ($mysoc->logo_squarred_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) - { - print ''; + print ''; } else { - print ''; + print $countrynotdefined; } - print ''; - print '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'; - print "
"; + print '
'; + if (! empty($mysoc->country_code)) + { + print ''; + } + else + { + print $countrynotdefined; + } + print '
'; + if (! empty($mysoc->country_code)) + { + print ''; + } + else + { + print $countrynotdefined; + } + print '
'; + if (! empty($mysoc->country_code)) + { + print ''; + } + else + { + print $countrynotdefined; + } + print '
'; +print ''; +print '
'; +print '
'; + + +// Fiscal year start +print '
'; +print ''; +print ''; +print ''; +print "\n"; + +print ''; + +print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'; +print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '
"; + + +// Fiscal options +print '
'; +print ''; +print ''; +print ''; +print ''; +print "\n"; + + +print ""; +print '\n"; + + +print ""; +print '\n"; + +print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'; +print ""; +print ""; +if ($mysoc->country_code == 'FR') print "\n"; +print "
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
"; +print "
'; +print ""; +print ""; +if ($mysoc->country_code == 'FR') print "\n"; +print "
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
"; +print "
"; + +/* + * Local Taxes + */ +if ($mysoc->useLocalTax(1)) +{ + // Local Tax 1 print '
'; - - - // IDs of the company (country-specific) - print '
'; - print ''; - - print '
'; - print ''; - print ''; - - // Managing Director(s) - - print ''; - - // GDPR Contact - - print ''; - - // Capital - - print ''; - - // Juridical Status - - print ''; - - // ProfId1 - if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId2 - if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId3 - if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId4 - if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId5 - if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId6 - if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') - { - - print ''; - } - - // VAT - - print ''; - print ''; - print ''; - - - print ''; - - print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("ManagingDirectors").''; - print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '
'.$langs->trans("GDPRContact").''; - print $conf->global->MAIN_INFO_GDPR . '
'.$langs->trans("Capital").''; - print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; - print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); - print '
'.$langs->transcountry("ProfId1", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_SIREN)) - { - print $conf->global->MAIN_INFO_SIREN; - $s = $mysoc->id_prof_url(1, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId2", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_SIRET)) - { - print $conf->global->MAIN_INFO_SIRET; - $s = $mysoc->id_prof_url(2, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId3", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_APE)) - { - print $conf->global->MAIN_INFO_APE; - $s = $mysoc->id_prof_url(3, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId4", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_RCS)) - { - print $conf->global->MAIN_INFO_RCS; - $s = $mysoc->id_prof_url(4, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId5", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_PROFID5)) - { - print $conf->global->MAIN_INFO_PROFID5; - $s = $mysoc->id_prof_url(5, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId6", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_PROFID6)) - { - print $conf->global->MAIN_INFO_PROFID6; - $s = $mysoc->id_prof_url(6, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->trans("VATIntra").''; - if (! empty($conf->global->MAIN_INFO_TVAINTRA)) - { - $s=''; - $s.=$conf->global->MAIN_INFO_TVAINTRA; - $s.=''; - if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC()) - { - $s.=' - '; - if (! empty($conf->use_javascript_ajax)) - { - print "\n"; - print ''; - print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else - { - $s.='id_country).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; - } - } - print $s; - } - else - { - print ' '; - } - print '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'; - print "
"; - - print '
'; - - /* - * fiscal year beginning - */ - print '
'; - - print '
'; print ''; print ''; - print ''; + print ''; + print ''; print "\n"; + // Note: When option is not set, it must not appears as set on on, because there is no default value for this option + print ""; + print '\n"; - /* - * tax options - */ + + print ""; + print '\n"; + print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; + print ''; + print ""; + $example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); + print ($example!="LocalTax1IsUsedExample"?"\n":""); + if(! isOnlyOneLocalTax(1)) + { + print ''; + } - print ''; + $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc")); + print ''; print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
: '; + $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); + print '
'.$langs->trans("FiscalMonthStart").''; - $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1; - print dol_print_date(dol_mktime(12, 0, 0, $monthstart, 1, 2000, 1), '%B', 'gm') . '
'.$langs->trans("CalcLocaltax").': '; + print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); + print '
"; - print ""; + print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; + print ""; + print ""; + $example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); + print ($example!="LocalTax1IsNotUsedExample"?"\n":""); + print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; + print "
"; +} +if ($mysoc->useLocalTax(2)) +{ + // Local Tax 2 print '
'; - print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; - print '"; + // Note: When option is not set, it must not appears as set on on, because there is no default value for this option + print ""; print '\n"; - print '"; + print ""; print '\n"; - print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").''.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
'; - print "global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; + print '
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
'; + print ""; + $example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); + print ($example!="LocalTax2IsUsedExample"?"\n":""); + if(! isOnlyOneLocalTax(2)) + { + print ''; + } + print ''; print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
: '; + $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); + print '
: '; + print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); + print '
"; print "
'; - print "global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; + print ""; + $example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); + print ($example!="LocalTax2IsNotUsedExample"?"\n":""); print "
".$langs->trans("VATIsNotUsedDesc")."
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; print "
"; - print "
"; - - /* - * Local Taxes - */ - if ($mysoc->useLocalTax(1)) // True if we found at least on vat with a setup adding a localtax 1 - { - // Local Tax 1 - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ""; - print '\n"; - - - print '"; - print '\n"; - - print "
'.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
"; - print "global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsUsedExample"?"\n":""); - if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0) - { - print ''; - } - print ''; - print "
".$langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'
'.$langs->trans("CalcLocaltax").': '; - if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0) - { - print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==1) - { - print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ - print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); - } - - print '
"; - print "
'; - print "global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - print "
"; - } - if ($mysoc->useLocalTax(2)) // True if we found at least on vat with a setup adding a localtax 1 - { - // Local Tax 2 - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ""; - print '\n"; - - - print ""; - print '\n"; - - print "
'.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
"; - print "global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsUsedExample"?"\n":""); - if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0) - { - print ''; - } - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'
'.$langs->trans("CalcLocaltax").': '; - if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0) - { - print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==1) - { - print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==2) - { - print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); - } - - print '
"; - print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - print "
"; - } - - - // Actions buttons - print '
'; - print ''; - print '
'; } + +print '
'; +print ''; +print '
'; + +print ''; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index edf3e4dbe86..df8929fd8fe 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -224,219 +224,217 @@ print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print ''.$langs->trans("DisplayDesc")."
\n"; print "
\n"; -if (1 == 1) // Edit +//WYSIWYG Editor +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + +print '
'; +print ''; +print ''; + +clearstatcache(); + +print '
'; +print ''; +print ''; +print ''; +print ''; + +// Default language +print ''; +print ''; +print ''; + +// Multilingual GUI +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Language").' 
'.$langs->trans("DefaultLanguage").''; +print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); +print ' 
'.$langs->trans("EnableMultilangInterface").''; +print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); +print ' 

'."\n"; + +// Themes and themes options +showSkins(null, 1); +print '
'; + +// Other +print ''; +print ''; +print ''; +print ''; + +// Disable javascript and ajax +print ''; +print ''; +print ''; + +// Max size of lists +print ''; +print ''; +print ''; + +// Max size of short lists on customer card +print ''; +print ''; +print ''; + +// show input border +/* + print ''; + print ''; + print ''; + */ + +// First day for weeks +print ''; +print ''; +print ''; + +// DefaultWorkingDays +print ''; +print ''; +print ''; + +// DefaultWorkingHours +print ''; +print ''; +print ''; + +// Firstname/Name +print ''; +print ''; +print ''; + +// Hide unauthorized button +print ''; +print ''; +print ''; + +// Hide version link +/* + +print ''; +print ''; +print ''; +*/ + +// Show bugtrack link +print ''; +print ''; +print ''; + +// Hide wiki link on login page +$pictohelp=''; +print ''; +print ''; +print ''; + +// Message of the day on home page +$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount')); +complete_substitutions_array($substitutionarray, $langs); + +print ''."\n"; + +print '
'.$langs->trans("Miscellaneous").' 
'.$langs->trans("DisableJavascript").''; +print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1); +print ' 
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("showInputBorder").''; + print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); + print ' 
'.$langs->trans("WeekStartOnDay").''; +print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); +print ' 
'.$langs->trans("DefaultWorkingDays").''; +print ''; +print ' 
'.$langs->trans("DefaultWorkingHours").''; +print ''; +print ' 
'.$langs->trans("FirstnameNamePosition").''; +$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); +print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); +print ' 
'.$langs->trans("ButtonHideUnauthorized").''; +print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1); +print ' 
'.$langs->trans("HideVersionLink").''; +print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); +print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; +print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); +print ' 
'.$langs->trans("DisableLinkToHelp", $pictohelp).''; +print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1); +print ' 
'; +$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +foreach($substitutionarray as $key => $val) { - //WYSIWYG Editor - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - - print ''; - print ''; - print ''; - - clearstatcache(); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - // Default language - print ''; - print ''; - print ''; - - // Multilingual GUI - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Language").' 
'.$langs->trans("DefaultLanguage").''; - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); - print ' 
'.$langs->trans("EnableMultilangInterface").''; - print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); - print ' 

'."\n"; - - // Themes and themes options - showSkins(null, 1); - print '
'; - - // Other - print ''; - print ''; - print ''; - print ''; - - // Disable javascript and ajax - print ''; - print ''; - print ''; - - // Max size of lists - print ''; - print ''; - print ''; - - // Max size of short lists on customer card - print ''; - print ''; - print ''; - - // show input border - /* - print ''; - print ''; - print ''; - */ - - // First day for weeks - print ''; - print ''; - print ''; - - // DefaultWorkingDays - print ''; - print ''; - print ''; - - // DefaultWorkingHours - print ''; - print ''; - print ''; - - // Firstname/Name - print ''; - print ''; - print ''; - - // Hide unauthorized button - print ''; - print ''; - print ''; - - // Hide version link - /* - - print ''; - print ''; - print ''; - */ - - // Show bugtrack link - print ''; - print ''; - print ''; - - // Hide wiki link on login page - $pictohelp=''; - print ''; - print ''; - print ''; - - // Message of the day on home page - $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount')); - complete_substitutions_array($substitutionarray, $langs); - - print ''."\n"; - - print '
'.$langs->trans("Miscellaneous").' 
'.$langs->trans("DisableJavascript").''; - print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1); - print ' 
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("showInputBorder").''; - print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); - print ' 
'.$langs->trans("WeekStartOnDay").''; - print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); - print ' 
'.$langs->trans("DefaultWorkingDays").''; - print ''; - print ' 
'.$langs->trans("DefaultWorkingHours").''; - print ''; - print ' 
'.$langs->trans("FirstnameNamePosition").''; - $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); - print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); - print ' 
'.$langs->trans("ButtonHideUnauthorized").''; - print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1); - print ' 
'.$langs->trans("HideVersionLink").''; - print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); - print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; - print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); - print ' 
'.$langs->trans("DisableLinkToHelp", $pictohelp).''; - print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1); - print ' 
'; - $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; - foreach($substitutionarray as $key => $val) - { - $texthelp.=$key.'
'; - } - print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); - - print '
'; - - $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); - $doleditor->Create(); - - print '
'."\n"; - - print '
'; - - // Other - print ''; - print ''; - print ''; - print ''; - - // Message on login page - $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user')); - complete_substitutions_array($substitutionarray, $langs); - print ''."\n"; - - // Hide helpcenter link on login page - print ''; - print ''; - print ''; - - // Background - print ''; - - print '
'.$langs->trans("LoginPage").' 
'; - $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; - foreach($substitutionarray as $key => $val) - { - $texthelp.=$key.'
'; - } - print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); - print '
'; - $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); - $doleditor->Create(); - print '
'.$langs->trans("DisableLinkToHelpCenter").''; - print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1); - print ' 
'; - print '
'; - $disabled = ''; - if (! empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"'; - print ''; - if ($disabled) - { - print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') '; - } - if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { - print '   '; - print ''; - } - } else { - print ''; - } - print '
'; - print '
'."\n"; - - - print '
'; - print '
'; - print ''; - print '
'; - - print ''; + $texthelp.=$key.'
'; } +print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); + +print '
'; + +$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); +$doleditor->Create(); + +print '
'."\n"; + +print '
'; + +// Other +print ''; +print ''; +print ''; +print ''; + +// Message on login page +$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user')); +complete_substitutions_array($substitutionarray, $langs); +print ''."\n"; + +// Hide helpcenter link on login page +print ''; +print ''; +print ''; + +// Background +print ''; + +print '
'.$langs->trans("LoginPage").' 
'; +$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +foreach($substitutionarray as $key => $val) +{ + $texthelp.=$key.'
'; +} +print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); +print '
'; +$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); +$doleditor->Create(); +print '
'.$langs->trans("DisableLinkToHelpCenter").''; +print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1); +print ' 
'; +print '
'; +$disabled = ''; +if (! empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"'; +print ''; +if ($disabled) +{ + print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') '; +} +if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { + print '   '; + print ''; + } +} else { + print ''; +} +print '
'; +print '
'."\n"; + + +print '
'; +print '
'; +print ''; +print '
'; + +print ''; + // End of page llxFooter(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 93bf4b90f94..58cd78e102b 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1118,7 +1118,7 @@ LogEventDesc=Enable logging for specific security events. Administrators the log AreaForAdminOnly=Setup parameters can be set by administrator users only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. SystemAreaForAdminOnly=This area is available to administrator users only. Dolibarr user permissions cannot change this restriction. -CompanyFundationDesc=Edit the information of the company/entity. Click on "%s" or "%s" button at the bottom of the page. +CompanyFundationDesc=Edit the information of the company/entity. Click on "%s" button at the bottom of the page. AccountantDesc=If you have an external accountant/bookkeeper, you can edit here its information. AccountantFileNumber=Accountant code DisplayDesc=Parameters affecting the look and behaviour of Dolibarr can be modified here. From c21224ef96932cd86a3fdcbd70800b25749c19b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 14:24:47 +0200 Subject: [PATCH 063/409] Align code of auguria menu handler with new architecture --- htdocs/core/menus/standard/auguria.lib.php | 115 ++++++++++---------- htdocs/core/menus/standard/auguria_menu.php | 27 ++++- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/menus/standard/eldy_menu.php | 4 +- 4 files changed, 81 insertions(+), 67 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 66f4dac2a44..39e2150280e 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -39,10 +39,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; */ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 0, $mode = '') { - global $user,$conf,$langs,$dolibarr_main_db_name; + global $user,$conf,$langs,$mysoc; + global $dolibarr_main_db_name; - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; + $mainmenu=(empty($_SESSION["mainmenu"])?'':$_SESSION["mainmenu"]); + $leftmenu=(empty($_SESSION["leftmenu"])?'':$_SESSION["leftmenu"]); $id='mainmenu'; $listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -53,17 +54,17 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if (empty($noout)) print_start_menu_array_auguria(); - global $usemenuhider; - $usemenuhider = 1; + global $usemenuhider; + $usemenuhider = 1; - // Show/Hide vertical menu - if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + // Show/Hide vertical menu. The hamburger icon for .menuhider action. + if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $showmode=1; $classname = 'class="tmenu menuhider"'; $idsel='menu'; - $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); + $menu->add('#', (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } $num = count($newTabMenu); @@ -125,20 +126,44 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $menu->liste = dol_sort_array($menu->liste, 'position'); // Output menu entries - foreach($menu->liste as $menkey => $menuval) + // Show logo company + if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'], $menuval['classname'], $menuval['enabled']); - if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); - if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']); + //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); + $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); + if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); + } + else + { + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; + } + $title=$langs->trans("GoIntoSetupToChangeLogo"); + + print "\n".''."\n"; + print_start_menu_entry_auguria('companylogo', 'class="tmenu tmenucompanylogo"', 1); + + print ''."\n"; + + print_end_menu_entry_auguria(4); + } + + if (empty($noout)) { + foreach($menu->liste as $menuval) + { + print_start_menu_entry_auguria($menuval['idsel'], $menuval['classname'], $menuval['enabled']); + print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); + print_end_menu_entry_auguria($menuval['enabled']); + } } $showmode=1; - if (empty($noout)) print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode); - if (empty($noout)) print_end_menu_entry_auguria($showmode); - - if (empty($noout)) print_end_menu_array_auguria(); - - print "\n"; + if (empty($noout)) { + print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode); + print_end_menu_entry_auguria($showmode); + print_end_menu_array_auguria(); + } return 0; } @@ -193,16 +218,16 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; - print ''; + print ''; print ''; print $text; print ''; print ''; } - if ($showmode == 2) + elseif ($showmode == 2) { print '
'; print ''; @@ -244,17 +269,18 @@ function print_end_menu_array_auguria() /** * Core function to output left menu auguria + * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) * * @param DoliDB $db Database handler - * @param array $menu_array_before Table of menu entries to show before entries of menu handler - * @param array $menu_array_after Table of menu entries to show after entries of menu handler + * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) + * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. * @param array $moredata An array with more data to output - * @return int Nb of entries + * @return int Nb of menu entries */ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) { @@ -268,35 +294,6 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t global $usemenuhider; $usemenuhider = 0; - // Show logo company - if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); - $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); - if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - } - elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - } - else - { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; - } - $title=$langs->trans("GoIntoSetupToChangeLogo"); - print "\n".''."\n"; - print ''."\n"; - } - if (is_array($moredata) && ! empty($moredata['searchform'])) // searchform can contains select2 code or link to show old search form or link to switch on search page { print "\n"; @@ -355,9 +352,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $db->free($resql); } - if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account + if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account { - $newmenu->add('', $langs->trans("Journalization"), 0, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy'); + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy'); // Multi journal $sql = "SELECT rowid, code, label, nature"; @@ -390,7 +387,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t if ($objp->nature == 9) $nature="hasnew"; // To enable when page exists - if (! empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') $nature=''; } @@ -399,7 +396,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t { $langs->load('accountancy'); $journallabel=$langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... - if (empty($leftmenu) || preg_match('/accountancy/', $leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); } $i++; } @@ -444,7 +441,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t */ } - if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP + if (! empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP=20; $i=1; diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index c4622f2d6ee..b3c5814240c 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -111,15 +111,18 @@ class MenuManager $tabMenu=array(); $menuArbo = new Menubase($this->db, 'auguria'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu); - $this->tabMenu=$tabMenu; - } + //var_dump($tabMenu); + + //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } + } /** * Show menu + * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * - * @param string $mode 'top', 'left', 'jmobile' (used to get full xml ul/li menu) + * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output * @return int 0 or nb of top menu entries if $mode = 'topnb' */ @@ -138,9 +141,18 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - if ($mode == 'top') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); - if ($mode == 'left') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); - + if (empty($conf->global->MAIN_MENU_INVERT)) + { + if ($mode == 'top') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + if ($mode == 'left') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); + } + else + { + $conf->global->MAIN_SHOW_LOGO=0; + if ($mode == 'top') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); + if ($mode == 'left') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + } + if ($mode == 'topnb') { print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); @@ -315,5 +327,8 @@ class MenuManager } unset($this->menu); + + //print 'xx'.$mode; + return 0; } } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 0bfc9f9b7b9..5d9a637de58 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -629,7 +629,7 @@ function print_end_menu_array() * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. * @param array $moredata An array with more data to output - * @return int nb of menu entries + * @return int Nb of menu entries */ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) { diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index d8a47d45c68..8389db029be 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -64,6 +64,8 @@ class MenuManager */ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') { + global $conf, $user, $langs; + // On sauve en session le menu principal choisi if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; @@ -117,7 +119,7 @@ class MenuManager /** * Show menu. - * Module defined in sql tables were stored into $this->tabMenu BEFORE this is called. + * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output From 7ce01c5ceb917f10dc3696055705d04b872a2e3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 14:42:55 +0200 Subject: [PATCH 064/409] Look and feel v11 --- htdocs/admin/boxes.php | 2 +- htdocs/admin/delais.php | 4 +- htdocs/admin/ihm.php | 1 - htdocs/admin/limits.php | 2 +- htdocs/admin/menus.php | 143 ++-- htdocs/admin/pdf.php | 672 ++++++------------ htdocs/admin/security_other.php | 2 +- htdocs/admin/sms.php | 2 +- htdocs/admin/translation.php | 2 +- .../box_accountancy_suspense_account.php | 8 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 11 files changed, 285 insertions(+), 555 deletions(-) diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 58c07b5ca3e..ca90c836929 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -222,7 +222,7 @@ llxHeader('', $langs->trans("Boxes")); print load_fiche_titre($langs->trans("Boxes"), '', 'title_setup'); -print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; +print ''.$langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; /* * Search for the default active boxes for each possible position diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 47f668f69c3..d69a14deb2e 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -174,8 +174,8 @@ llxHeader(); print load_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"), '', 'title_setup'); -print $langs->transnoentities("DelaysOfToleranceDesc", img_warning()); -print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."
\n"; +print ''.$langs->transnoentities("DelaysOfToleranceDesc", img_warning()); +print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."
\n"; print "
\n"; $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index df8929fd8fe..dfbb548f5e0 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -222,7 +222,6 @@ $formadmin=new FormAdmin($db); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print ''.$langs->trans("DisplayDesc")."
\n"; -print "
\n"; //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index c9e69cc469e..ea19b7034a6 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -90,7 +90,7 @@ llxHeader(); print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup'); -print $langs->trans("LimitsDesc")."
\n"; +print ''.$langs->trans("LimitsDesc")."
\n"; print "
\n"; if ($action == 'edit') diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index b334ccadf45..4187c4d3eb4 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -159,116 +159,63 @@ print ''.$langs->trans("MenusDesc")."
\n"; print "
\n"; -if ($action == 'edit') -{ - clearstatcache(); +clearstatcache(); - // Gestionnaires de menu - print ''; - print ''; - print ''; - print ''; - print ''; +// Gestionnaires de menu +print '
'.$langs->trans("Menu").''; - print $form->textwithpicto($langs->trans("InternalUsers"), $langs->trans("InternalExternalDesc")); - print ''; - print $form->textwithpicto($langs->trans("ExternalUsers"), $langs->trans("InternalExternalDesc")); - print '
'; +print ''; +print ''; +print ''; +print ''; - // Menu top - print ''; - print ''; - print ''; - print ''; +// Menu top +print ''; +print ''; +print ''; +print ''; - // Menu smartphone - print ''; - print ''; - print ''; - print ''; +// Menu smartphone +print ''; +print '
'.$langs->trans("Menu").''; +print $form->textwithpicto($langs->trans("InternalUsers"), $langs->trans("InternalExternalDesc")); +print ''; +print $form->textwithpicto($langs->trans("ExternalUsers"), $langs->trans("InternalExternalDesc")); +print '
'.$langs->trans("DefaultMenuManager").''; - $formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled'); - print ''; - $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED, 'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?'':' disabled'); - print '
'.$langs->trans("DefaultMenuManager").''; +$formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled'); +print ''; +$formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED, 'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?'':' disabled'); +print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; - $formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled'); - print ''; - $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled'); - print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; +$formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled'); - print '
'; -} -else -{ - // Gestionnaires de menu - print ''; - print ''; - print ''; - print ''; - print ''; - - - print ''; - print ''; - print ''; - print ''; - - - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Menu").''; - print $form->textwithpicto($langs->trans("InternalUsers"), $langs->trans("InternalExternalDesc")); - print ''; - print $form->textwithpicto($langs->trans("ExternalUsers"), $langs->trans("InternalExternalDesc")); - print '
'.$langs->trans("DefaultMenuManager").''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED)); - print $filelib; - print ''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED)); - print $filelib; - print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED)); - print $filelib; - if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE_FORCED) +if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE_FORCED) || (empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && ! empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match('/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE))) - { - print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); - } - print ''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)); - print $filelib; - if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) - || (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) && ! empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE))) - { - print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); - } - print '
'; +{ + print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); } +print ''; +print ''; +$formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled'); + +if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) + || (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) && ! empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE))) +{ + print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); +} + +print ''; +print ''; + +print ''; + dol_fiche_end(); - -if ($action == 'edit') -{ - print '
'; - print ''; - print '       '; - print ''; - print '
'; -} +print '
'; +print ''; +print '
'; print ''; - -if ($action != 'edit') -{ - print '
'; -} - // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index a8c1aa41b5f..e9346f49a3a 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -123,460 +123,244 @@ print "
\n"; $noCountryCode = (empty($mysoc->country_code) ? true : false); -if ($action == 'edit') // Edit +print '
'; +print ''; +print ''; + +clearstatcache(); + + +// Misc options +print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); + +print '
'; +print ''; +print ''; + +$selected=$conf->global->MAIN_PDF_FORMAT; +if (empty($selected)) $selected=dol_getDefaultFormat(); + +// Show pdf format + +print ''; + +print ''; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("DictionaryPaperFormat").''; +print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT'); +print '
'.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; +print ''; +print '
'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; +print ''; +print '
'.$langs->trans("MAIN_PDF_MARGIN_TOP").''; +print ''; +print '
'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; +print ''; +print '
'; +print '
'; + +print '
'; + + +// Addresses +print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); + +print '
'; +print ''; +print ''; + +// Hide VAT Intra on address + +print ''; + +// Show prof id in address into pdf +for($i=1; $i<=6; $i++) { - print ''; - print ''; - print ''; - - clearstatcache(); - - - // Misc options - print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); - - print '
'; - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ShowVATIntaInAddress").''; +print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0, 1); +print '
'; - print ''; - - $selected=$conf->global->MAIN_PDF_FORMAT; - if (empty($selected)) $selected=dol_getDefaultFormat(); - - // Show pdf format - - print ''; - - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("DictionaryPaperFormat").''; - print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT'); - print '
'.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; - print ''; - print '
'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; - print ''; - print '
'.$langs->trans("MAIN_PDF_MARGIN_TOP").''; - print ''; - print '
'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; - print ''; - print '
'; - print '
'; - - print '
'; - - - // Addresses - print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); - - print '
'; - print ''; - print ''; - - // Hide VAT Intra on address - - print ''; - - // Show prof id in address into pdf - for($i=1; $i<=6; $i++) - { - if (! $noCountryCode) - { - $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); - if ($pid == '-') $pid=false; - } - else - { - $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid) - { - print ''; - } - } - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ShowVATIntaInAddress").''; - print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0, 1); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; - $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; - print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode); - print '
'; - print '
'; - - - print '
'; - - - // Localtaxes - $locales =''; - $text=''; - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) - { - if ($mysoc->useLocalTax(1)) - { - $locales = $langs->transcountry("LT1", $mysoc->country_code); - $text ='' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)) . ''; - $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); - $text .= ''; - } - - if ($mysoc->useLocalTax(2)) - { - $locales.=($locales?' & ':'').$langs->transcountry("LT2", $mysoc->country_code); - - $text.= '' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)) . ''; - $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); - $text.= ''; - } - } - - $title = $langs->trans("PDFRulesForSalesTax"); - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) - { - $title.=' - '.$langs->trans("PDFLocaltax", $locales); - } - - print load_fiche_titre($title, '', ''); - - print ''; - print ''; - - // Hide any information on Sale tax / VAT - - print ''; - - // Locataxes - print $text; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideAnyVATInformationOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0, 1); - print '
'; - print '
'; - - - // Other - print load_fiche_titre($langs->trans("Other"), '', ''); - - print '
'; - print ''; - print ''; - - //Desc - - print ''; - - //Ref - - print ''; - - //Details - - print ''; - - //Invert sender and recipient - - print ''; - - // Place customer adress to the ISO location - - print ''; - - - print ''; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideDescOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0, 1); - print '
'.$langs->trans("HideRefOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0, 1); - print '
'.$langs->trans("HideDetailsOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0, 1); - print '
'.$langs->trans("SwapSenderAndRecipientOnPDF").''; - print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT))?$conf->global->MAIN_INVERT_SENDER_RECIPIENT:0, 1); - print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; - print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0, 1); - print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; - print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); - print '
'; - print '
'; - - print '
'; - print ''; - print '   '; - print ''; - print '
'; - - print '
'; - print '
'; -} -else // Show -{ - // Misc options - print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); - - - print '
'; - print ''; - print ''; - - // Show pdf format - - print ''; - - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("DictionaryPaperFormat").''; - - $pdfformatlabel=''; - if (empty($conf->global->MAIN_PDF_FORMAT)) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $pdfformatlabel=dol_getDefaultFormat(); - } - else $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT; - if (! empty($pdfformatlabel)) - { - $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format"; - $sql.=" WHERE code LIKE '%".$db->escape($pdfformatlabel)."%'"; - - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $paperKey = $langs->trans('PaperFormat'.$obj->code); - $unitKey = $langs->trans('SizeUnit'.$obj->unit); - $pdfformatlabel = ($paperKey == 'PaperFormat'.$obj->code ? $obj->label : $paperKey).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey); - } - } - print $pdfformatlabel; - print '
'.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; - print empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT; - print '
'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; - print empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT; - print '
'.$langs->trans("MAIN_PDF_MARGIN_TOP").''; - print empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP; - print '
'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; - print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM; - print '
'; - print '
'; - - print '
'; - - print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); - - print '
'; - print ''; - print ''; - - // Hide Intra VAT on address - - print ''; - - // Show prof id in address into pdf - for ($i=1; $i<=6; $i++) + if (! $noCountryCode) { - if (! $noCountryCode) - { - $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); - if ($pid == '-') $pid=false; - } - else - { - $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid) - { - print ''; - } - } - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ShowVATIntaInAddress").''; - print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS, 1); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; - $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; - print yn($conf->global->$keyforconstant, 1); - print '
'."\n"; - print '
'; - - print '
'; - - // Localtaxes - $locales =''; - $text=''; - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) - { - if ($mysoc->useLocalTax(1)) - { - $locales = $langs->transcountry("LT1", $mysoc->country_code); - $text ='' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)) . ''; - $text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX, 1); - $text .= ''; - } - - if ($mysoc->useLocalTax(2)) - { - $locales.=($locales?' & ':'').$langs->transcountry("LT2", $mysoc->country_code); - - $text.= '' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)) . ''; - $text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX, 1); - $text.= ''; - } - } - - // Sales TAX / VAT information - $title=$langs->trans("PDFRulesForSalesTax", $locales); - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) $title.=' - '.$langs->trans("PDFLocaltax", $locales); - - print load_fiche_titre($title, '', ''); - - print ''; - print ''; - - print ''; - - print $text; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideAnyVATInformationOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT, 1); - print '
'; - print '
'; - - - // Other - print load_fiche_titre($langs->trans("Other"), '', ''); - - print '
'; - print ''; - print ''; - - // Encrypt and protect PDF - - print ''; - print ''; - print ''; - print '"; - - print ""; - print ''; - - // Hide Desc - - print ''; - - // Hide Ref - - print ''; - - // Hide Details - - print ''; - - // Invert sender and recipient - print ''; - - // Use French location - print ''; - - - print ''; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $text = $langs->trans("ProtectAndEncryptPdfFiles"); - $desc = $form->textwithpicto($text, $langs->transnoentities("ProtectAndEncryptPdfFilesDesc"), 1); - print $desc; - print ''; - if($conf->global->PDF_SECURITY_ENCRYPTION == 1) - { - print img_picto($langs->trans("Active"), 'tick'); - } - print ''; - if (empty($conf->global->PDF_SECURITY_ENCRYPTION)) - { - print ''.$langs->trans("Activate").''; + $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); + if ($pid == '-') $pid=false; } else { - print ''.$langs->trans("Disable").''; + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } - print "
'.$langs->trans("HideDescOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC, 1); - print '
'.$langs->trans("HideRefOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF, 1); - print '
'.$langs->trans("HideDetailsOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS, 1); - print '
'.$langs->trans("SwapSenderAndRecipientOnPDF").''; - print yn($conf->global->MAIN_INVERT_SENDER_RECIPIENT, 1); - print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; - print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION, 1); - print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; - print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)]; - print '
'; - print '
'; - - - /* - * Library - */ - - print '
'; - print load_fiche_titre($langs->trans("Library"), '', ''); - - print '
'; - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print "\n"; - - print ''."\n"; - print ''."\n"; - print ''; } - if (class_exists('TCPDF')) - { - if ($i) print ' + '; - print 'TCPDF'; - print ' ('.@constant('TCPDF_PATH').')'; - $i++; - } - if (class_exists('FPDI')) - { - if ($i) print ' + '; - print 'FPDI'; - print ' ('.@constant('FPDI_PATH').')'; - $i++; - } - if (class_exists('TCPDI')) - { - if ($i) print ' + '; - print 'TCPDI'; - print ' ('.@constant('TCPDI_PATH').')'; - $i++; - } - print ''."\n"; - print ''."\n"; - - print "
'.$langs->trans("Name").''.$langs->trans("Value").'
'.$langs->trans("LibraryToBuildPDF").''; - $i=0; - $pdf=pdf_getInstance('A4'); - if (class_exists('FPDF') && ! class_exists('TCPDF')) + if ($pid) { - if ($i) print ' + '; - print 'FPDF'; - print ' ('.@constant('FPDF_PATH').')'; - $i++; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode); + print '
\n"; - print '
'; - - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; - print '
'; } +print ''; +print '
'; + + +print '
'; + + +// Localtaxes +$locales =''; +$text=''; +if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) +{ + if ($mysoc->useLocalTax(1)) + { + $locales = $langs->transcountry("LT1", $mysoc->country_code); + $text ='' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)) . ''; + $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); + $text .= ''; + } + + if ($mysoc->useLocalTax(2)) + { + $locales.=($locales?' & ':'').$langs->transcountry("LT2", $mysoc->country_code); + + $text.= '' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)) . ''; + $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); + $text.= ''; + } +} + +$title = $langs->trans("PDFRulesForSalesTax"); +if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) +{ + $title.=' - '.$langs->trans("PDFLocaltax", $locales); +} + +print load_fiche_titre($title, '', ''); + +print ''; +print ''; + +// Hide any information on Sale tax / VAT + +print ''; + +// Locataxes +print $text; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideAnyVATInformationOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0, 1); +print '
'; +print '
'; + + +// Other +print load_fiche_titre($langs->trans("Other"), '', ''); + +print '
'; +print ''; +print ''; + +//Desc + +print ''; + +//Ref + +print ''; + +//Details + +print ''; + +//Invert sender and recipient + +print ''; + +// Place customer adress to the ISO location + +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideDescOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0, 1); +print '
'.$langs->trans("HideRefOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0, 1); +print '
'.$langs->trans("HideDetailsOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0, 1); +print '
'.$langs->trans("SwapSenderAndRecipientOnPDF").''; +print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT))?$conf->global->MAIN_INVERT_SENDER_RECIPIENT:0, 1); +print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; +print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0, 1); +print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; +print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); +print '
'; +print '
'; + + +/* + * Library + */ + +print '
'; +print load_fiche_titre($langs->trans("Library"), '', ''); + +print '
'; +print ''."\n"; + +print ''."\n"; +print ''."\n"; +print ''."\n"; +print "\n"; + +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +print "
'.$langs->trans("Name").''.$langs->trans("Value").'
'.$langs->trans("LibraryToBuildPDF").''; +$i=0; +$pdf=pdf_getInstance('A4'); +if (class_exists('FPDF') && ! class_exists('TCPDF')) +{ + if ($i) print ' + '; + print 'FPDF'; + print ' ('.@constant('FPDF_PATH').')'; + $i++; +} +if (class_exists('TCPDF')) +{ + if ($i) print ' + '; + print 'TCPDF'; + print ' ('.@constant('TCPDF_PATH').')'; + $i++; +} +if (class_exists('FPDI')) +{ + if ($i) print ' + '; + print 'FPDI'; + print ' ('.@constant('FPDI_PATH').')'; + $i++; +} +if (class_exists('TCPDI')) +{ + if ($i) print ' + '; + print 'TCPDI'; + print ' ('.@constant('TCPDI_PATH').')'; + $i++; +} +print '
\n"; +print '
'; + + +print '
'; +print ''; +print '
'; + +print ''; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 28c3db6f1d3..c9bf1ba4357 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -88,7 +88,7 @@ llxHeader('', $langs->trans("Miscellaneous"), $wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); -print $langs->trans("MiscellaneousDesc")."
\n"; +print ''.$langs->trans("MiscellaneousDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index e08c2c5eca8..73cad8f69ad 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -147,7 +147,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp); print load_fiche_titre($langs->trans("SmsSetup"), '', 'title_setup'); -print $langs->trans("SmsDesc")."
\n"; +print ''.$langs->trans("SmsDesc")."
\n"; print "
\n"; // List of sending methods diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index ad7a2278991..ba2dde77bec 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -229,7 +229,7 @@ print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_ $current_language_code=$langs->defaultlang; $s=picto_from_langcode($current_language_code); -print $form->textwithpicto($langs->trans("CurrentUserLanguage").': '.$s.' '.$current_language_code.'', $langs->trans("TranslationDesc")).'
'; +print ''.$form->textwithpicto($langs->trans("CurrentUserLanguage").': '.$s.' '.$current_language_code.'', $langs->trans("TranslationDesc")).'
'; print '
'; diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php index 9740de82fbc..03c0f0ab7ae 100644 --- a/htdocs/core/boxes/box_accountancy_suspense_account.php +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -108,14 +108,14 @@ class box_accountancy_suspense_account extends ModeleBoxes ); } else { $this->info_box_contents[0][0] = array( - 'td' => 'class="nohover opacitymedium left"', - 'text' => $langs->trans("SuspenseAccountNotDefined") + 'td' => 'class="nohover"', + 'text' => ''.$langs->trans("SuspenseAccountNotDefined").'' ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'class="nohover opacitymedium left"', - 'text' => $langs->trans("ReadPermissionNotAllowed") + 'td' => 'class="nohover"', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'' ); } } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5d9a637de58..490d033dbf3 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -702,8 +702,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete")); } $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1); - $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1); $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1); + $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1); $newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1); $newmenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1); From c3aba5f1a32b9609c4597bd51a529f28b49e8ed8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 14:53:30 +0200 Subject: [PATCH 065/409] FIX #12083 --- htdocs/debugbar/class/TraceableDB.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index d4bfd291602..20b5d47f0e8 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -333,9 +333,9 @@ class TraceableDB extends DoliDB 'sql' => $sql, 'duration' => $duration, 'memory_usage' => $memoryDelta, - 'is_success' => $resql, - 'error_code' => ! $resql ? $this->db->lasterrno() : null, - 'error_message' => ! $resql ? $this->db->lasterror() : null + 'is_success' => $resql ? true : false, + 'error_code' => $resql ? null : $this->db->lasterrno(), + 'error_message' => $resql ? null : $this->db->lasterror() ); } From 868bfb518b80c17b1253a8e485b5282bf3392290 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 15:08:10 +0200 Subject: [PATCH 066/409] FIX #11702 FIX #12088 --- htdocs/bom/tpl/objectline_create.tpl.php | 5 +++-- htdocs/core/tpl/objectline_create.tpl.php | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index e266c142480..b77d713268f 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -100,14 +100,15 @@ if ($nolinesbefore) { $filtertype=''; if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + $statustoshow = -1; if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 6bad5bb2ac5..ee34654f2f2 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -38,7 +38,6 @@ if (empty($object) || ! is_object($object)) { exit; } - $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) { @@ -248,14 +247,15 @@ if ($nolinesbefore) { if (empty($senderissupplier)) { + $statustoshow = 1; if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, -1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, -1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); } if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS)) From 85a4bac9e078e3c8e18ca72c2f34752b1cff0109 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 15:22:12 +0200 Subject: [PATCH 067/409] Better translation --- htdocs/langs/en_US/admin.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index bc9981faf3f..5996d643624 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -870,9 +870,9 @@ Permission1251=Run mass imports of external data into database (data load) Permission1321=Export customer invoices, attributes and payments Permission1322=Reopen a paid bill Permission1421=Export sales orders and attributes -Permission2401=Read actions (events or tasks) linked to his account -Permission2402=Create/modify actions (events or tasks) linked to his account -Permission2403=Delete actions (events or tasks) linked to his account +Permission2401=Read actions (events or tasks) linked to his user account (if owner of event) +Permission2402=Create/modify actions (events or tasks) linked to his user account (if owner of event) +Permission2403=Delete actions (events or tasks) linked to his user account (if owner of event) Permission2411=Read actions (events or tasks) of others Permission2412=Create/modify actions (events or tasks) of others Permission2413=Delete actions (events or tasks) of others From 777c297353431b777f1d769ea29f735e2b16610a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 15:42:27 +0200 Subject: [PATCH 068/409] FIX #12054 --- .../compta/facture/invoicetemplate_list.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 5da37d46fd5..661f9604500 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -217,7 +217,17 @@ $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.tot $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,"; $sql.= " f.datec, f.tms,"; $sql.= " f.fk_cond_reglement, f.fk_mode_reglement"; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; +// 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, $object); // Note that $action and $object may have been modified by hook +$sql.=preg_replace('/^,/', '', $hookmanager->resPrint); +$sql =preg_replace('/,\s*$/', '', $sql); + +$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as f"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_rec_extrafields as ef ON ef.fk_object = f.rowid"; if (! $user->rights->societe->client->voir && ! $socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } @@ -492,6 +502,8 @@ if ($resql) if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder); + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'nomaxwidthsearch ')."\n"; print "\n"; @@ -630,6 +642,15 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } + + $obj = $objp; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Status if (! empty($arrayfields['status']['checked'])) { print ''; From c6a796d270efaaca1914e41540f13863b579a1ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 15:45:32 +0200 Subject: [PATCH 069/409] Try to fix #12097 --- htdocs/core/db/pgsql.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 637aac02545..2347d3d77e5 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -199,6 +199,12 @@ class DoliDBPgsql extends DoliDB $line=$newline; } + if (preg_match('/[\s\t\(]*(\w*)[\s\t]+bigint.*auto_increment/i', $line, $reg)) { + $newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+int.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line); + //$line = "-- ".$line." replaced by --\n".$newline; + $line=$newline; + } + // tinyint type conversion $line=preg_replace('/tinyint\(?[0-9]*\)?/', 'smallint', $line); $line=preg_replace('/tinyint/i', 'smallint', $line); From b5a2d373158096dcc27df9d33a1497059b5e6c3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 16:10:09 +0200 Subject: [PATCH 070/409] Fix phpunit of BOM --- htdocs/bom/class/bom.class.php | 1 + test/phpunit/BOMTest.php | 149 ++++++++++++++++++++------------- 2 files changed, 94 insertions(+), 56 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 3835baf3b25..44370b40720 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -953,6 +953,7 @@ class BOM extends CommonObject public function initAsSpecimen() { $this->initAsSpecimenCommon(); + $this->ref = 'BOM-123'; $this->date = $this->date_creation; } diff --git a/test/phpunit/BOMTest.php b/test/phpunit/BOMTest.php index 551722aadd2..73603a5f336 100644 --- a/test/phpunit/BOMTest.php +++ b/test/phpunit/BOMTest.php @@ -22,89 +22,126 @@ * \brief PHPUnit test for BillOfMaterials class. */ -namespace test\unit; +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/bom/class/bom.class.php'; + +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + +$langs->load("main"); + /** * Class BillOfMaterialsTest * @package Testbillofmaterials */ -class BOMTest extends \PHPUnit\Framework\TestCase +class BOMTest extends PHPUnit\Framework\TestCase { + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + /** - * Global test setup - * @return void + * Constructor + * We save global variables into local variables + * + * @return BOMTest */ + public function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods public static function setUpBeforeClass() { - fwrite(STDOUT, __METHOD__ . "\n"); + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { + print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; + die(); + } + if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); } + if (! empty($conf->global->MAIN_MODULE_MAILMANSPIP)) { print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(); } + + print __METHOD__."\n"; + } + + // tear down after class + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; } /** - * Unit test setup - * @return void + * Init phpunit tests + * + * @return void */ protected function setUp() { - fwrite(STDOUT, __METHOD__ . "\n"); + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; } /** - * Verify pre conditions - * @return void - */ - protected function assertPreConditions() - { - fwrite(STDOUT, __METHOD__ . "\n"); - } - - /** - * A sample test - * @return bool - */ - public function testSomething() - { - fwrite(STDOUT, __METHOD__ . "\n"); - // TODO: test something - $this->assertTrue(true); - } - - /** - * Verify post conditions - * @return void - */ - protected function assertPostConditions() - { - fwrite(STDOUT, __METHOD__ . "\n"); - } - - /** - * Unit test teardown - * @return void + * End phpunit tests + * + * @return void */ protected function tearDown() { - fwrite(STDOUT, __METHOD__ . "\n"); + print __METHOD__."\n"; } /** - * Global test teardown - * @return void - */ - public static function tearDownAfterClass() - { - fwrite(STDOUT, __METHOD__ . "\n"); - } - - /** - * Unsuccessful test + * testBOMCreate * - * @param Exception $e Exception - * @return void - * @throws Exception + * @return int */ - protected function onNotSuccessfulTest(Exception $e) + public function testBOMCreate() { - fwrite(STDOUT, __METHOD__ . "\n"); - throw $e; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new BOM($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); + + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $localobject; } } From 7b81ffe3fe618eabe3219f0111d620b6cbac20f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 16:29:16 +0200 Subject: [PATCH 071/409] Update list.php --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 2b4a2a9a983..ecf32df6740 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -281,7 +281,7 @@ $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_va $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo"; // 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 : ''); + 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(); From d9e434965a87a0e163f9b5494a49255173d5803d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 16:29:44 +0200 Subject: [PATCH 072/409] Update list.php --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 882f59dbee6..b86dd2864b5 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -275,7 +275,7 @@ $sql.= " ua.statut as validator_statut,"; $sql.= " ua.photo as validator_photo"; // 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 : ''); + 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(); From fbc4e3b441515c482338c9d137f89cc7ee584f81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 16:37:10 +0200 Subject: [PATCH 073/409] Update listbyaccount.php --- htdocs/accountancy/bookkeeping/listbyaccount.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 2b9fc4fde29..640cf87d496 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -397,25 +397,27 @@ while ($i < min($num, $limit)) $i++; } -// Affiche un Sous-Total du dernier compte comptable affiché +// Show sub-total of last shown account print ''; print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''; -print ''; +print ''; print price($sous_total_debit - $sous_total_credit); -print '\n'; +print ''; +print ''; print ''; -// Affiche le Total +// Show total print ''; print ''.$langs->trans("Total").':'; -print ''; +print ''; print price($total_debit); print ''; -print ''; +print ''; print price($total_credit); print ''; -print ''; +print ''; +print ''; print ''; print ""; From b276abea26c58e78320137fc22a7e1d431ff71bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 16:49:58 +0200 Subject: [PATCH 074/409] Fix missing token in form Fix date lost after search --- htdocs/accountancy/bookkeeping/list.php | 4 +-- .../accountancy/bookkeeping/listbyaccount.php | 31 +++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 5cf64a70e67..b5f0c06738a 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -502,9 +502,9 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; print '
'; +print ''; print ''; if ($optioncss != '') print ''; -print ''; print ''; print ''; print ''; @@ -542,7 +542,7 @@ if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint; print '
'; -print ''; +print '
'; // Filters lines print ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 640cf87d496..d91772a6ab3 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -37,9 +37,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array("accountancy")); -$page = GETPOST("page"); -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); $action = GETPOST('action', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); @@ -71,9 +68,9 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if ($sortorder == "") $sortorder = "ASC"; -if ($sortfield == "") $sortfield = "t.doc_date"; +if ($sortfield == "") $sortfield = "t.doc_date,t.rowid"; -if (empty($search_date_start) && empty($search_date_end)) { +if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql.= $db->plimit(1); @@ -255,6 +252,14 @@ if ($action == 'delbookkeepingyear') { print ''; +print ''; +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); @@ -265,12 +270,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($lim print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit); // Reverse sort order -if ( preg_match('/^asc/i', $sortorder) ) - $sortorder = "asc"; -else - $sortorder = "desc"; +if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc"; +else $sortorder = "desc"; -print '
'; +print '
'; +print '
'; print ''; print ''; +print ''; print ''; print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']); @@ -313,8 +318,6 @@ print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", " print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center '); print "\n"; -print ''; - $total_debit = 0; $total_credit = 0; @@ -400,7 +403,7 @@ while ($i < min($num, $limit)) // Show sub-total of last shown account print ''; print ''; -print ''; print ''; @@ -421,6 +424,8 @@ print ''; print ''; print "
'; @@ -300,6 +304,7 @@ print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''; +print ''; print price($sous_total_debit - $sous_total_credit); print '
"; +print '
'; + print '
'; // End of page From b58c2c38b2fbb13ef05a7d45ae64fcfb4c142efc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 16:57:47 +0200 Subject: [PATCH 075/409] Fix missing token --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 36657d48dbc..9b6876aefe9 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -993,7 +993,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany")); print load_fiche_titre($title, $newcardbutton, ''); - print '
'; + print ''; + print ''; print ''; print ''; print ''; From 95305a313d7b70daa137475b243ee930ec624863 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 17:02:35 +0200 Subject: [PATCH 076/409] Fix trans --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 864d5d85c53..ced8c37c6d7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -932,7 +932,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') 't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10), 't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20), 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), - 'sc.role'=>array('label'=>"Roles", 'checked'=>1, 'position'=>40), + 'sc.role'=>array('label'=>"ContactByDefaultFor", 'checked'=>1, 'position'=>40), 't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'), ); // Extra fields @@ -1091,7 +1091,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($val['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; - if ($key == 'role') $align.=($align?' ':'').'center'; + if ($key == 'role') $align.=($align?' ':'').'left'; if (! empty($arrayfields['sc.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'sc.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; } From d9dde34ba6eb8ca86ba5bc0bad249279de60abd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 17:24:02 +0200 Subject: [PATCH 077/409] Fix phpcs --- .../modulebuilder/template/myobject_list.php | 36 +++++++++---------- htdocs/theme/eldy/manifest.json.php | 12 +++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 54885f8e380..1c1d0e101b9 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -22,24 +22,24 @@ * \brief List page for myobject */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data -//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data +//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL', '1'); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' // Load Dolibarr environment $res=0; diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index 8809286ed1e..889b406ab3f 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -28,12 +28,12 @@ if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); -if (! defined('NOLOGIN')) define('NOLOGIN', 1); -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (! defined('NOLOGIN')) define('NOLOGIN', '1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require_once __DIR__.'/../../main.inc.php'; From fa928f7dc333d3a2e086830b7e47a080a24daf6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 17:33:13 +0200 Subject: [PATCH 078/409] Update modCategorie.class.php --- htdocs/core/modules/modCategorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index eb9e2c6b4a1..d157e35a555 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -427,7 +427,7 @@ class modCategorie extends DolibarrModules if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } $this->import_examplevalues_array[$r] = array( - 'ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category", + 'ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"My Category description", 'ca.fk_parent' => '0' ); From 5446a7bd8e6d78c1092469398de6e6777d961ebe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 17:43:15 +0200 Subject: [PATCH 079/409] Try phpunit fix --- test/phpunit/BOMTest.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/phpunit/BOMTest.php b/test/phpunit/BOMTest.php index 73603a5f336..b69e59c6283 100644 --- a/test/phpunit/BOMTest.php +++ b/test/phpunit/BOMTest.php @@ -39,8 +39,11 @@ $langs->load("main"); /** - * Class BillOfMaterialsTest - * @package Testbillofmaterials + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class BOMTest extends PHPUnit\Framework\TestCase { @@ -77,13 +80,6 @@ class BOMTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { - print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; - die(); - } - if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); } - if (! empty($conf->global->MAIN_MODULE_MAILMANSPIP)) { print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(); } - print __METHOD__."\n"; } @@ -142,6 +138,6 @@ class BOMTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - return $localobject; + return $result; } } From d109341ebedd95d7b0eeaa84a4d9510e7db7fcfe Mon Sep 17 00:00:00 2001 From: JC Prieto Date: Fri, 11 Oct 2019 18:08:15 +0200 Subject: [PATCH 080/409] Update card.php Variable $mesg not do anything --- htdocs/fourn/card.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 5ebe8ffed56..5c183cc212b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -85,10 +85,7 @@ if (empty($reshook)) $result=$object->fetch($id); $object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; $result=$object->update($object->id, $user, 1, 0, 1); - if ($result < 0) - { - $mesg=join(',', $object->errors); - } + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } // terms of the settlement if ($action == 'setconditions' && $user->rights->societe->creer) From 51383ce6afe742fba85502b83bac04008c1a8c87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 18:42:07 +0200 Subject: [PATCH 081/409] FIX Reset of password can use email like the login. --- htdocs/user/class/user.class.php | 7 ++++++- htdocs/user/passwordforgotten.php | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e8a45efcd62..fecbafe1dba 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -238,9 +238,10 @@ class User extends CommonObject * @param string $sid If defined, sid to used for search * @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx), 0=do not load personal conf. * @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup. + * @param int $email If defined, email to used for search * @return int <0 if KO, 0 not found, >0 if OK */ - public function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity = -1) + public function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity = -1, $email = '') { global $conf, $user; @@ -305,6 +306,10 @@ class User extends CommonObject { $sql.= " AND u.login = '".$this->db->escape($login)."'"; } + elseif ($email) + { + $sql.= " AND u.email = '".$this->db->escape($email)."'"; + } else { $sql.= " AND u.rowid = ".$id; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index ada75da6110..8f85465cde2 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -45,8 +45,8 @@ $action=GETPOST('action', 'alpha'); $mode=$dolibarr_main_authentication; if (! $mode) $mode='http'; -$username = GETPOST('username', 'alpha'); -$passwordhash = GETPOST('passwordhash', 'alpha'); +$username = trim(GETPOST('username', 'alpha')); +$passwordhash = trim(GETPOST('passwordhash', 'alpha')); $conf->entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : 1); // Instantiate hooks of thirdparty module only if not already define @@ -104,6 +104,11 @@ if ($action == 'buildnewpassword' && $username) { $edituser = new User($db); $result=$edituser->fetch('', $username, '', 1); + if ($result == 0 && preg_match('/@/', $username)) + { + $result=$edituser->fetch('', '', '', 1, -1, $username); + } + if ($result <= 0 && $edituser->error == 'USERNOTFOUND') { $message = '
'.$langs->trans("ErrorLoginDoesNotExists", $username).'
'; From dfaf2ae34b20383a8c18d06efca2bf4e03bdf267 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 19:20:52 +0200 Subject: [PATCH 082/409] Trans --- htdocs/install/mysql/migration/repair.sql | 2 +- htdocs/langs/en_US/compta.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4d87203b068..eac0d5b3bd9 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -471,7 +471,7 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS -- Note to make all deposit as payed when there is already a discount generated from it. --drop table tmp_invoice_deposit_mark_as_available; --create table tmp_invoice_deposit_mark_as_available as select * from llx_facture as f where f.type = 3 and f.paye = 0 and f.rowid in (select fk_facture_source from llx_societe_remise_except); ---update llx_facture set paye = 1 where rowid in (select rowid from tmp_invoice_deposit_mark_as_available); +--update llx_facture set paye = 1, fk_statut = 2 where rowid in (select rowid from tmp_invoice_deposit_mark_as_available); diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 42d88f3f722..eb76d9c64a2 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -112,7 +112,7 @@ ShowVatPayment=Show VAT payment TotalToPay=Total to pay BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted ascending on %s and filtered for 1 bank account CustomerAccountancyCode=Customer accounting code -SupplierAccountancyCode=vendor accounting code +SupplierAccountancyCode=Vendor accounting code CustomerAccountancyCodeShort=Cust. account. code SupplierAccountancyCodeShort=Sup. account. code AccountNumber=Account number From f345b5fdb0d2b3bc4f2ce52d541393a1f1c7d050 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 19:32:45 +0200 Subject: [PATCH 083/409] Fix look and feel v10 --- htdocs/comm/multiprix.php | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 8a5226d36d2..6442bb45a88 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -91,15 +91,13 @@ if ($_socid > 0) dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company'); - print ''; - print '\n"; - - - print ""; - print "
'; - print ''; + print '
'; - print '"; + print '"; - print '
'; - print $langs->trans("PriceLevel").''.$objsoc->price_level."
'; + print $langs->trans("PriceLevel").''.$objsoc->price_level."
'; - print $langs->trans("NewValue").''; + print '
'; + print $langs->trans("NewValue").''; print '
"; - print "
"; - dol_fiche_end(); print '
'; @@ -157,8 +149,8 @@ if ($_socid > 0) while ($i < $num ) { $obj = $db->fetch_object($resql); - $tag = !$tag; - print ''; + + print ''; print ''.dol_print_date($db->jdate($obj->dc), "dayhour").''; print ''.$obj->price_level.' '; $userstatic->id=$obj->uid; From 2fa3b23cf10c9e05afc81be1caec91c6b6990d74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 19:36:36 +0200 Subject: [PATCH 084/409] Fix missing price level field --- htdocs/core/modules/modSociete.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index e41e96c5add..a0d190c65cd 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -270,6 +270,9 @@ class modSociete extends DolibarrModules 'st.code'=>'ProspectStatus','payterm.libelle'=>'PaymentConditions','paymode.libelle'=>'PaymentMode' ); if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix'; + + if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix'; + if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->export_fields_array[$r]['s.price_level']='PriceLevel'; // Add multicompany field if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { @@ -295,7 +298,8 @@ class modSociete extends DolibarrModules 's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_private'=>"Text",'s.note_public'=>"Text",'t.libelle'=>"Text", 'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code', 'st.code'=>'List:c_stcomm:libelle:code','d.nom'=>'Text','u.login'=>'Text','u.firstname'=>'Text','u.lastname'=>'Text','payterm.libelle'=>'Text', - 'paymode.libelle'=>'Text','s.entity'=>'Numeric' + 'paymode.libelle'=>'Text','s.entity'=>'Numeric', + 's.price_level'=>'Numeric' ); $this->export_entities_array[$r]=array('u.login'=>'user','u.firstname'=>'user','u.lastname'=>'user'); // We define here only fields that use another picto From 9f596565898857b7503b597a00e9bfc64d7c2bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 11 Oct 2019 23:08:33 +0200 Subject: [PATCH 085/409] fix typo inspired by grandoc --- dev/tools/dolibarr-mysql2pgsql.pl | 86 +++++++++---------- htdocs/adherents/class/adherent.class.php | 2 +- .../compta/facture/invoicetemplate_list.php | 4 +- .../core/class/commondocgenerator.class.php | 10 +-- .../supplier_order/pdf/pdf_cornas.modules.php | 6 +- .../jquery/plugins/flot/jquery.flot.js | 6 +- 6 files changed, 57 insertions(+), 57 deletions(-) diff --git a/dev/tools/dolibarr-mysql2pgsql.pl b/dev/tools/dolibarr-mysql2pgsql.pl index 1f510ad60f1..2fe03aaf2b5 100755 --- a/dev/tools/dolibarr-mysql2pgsql.pl +++ b/dev/tools/dolibarr-mysql2pgsql.pl @@ -58,7 +58,7 @@ foreach my $file (keys %filelist) { $ARGV[1]="$DESTI/$file"; print "Convert file $ARGV[0] into $ARGV[1]\n"; - + # MySQL to PostgreSQL dump file converter # # For usage: perl mysql2pgsql.perl --help @@ -76,18 +76,18 @@ foreach my $file (keys %filelist) { # 4) add debug option # see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql # 2003-12-16 jsp -- Joe Speigle : - # converts: s/\) *Type=MyISAM;/);/i, enum data type -> references, + # converts: s/\) *Type=MyISAM;/);/i, enum data type -> references, # auto_increment->sequences # 2004-01-13 jsp -- moved project to gborg; both the above declined ownership # 2004-06-29 converts: year(4), year(2) - # homepage: gborg.postgresql.org - + # homepage: gborg.postgresql.org + GetOptions("debug", "help"); - + my $DEBUG = $opt_debug || 0; my $HELP = $opt_help || 0; - - + + if (($HELP) || ! defined($ARGV[0]) || ! defined($ARGV[1])) { print "Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n"; print "\t* OPTIONS\n"; @@ -106,15 +106,15 @@ foreach my $file (keys %filelist) { print "\tpg_dump_file.sql (undefined)\n"; } exit 1; - } - + } + open(IN,"<$ARGV[0]") || die "can't open mysql dump file $ARGV[0]"; open(OUT,">$ARGV[1]") || die "can't open pg dump file $ARGV[1]"; print OUT "-- Generated by $PROG\n"; print OUT "-- (c) 2004, PostgreSQL Inc.\n"; print OUT "-- (c) 2005, Laurent Destailleur.\n"; print OUT "\n"; - + # Output for create table and create index sub output_create { # If command ends with "xxx,);", we change to "xxx);" @@ -128,7 +128,7 @@ foreach my $file (keys %filelist) { print OUT $create_index; } } - + # Reset when moving from each "create table" to "insert" part of dump sub reset_vars() { $create_sql=""; @@ -137,24 +137,24 @@ foreach my $file (keys %filelist) { $enum_column=''; } - + # Boucle sur contenu fichier source #---------------------------------- while() { - + # comments or empty lines - if (/^-- \$Id/) { + if (/^-- \$Id/) { $_ =~ s/\$//g; - print OUT $_; + print OUT $_; next; } # comments or empty lines if (/^#/ || /^$/ || /^--/) { - print OUT $_; + print OUT $_; next; } - if (/^USE\s*([^;]*);/) { - print OUT "\\c ". $1; + if (/^USE\s*([^;]*);/) { + print OUT "\\c ". $1; next; } if ($create_sql ne "") { # we are inside create table statement so lets process datatypes @@ -167,14 +167,14 @@ foreach my $file (keys %filelist) { # LDR Added "innodb" and "engine" } elsif (/(ISAM|innodb)/i) { # end of create table sequence - s/\) *type=(MyISAM|innodb);/);/i; - s/\) *engine=(MyISAM|innodb);/);/i; + s/\) *type=(MyISAM|innodb);/);/i; + s/\) *engine=(MyISAM|innodb);/);/i; $create_sql =~ s/,$//g; # strip last , inside create table $create_sql .= $_; &output_create; &reset_vars(); next; - } + } # enum -> check if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) { @@ -189,7 +189,7 @@ foreach my $file (keys %filelist) { $enum_datafield{$enum_column} =~ s/\"/\'/g; $_ = qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~; # int, auto_increment -> serial - } elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) { + } elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) { $seq = qq~${table}_${1}_seq~; s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig; $create_sql.=$_; @@ -211,40 +211,40 @@ foreach my $file (keys %filelist) { elsif (/tinyint/i) { s/tinyint/smallint/g; } - + # nuke unsigned s/(int\w+|smallint)\s+unsigned/$1/gi; - + # blob -> text s/\w*blob/text/gi; # tinytext/mediumtext -> text s/tinytext/text/gi; s/mediumtext/text/gi; - + # char -> varchar # PostgreSQL would otherwise pad with spaces as opposed # to MySQL! Your user interface may depend on this! s/(\s+)char/${1}varchar/gi; - + # nuke date representation (not supported in PostgreSQL) s/datetime default '[^']+'/datetime/i; s/date default '[^']+'/datetime/i; s/time default '[^']+'/datetime/i; - + # change not null datetime field to null valid ones # (to support remapping of "zero time" to null s/datetime not null/datetime/i; s/datetime/timestamp/i; - + # nuke size of timestamp s/timestamp\([^)]*\)/timestamp/i; - + # double -> numeric s/^double/numeric/i; s/(\s*)double/${1}numeric/i; - + # float -> numeric s/^float/numeric/i; s/(\s*)float/${1}numeric/i; @@ -261,7 +261,7 @@ foreach my $file (keys %filelist) { $create_sql.=$_; next; } - + # unique key [name] (field) if (/unique key\s*(\w*)\s*\((\w+)\)/i) { s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i; @@ -288,30 +288,30 @@ foreach my $file (keys %filelist) { $create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n"; next; } - + # index(field) if (/index\s*(\w*)\s*\((\w+)\)/i) { my $idxname=($1?"$1":"idx_${table}_$2"); $create_index .= "CREATE INDEX $idxname ON $table ($2);\n"; next; } - + # primary key if (/\bkey\b/i && !/^\s+primary key\s+/i) { s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key } - + # key(xxx) if (/key\s*\((\w+)\)/i) { my $idxname="idx_${table}_$1"; $create_index .= "CREATE INDEX $idxname ON $table ($1);\n"; next; } - + # Quote column names s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i); - - # Remap colums with names of existing system attribute + + # Remap columns with names of existing system attribute if (/"oid"/i) { s/"oid"/"_oid"/g; print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue."; @@ -330,13 +330,13 @@ foreach my $file (keys %filelist) { s!\x85!... !g; # \ldots s!\x92!`!g; } - + # fix dates '0000-00-00 00:00:00' (should be null) s/'0000-00-00 00:00:00'/null/gi; s/'0000-00-00'/null/gi; s/'00:00:00'/null/gi; s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/; - + if (/create\s+table\s+(\w+)/i) { $create_sql = $_; /create\s*table\s*(\w+)/i; @@ -345,11 +345,11 @@ foreach my $file (keys %filelist) { print OUT $_; } } # end of if inside create_table - } # END while() - + } # END while() + close IN; close OUT; - + } print "\n"; @@ -358,4 +358,4 @@ print "\n"; print "Press a key to finish...\n"; $stop=; -0; \ No newline at end of file +0; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 14eb401866a..2bcbc21c3a0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1282,7 +1282,7 @@ class Adherent extends CommonObject $this->societe = $obj->company; $this->company = $obj->company; $this->socid = $obj->fk_soc; - $this->fk_soc = $obj->fk_soc; // For backward comaptibility + $this->fk_soc = $obj->fk_soc; // For backward compatibility $this->address = $obj->address; $this->zip = $obj->zip; $this->town = $obj->town; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 3e9011bb74b..e13dc30204f 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -416,7 +416,7 @@ if ($resql) print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; - $formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); + $formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } // Date next generation @@ -425,7 +425,7 @@ if ($resql) print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; - $formother->select_year($search_year_date_when?$search_year_date_when:-1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); + $formother->select_year($search_year_date_when?$search_year_date_when:-1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } // Extra fields diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 84f49bafe3f..c99f78c3483 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -63,7 +63,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Define array with couple subtitution key => subtitution value + * Define array with couple substitution key => substitution value * * @param User $user User * @param Translate $outputlangs Language object for output @@ -101,7 +101,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Define array with couple subtitution key => subtitution value + * Define array with couple substitution key => substitution value * * @param Societe $mysoc Object thirdparty * @param Translate $outputlangs Language object for output @@ -161,7 +161,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Define array with couple subtitution key => subtitution value + * Define array with couple substitution key => substitution value * * @param Societe $object Object * @param Translate $outputlangs Language object for output @@ -242,7 +242,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Define array with couple subtitution key => subtitution value + * Define array with couple substitution key => substitution value * * @param Contact $object contact * @param Translate $outputlangs object for output @@ -723,7 +723,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Define array with couple subtitution key => subtitution value + * Define array with couple substitution key => substitution value * * @param Object $object Dolibarr Object * @param Translate $outputlangs Language object for output diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php index 04a62d3d924..ee858c35cf7 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php @@ -1625,7 +1625,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders */ /** - * uasort callback function to Sort colums fields + * uasort callback function to Sort columns fields * * @param array $a PDF lines array fields configs * @param array $b PDF lines array fields configs @@ -1663,7 +1663,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Positionning $curX = $this->page_largeur-$this->marge_droite; // start from right - // Array witdh + // Array width $arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche; // Count flexible column @@ -1671,7 +1671,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $countFlexCol = 0; foreach ($this->cols as $colKey => &$colDef) { - if (!$this->getColumnStatus($colKey)) continue; // continue if desable + if (!$this->getColumnStatus($colKey)) continue; // continue if disabled if (!empty($colDef['scale'])){ // In case of column widht is defined by percentage diff --git a/htdocs/includes/jquery/plugins/flot/jquery.flot.js b/htdocs/includes/jquery/plugins/flot/jquery.flot.js index 39f3e4cf3ef..c97ceb1bf44 100644 --- a/htdocs/includes/jquery/plugins/flot/jquery.flot.js +++ b/htdocs/includes/jquery/plugins/flot/jquery.flot.js @@ -2010,7 +2010,7 @@ Licensed under the MIT license. ctx.lineTo(xrange.to + subPixel, yrange.to); } else { ctx.moveTo(xrange.from, yrange.to + subPixel); - ctx.lineTo(xrange.to, yrange.to + subPixel); + ctx.lineTo(xrange.to, yrange.to + subPixel); } ctx.stroke(); } else { @@ -2525,9 +2525,9 @@ Licensed under the MIT license. radius = series.points.radius, symbol = series.points.symbol; - // If the user sets the line width to 0, we change it to a very + // If the user sets the line width to 0, we change it to a very // small value. A line width of 0 seems to force the default of 1. - // Doing the conditional here allows the shadow setting to still be + // Doing the conditional here allows the shadow setting to still be // optional even with a lineWidth of 0. if( lw == 0 ) From c3e8aec07c6be4e0c315409c34ef65de83b8ee12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 11 Oct 2019 23:54:05 +0200 Subject: [PATCH 086/409] fix translation for showemailing in lang files, it's ShowEMailing not ShowEmailing --- htdocs/comm/mailing/class/mailing.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 9df3a04a786..dba1de41cfd 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -548,7 +548,7 @@ class Mailing extends CommonObject $result = ''; $companylink = ''; - $label = '' . $langs->trans("ShowEmailing") . ''; + $label = '' . $langs->trans("ShowEMailing") . ''; $label.= '
'; $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; @@ -567,7 +567,7 @@ class Mailing extends CommonObject { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowEmailing"); + $label=$langs->trans("ShowEMailing"); $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; From 849eda20232f47e91bf9afe1874365d1586fe0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Oct 2019 00:05:26 +0200 Subject: [PATCH 087/409] Update index.php --- htdocs/comm/mailing/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index d6ade738e3e..0f3e42d366f 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -175,13 +175,15 @@ if ($result) { while ($i < $num ) { $obj = $db->fetch_object($result); + $mailstatic=new Mailing($db); + $mailstatic->id = $obj->rowid; + $mailstatic->ref = $obj->rowid; print ''; - print ''.img_object($langs->trans("ShowEMail"), "email").' '.$obj->rowid.''; + print ''.$mailstatic->getNomUrl(1).''; print ''.dol_trunc($obj->titre, 38).''; print ''.dol_print_date($db->jdate($obj->date_creat), 'day').''; print ''.($obj->nbemail?$obj->nbemail:"0").''; - $mailstatic=new Mailing($db); print ''.$mailstatic->LibStatut($obj->statut, 5).''; print ''; $i++; From 71227e43faf1f7f9a98df7d73f47710fbe50f54e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 04:51:41 +0200 Subject: [PATCH 088/409] Debug stripe deprecated page --- htdocs/stripe/class/stripe.class.php | 122 ++++++++++++++++++++++----- htdocs/stripe/payment.php | 2 +- 2 files changed, 101 insertions(+), 23 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 1f1610438e8..593447919a7 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -803,7 +803,8 @@ class Stripe extends CommonObject } /** - * Create charge with public/payment/newpayment.php, stripe/card.php, cronjobs or REST API + * Create charge. + * This is called by page htdocs/stripe/payment.php and may be deprecated. * * @param int $amount Amount to pay * @param string $currency EUR, GPB... @@ -854,12 +855,12 @@ class Stripe extends CommonObject $description = ""; $ref = ""; - if ($origin == order) { + if ($origin == 'order') { $order = new Commande($this->db); $order->fetch($item); $ref = $order->ref; $description = "ORD=" . $ref . ".CUS=" . $societe->id.".PM=stripe"; - } elseif ($origin == invoice) { + } elseif ($origin == 'invoice') { $invoice = new Facture($this->db); $invoice->fetch($item); $ref = $invoice->ref; @@ -881,9 +882,42 @@ class Stripe extends CommonObject global $stripearrayofkeysbyenv; \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); - if (empty($conf->stripeconnect->enabled)) + if (empty($conf->stripeconnect->enabled)) // With a common Stripe account { - if (preg_match('/acct_/i', $source)) + if (preg_match('/pm_/i', $source)) + { + $stripecard = $source; + $amountstripe = $stripeamount; + $FULLTAG = 'PFBO'; // Payment From Back Office + $stripe = $return; + $amounttopay = $amount; + $servicestatus = $status; + + dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG); + $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here) + + dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); + + // Create payment intent and charge payment (confirmnow = true) + $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $invoice, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1); + + $charge = new stdClass(); + if ($paymentintent->status == 'succeeded') + { + $charge->status = 'ok'; + } + else + { + $charge->status = 'failed'; + $charge->failure_code = $stripe->code; + $charge->failure_message = $stripe->error; + $charge->failure_declinecode = $stripe->declinecode; + $stripefailurecode = $stripe->code; + $stripefailuremessage = $stripe->error; + $stripefailuredeclinecode = $stripe->declinecode; + } + } + elseif (preg_match('/acct_/i', $source)) { $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", @@ -914,12 +948,14 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description")); } } else { - $fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE; - if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { - $fee = $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL; - } elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { - $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL; - } + // With Stripe Connect + $fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE; + if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { + $fee = $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL; + } elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { + $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL; + } + if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100); else $stripefee = round($fee); @@ -942,22 +978,64 @@ class Stripe extends CommonObject $paymentarray["receipt_email"] = $societe->email; } - $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account")); + if (preg_match('/pm_/i', $source)) + { + $stripecard = $source; + $amountstripe = $stripeamount; + $FULLTAG = 'PFBO'; // Payment From Back Office + $stripe = $return; + $amounttopay = $amount; + $servicestatus = $status; + + dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG); + $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here) + + dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); + + // Create payment intent and charge payment (confirmnow = true) + $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $invoice, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1); + + $charge = new stdClass(); + if ($paymentintent->status == 'succeeded') + { + $charge->status = 'ok'; + $charge->id = $paymentintent->id; + } + else + { + $charge->status = 'failed'; + $charge->failure_code = $stripe->code; + $charge->failure_message = $stripe->error; + $charge->failure_declinecode = $stripe->declinecode; + } + } + else + { + $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account")); + } } if (isset($charge->id)) {} $return->statut = 'success'; $return->id = $charge->id; - if ($charge->source->type == 'card') { - $return->message = $charge->source->card->brand . " ...." . $charge->source->card->last4; - } elseif ($charge->source->type == 'three_d_secure') { - $stripe = new Stripe($this->db); - $src = \Stripe\Source::retrieve("" . $charge->source->three_d_secure->card . "", array( - "stripe_account" => $stripe->getStripeAccount($service) - )); - $return->message = $src->card->brand . " ...." . $src->card->last4; - } else { - $return->message = $charge->id; + + if (preg_match('/pm_/i', $source)) + { + $return->message = 'Payment retreived by card status = '.$charge->status; + } + else + { + if ($charge->source->type == 'card') { + $return->message = $charge->source->card->brand . " ...." . $charge->source->card->last4; + } elseif ($charge->source->type == 'three_d_secure') { + $stripe = new Stripe($this->db); + $src = \Stripe\Source::retrieve("" . $charge->source->three_d_secure->card . "", array( + "stripe_account" => $stripe->getStripeAccount($service) + )); + $return->message = $src->card->brand . " ...." . $src->card->last4; + } else { + $return->message = $charge->id; + } } } catch (\Stripe\Error\Card $e) { include DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index dfcb79e18a0..894753f6440 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -28,7 +28,7 @@ /** * \file htdocs/stripe/payment.php * \ingroup stripe - * \brief Payment page for customers invoices. TODO Seems deprecated and bugged ! + * \brief Payment page for customers invoices. @TODO Seems deprecated and bugged and not used (no link to this page) ! */ // Load Dolibarr environment From dccfdad9dda6d9b7660c63b4530358a9b4b092a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 11:25:44 +0200 Subject: [PATCH 089/409] Work on inventory feature --- htdocs/langs/en_US/stocks.lang | 3 + .../modulebuilder/template/myobject_card.php | 2 +- htdocs/product/inventory/card.php | 8 +- htdocs/product/inventory/inventory.php | 283 ++++++++++++++++++ .../product/inventory/lib/inventory.lib.php | 3 +- .../product/inventory/tpl/inventory.tpl.php | 202 +------------ htdocs/theme/eldy/btn.inc.php | 2 +- htdocs/theme/md/btn.inc.php | 13 + 8 files changed, 308 insertions(+), 208 deletions(-) create mode 100644 htdocs/product/inventory/inventory.php diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index a98d4e18cbf..18dc7faaeb9 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -212,3 +212,6 @@ StockIncreaseAfterCorrectTransfer=Increase by correction/transfer StockDecreaseAfterCorrectTransfer=Decrease by correction/transfer StockIncrease=Stock increase StockDecrease=Stock decrease +InventoryForASpecificWarehouse=Inventory for a specific warehouse +InventoryForASpecificProduct=Inventory for a specific product + diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 7f28794d51b..6af2312938b 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -228,7 +228,7 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print ''."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index eb9181c8060..87e6fadb57a 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -148,7 +148,7 @@ jQuery(document).ready(function() { // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewInventory", $langs->transnoentitiesnoconv("MyInventory")), '', 'products'); + print load_fiche_titre($langs->trans("NewInventory"), '', 'products'); print ''; print ''; @@ -183,7 +183,7 @@ if ($action == 'create') // Part to edit record if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("Inventory")); + print load_fiche_titre($langs->trans("Inventory"), '', 'products'); print ''; print ''; @@ -193,7 +193,7 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
'."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; @@ -218,7 +218,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); - dol_fiche_head($head, 'inventory', $langs->trans("Inventory"), -1, 'inventory'); + dol_fiche_head($head, 'card', $langs->trans("Inventory"), -1, 'stock'); $formconfirm = ''; diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php new file mode 100644 index 00000000000..ab1a31fe4de --- /dev/null +++ b/htdocs/product/inventory/inventory.php @@ -0,0 +1,283 @@ + + * + * 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/product/inventory/inventory.php + * \ingroup inventory + * \brief Tabe to enter counting + */ + +require '../../main.inc.php'; +include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +include_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; +include_once DOL_DOCUMENT_ROOT.'/product/inventory/lib/inventory.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("stocks","other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + +if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) +{ + $result = restrictedArea($user, 'stock', $id); +} +else +{ + $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); +} + +// Initialize technical objects +$object=new Inventory($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->stock->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('inventorycard')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all", 'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); +} + +if (empty($action) && empty($id) && empty($ref)) $action='view'; + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'mymodule', $id); + +if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) +{ + $permissiontoadd = $user->rights->stock->creer; + $permissiontodelete = $user->rights->stock->supprimer; +} +else +{ + $permissiontoadd = $user->rights->stock->inventory_advance->write; + $permissiontodelete = $user->rights->stock->inventory_advance->write; +} + + +/* + * Actions + */ + +$parameters=array(); +$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)) +{ + $error=0; + + $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; + + // Actions cancel, add, update, delete or clone + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + + // Actions to send emails + /*$trigger_name='MYOBJECT_SENTBYMAIL'; + $autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; + $trackid='myobject'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';*/ +} + + + + +/* + * View + */ + +$form=new Form($db); + +llxHeader('', $langs->trans('Inventory'), ''); + +// Example : Adding jquery code +print ''; + + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = inventoryPrepareHead($object); + dol_fiche_head($head, 'inventory', $langs->trans("Inventory"), -1, 'stock'); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); + } + // Confirmation to delete line + if ($action == 'deleteline') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + } + + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Call Hook formConfirm + $parameters = array('lineid' => $lineid); + $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; + + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref bis + $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->inventory->creer) + { + if ($action != 'classify') + { + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(); + } else { + $morehtmlref.=''; + } + } + } + */ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print '
'."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + + // Other attributes. Fields from hook formObjectOptions and Extrafields. + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print ''; + + print '
'; + + dol_fiche_end(); + + + // Buttons for actions + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + if (empty($reshook)) + { + if ($permissiontoadd) + { + print ''.$langs->trans("Validate").''."\n"; + } + else + { + print ''.$langs->trans('Validate').''."\n"; + } + } + print '
'."\n"; + } + + + include DOL_DOCUMENT_ROOT.'/product/inventory/tpl/inventory.tpl.php'; + +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/product/inventory/lib/inventory.lib.php b/htdocs/product/inventory/lib/inventory.lib.php index 361a89c923c..e0af60588ed 100644 --- a/htdocs/product/inventory/lib/inventory.lib.php +++ b/htdocs/product/inventory/lib/inventory.lib.php @@ -69,7 +69,8 @@ function inventoryPrepareHead(&$inventory, $title = 'Inventory', $get = '') global $langs; return array( - array(dol_buildpath('/product/inventory/card.php?id='.$inventory->id.$get, 1), $langs->trans($title),'inventory') + array(dol_buildpath('/product/inventory/card.php?id='.$inventory->id.$get, 1), $langs->trans('Card'), 'card'), + array(dol_buildpath('/product/inventory/inventory.php?id='.$inventory->id.$get, 1), $langs->trans('Inventory'), 'inventory') ); } diff --git a/htdocs/product/inventory/tpl/inventory.tpl.php b/htdocs/product/inventory/tpl/inventory.tpl.php index 8d85b20dc43..992557505db 100644 --- a/htdocs/product/inventory/tpl/inventory.tpl.php +++ b/htdocs/product/inventory/tpl/inventory.tpl.php @@ -8,207 +8,7 @@ if (empty($conf) || ! is_object($conf)) } ?> - - -status != 1) { ?> - trans('AddInventoryProduct'); ?> : -
- - - - - - -

- - -
- - -
Cet inventaire est validé
- - - - - - - $row) { - - $total_pmp+=$row['pmp_stock']; - $total_pa+=$row['pa_stock']; - $total_pmp_actual+=$row['pmp_actual']; - $total_pa_actual+=$row['pa_actual']; - - if($i%20 === 0) - { - _headerList($view); - } // Fin IF principal - ?> - - - - barcode->enabled)) { ?> - - - - - - - global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA)){ - echo ''; - $total_current_pa+=$row['current_pa_stock']; - } - - ?> - - - - - rights->stock->changePMP)) { - echo ''; - } - ?> - - global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA)){ - echo ''; - $total_current_pa_actual+=$row['current_pa_actual']; - } - - ?> - - - - - - - -
  '.price($row['current_pa_stock']).'   - - '.$row['pmp_new'].''.price($row['current_pa_actual']).'
- - status != 1) { ?> -
- - - trans('Modify') ?> - rights->stock->changePMP)) { - echo ''.$langs->trans('ApplyPMP').''; - } - - if ($can_validate == 1) { ?> - trans('RegulateStock') ?> - - - - - - - trans('Flush'); ?> -     - trans('Delete') ?> - -
- - status == 1) { ?> -
- - - - trans('Delete') ?> - - -
- -
-

Date de création : getDate('datec') ?> -
Dernière mise à jour : getDate('tms') ?>

+TODO... diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index a3000715712..c69ee57c17b 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -61,7 +61,7 @@ span.butAction, span.butActionDelete { cursor: pointer; } -.tableforfieldcreate a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover, +.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover, span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover, a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover, span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover, diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index 384b968d220..be897e8f841 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -77,6 +77,19 @@ span.butAction, span.butActionDelete { a.butActionNew>span.fa-plus-circle { padding-left: 6px; font-size: 1.5em; } a.butActionNewRefused>span.fa-plus-circle { padding-left: 6px; font-size: 1.5em; } +.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover, +span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover, +a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover, +span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover, +a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover, +span.butActionNew>span.fa-list-alt, span.butActionNew>span.fa-list-alt:hover, +a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover, +span.butActionNewRefused>span.fa-list-alt, span.butActionNewRefused>span.fa-list-alt:hover +{ + font-size: 1em; + padding-left: 0px; +} + .button, .butAction { color: #ffffff !important; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); From 33efd77fc7949e7d55ee7fe34bd906a302727091 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 12 Oct 2019 12:10:33 +0200 Subject: [PATCH 090/409] more internationalization --- htdocs/core/modules/action/modules_action.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php index 5199933c0a2..0a559ae2d92 100644 --- a/htdocs/core/modules/action/modules_action.php +++ b/htdocs/core/modules/action/modules_action.php @@ -47,23 +47,23 @@ abstract class ModeleAction extends CommonDocGenerator global $conf; $type='action'; - $liste=array(); + $list=array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db, $type, $maxfilenamelength); + $list=getListOfModels($db, $type, $maxfilenamelength); - return $liste; + return $list; } } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Create an product document on disk using template defined into PRODUCT_ADDON_PDF + * Create a product document on disk using template defined into PRODUCT_ADDON_PDF * - * @param DoliDB $db objet base de donnee + * @param DoliDB $db data base object * @param Object $object Object fichinter - * @param string $modele force le modele a utiliser ('' par defaut) - * @param Translate $outputlangs objet lang a utiliser pour traduction + * @param string $modele forces the model to use ('' by default) + * @param Translate $outputlangs lang object to use for translation * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref @@ -79,7 +79,7 @@ function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $h $srctemplatepath=''; - // Positionne modele sur le nom du modele de fichinter a utiliser + // Position modele on the name of fichinter model to use if (! dol_strlen($modele)) { if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) From 9ba992b8b6cc936cae7869395444fd4de63c7375 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 12:31:35 +0200 Subject: [PATCH 091/409] Work on inventory module --- htdocs/bom/bom_list.php | 8 ++--- htdocs/comm/action/card.php | 2 ++ htdocs/core/lib/functions2.lib.php | 35 +++++++++++-------- .../modulebuilder/template/myobject_list.php | 5 +-- htdocs/product/inventory/card.php | 11 +++++- .../inventory/class/inventory.class.php | 22 +++++++----- htdocs/product/inventory/inventory.php | 23 +++++++++--- htdocs/product/inventory/list.php | 31 ++++++++++------ 8 files changed, 93 insertions(+), 44 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 4b0a6ff29be..635f0f9db65 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -375,14 +375,14 @@ print ''; foreach($object->fields as $key => $val) { $cssforfield=(empty($val['css'])?'':$val['css']); - if ($key == 'status') $cssforfield='center'; + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; - if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); else print ''; print ''; } @@ -411,7 +411,7 @@ foreach($object->fields as $key => $val) if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index baf454fdf67..cc3accde763 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1080,6 +1080,8 @@ if ($action == 'create') $formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId); print ''; } + + // Object linked if (!empty($origin) && !empty($originid)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8ff78fe5be0..c2c3528c869 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1820,69 +1820,76 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $subelement = $regs[2]; } + // Generic case for $classpath $classpath = $element.'/class'; - // To work with non standard path + // Special cases, to work with non standard path if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'compta/facture/class'; $module='facture'; $subelement='facture'; } - if ($objecttype == 'commande' || $objecttype == 'order') { + elseif ($objecttype == 'commande' || $objecttype == 'order') { $classpath = 'commande/class'; $module='commande'; $subelement='commande'; } - if ($objecttype == 'propal') { + elseif ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } - if ($objecttype == 'supplier_proposal') { + elseif ($objecttype == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; } - if ($objecttype == 'shipping') { + elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } - if ($objecttype == 'delivery') { + elseif ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } - if ($objecttype == 'contract') { + elseif ($objecttype == 'contract') { $classpath = 'contrat/class'; $module='contrat'; $subelement='contrat'; } - if ($objecttype == 'member') { + elseif ($objecttype == 'member') { $classpath = 'adherents/class'; $module='adherent'; $subelement='adherent'; } - if ($objecttype == 'cabinetmed_cons') { + elseif ($objecttype == 'cabinetmed_cons') { $classpath = 'cabinetmed/class'; $module='cabinetmed'; $subelement='cabinetmedcons'; } - if ($objecttype == 'fichinter') { + elseif ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $module='ficheinter'; $subelement='fichinter'; } - if ($objecttype == 'task') { + elseif ($objecttype == 'task') { $classpath = 'projet/class'; $module='projet'; $subelement='task'; } - if ($objecttype == 'stock') { + elseif ($objecttype == 'stock') { $classpath = 'product/stock/class'; $module='stock'; $subelement='stock'; } + elseif ($objecttype == 'inventory') { + $classpath = 'product/inventory/class'; + $module='stock'; + $subelement='inventory'; + } - //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; - + // Generic case for $classfile and $classname $classfile = strtolower($subelement); $classname = ucfirst($subelement); + //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname; + if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 1c1d0e101b9..bf24be61023 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -219,8 +219,9 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) +if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +} // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -414,7 +415,7 @@ foreach($object->fields as $key => $val) if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; - if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); else print ''; print ''; } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 87e6fadb57a..639b04cdbcc 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -340,6 +340,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + if ($permissiontoadd) + { + print ''.$langs->trans("Validate").''."\n"; + } + else + { + print ''.$langs->trans('Validate').''."\n"; + } + if ($permissiontodelete) { print ''.$langs->trans('Delete').''."\n"; @@ -382,7 +391,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $MAXEVENT = 10; - $morehtmlright = ''; + $morehtmlright = ''; $morehtmlright.= $langs->trans("SeeAll"); $morehtmlright.= ''; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 2445934b98c..e9284781a5d 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -54,22 +54,29 @@ class Inventory extends CommonObject */ public $picto = 'stock'; + const STATUS_DRAFT = 0; + const STATUS_VALIDATED = 1; + const STATUS_RECORDED = 2; + const STATUS_CANCELED = 9; /** - * 'type' if the field format. + * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') * 'label' the translation key. * 'enabled' is a condition when the field must be managed. * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) * 'index' if we want an index in database. * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'position' is the sort order of field. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. - * 'default' is a default value for creation (can still be replaced by the global setup of default values) - * 'showoncombobox' if field must be shown into the label of combobox + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES @@ -85,18 +92,15 @@ class Inventory extends CommonObject 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct'), 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>1, 'position'=>35), - 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502,), - 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512,), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), + 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502), 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), - //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), + 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>4, 'enabled'=>1, 'position'=>1000, 'default'=>0, 'arrayofkeyval'=>array(0=>'ToDo', 1=>'Done', -1=>'Cancel')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>4, 'enabled'=>1, 'position'=>1000, 'default'=>0, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Recorded', -1=>'Canceled')), ); /** diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ab1a31fe4de..c91834e54e5 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -261,13 +261,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { - if ($permissiontoadd) + if ($object->status == Inventory::STATUS_DRAFT) { - print ''.$langs->trans("Validate").''."\n"; + if ($permissiontoadd) + { + print ''.$langs->trans("Validate").''."\n"; + } + else + { + print ''.$langs->trans('Validate').''."\n"; + } } - else + + if ($object->status == Inventory::STATUS_VALIDATED) { - print ''.$langs->trans('Validate').''."\n"; + if ($permissiontoadd) + { + print ''.$langs->trans("RecordVerb").''."\n"; + } + else + { + print ''.$langs->trans('RecordVerb').''."\n"; + } } } print ''."\n"; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index f2e4853908d..b81e989cbb9 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -366,11 +366,18 @@ print ''; foreach($object->fields as $key => $val) { - $align=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; - if ($key == 'status') $align.=($align?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -392,11 +399,15 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $align=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; - if ($key == 'status') $align.=($align?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; From bcc41c2a3389da42e480780babbfd1e4010eefe7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 13:16:12 +0200 Subject: [PATCH 092/409] NEW Can filter on description on bank account transaction lists. --- htdocs/compta/bank/bankentries_list.php | 79 ++++++++++++++++--------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index cd964c7f4f4..1b0f7feffe4 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -75,15 +75,15 @@ else $result=restrictedArea($user, 'banque'); } -$description=GETPOST("description", 'alpha'); $dateop = dol_mktime(12, 0, 0, GETPOST("opmonth", 'int'), GETPOST("opday", 'int'), GETPOST("opyear", 'int')); -$debit=GETPOST("debit", 'alpha'); -$credit=GETPOST("credit", 'alpha'); +$search_debit=GETPOST("search_debit", 'alpha'); +$search_credit=GETPOST("search_credit", 'alpha'); $search_type=GETPOST("search_type", 'alpha'); $search_account=GETPOST("search_account", 'int')?GETPOST("search_account", 'int'):GETPOST("account", 'int'); $search_accountancy_code=GETPOST('search_accountancy_code', 'alpha')?GETPOST('search_accountancy_code', 'alpha'):GETPOST('accountancy_code', 'alpha'); $search_bid=GETPOST("search_bid", "int")?GETPOST("search_bid", "int"):GETPOST("bid", "int"); $search_ref=GETPOST('search_ref', 'alpha'); +$search_description=GETPOST("search_description", 'alpha'); $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int')); $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int')); $search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int')); @@ -142,7 +142,7 @@ $search_array_options=$extrafields->getOptionalsFromPost('banktransaction', '', $arrayfields=array( 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), + 'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1), 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1), 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), @@ -186,13 +186,13 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_dt_end=''; $search_dv_start=''; $search_dv_end=''; - $description=""; $search_type=""; - $debit=""; - $credit=""; + $search_debit=""; + $search_credit=""; $search_bid=""; $search_ref=""; $search_req_nb=''; + $search_description=''; $search_thirdparty=''; $search_num_releve=''; $search_conciliated=''; @@ -263,6 +263,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' if ($offset) $param.='&offset='.urlencode($offset); if ($search_thirdparty) $param.='&search_thirdparty='.urlencode($search_thirdparty); if ($search_num_releve) $param.='&search_num_releve='.urlencode($search_num_releve); + if ($search_description) $param.='&search_description='.urlencode($search_description); if ($search_start_dt) $param.='&search_start_dt='.urlencode($search_start_dt); if ($search_end_dt) $param.='&search_end_dt='.urlencode($search_end_dt); if ($search_start_dv) $param.='&search_start_dv='.urlencode($search_start_dv); @@ -393,11 +394,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($lim if ($id > 0) $param.='&id='.urlencode($id); if (!empty($ref)) $param.='&ref='.urlencode($ref); if (!empty($search_ref)) $param.='&search_ref='.urlencode($search_ref); -if (!empty($description)) $param.='&description='.urlencode($description); +if (!empty($search_description)) $param.='&search_description='.urlencode($search_description); if (!empty($search_type)) $param.='&type='.urlencode($search_type); if (!empty($search_thirdparty)) $param.='&search_thirdparty='.urlencode($search_thirdparty); -if (!empty($debit)) $param.='&debit='.urlencode($debit); -if (!empty($credit)) $param.='&credit='.urlencode($credit); +if (!empty($search_debit)) $param.='&search_debit='.urlencode($search_debit); +if (!empty($search_credit)) $param.='&search_credit='.urlencode($search_credit); if (!empty($search_account)) $param.='&search_account='.urlencode($search_account); if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve); if ($search_conciliated != '' && $search_conciliated != '-1') $param.='&search_conciliated='.urlencode($search_conciliated); @@ -498,14 +499,36 @@ if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb); if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve); if ($search_conciliated != '' && $search_conciliated != '-1') $sql.= " AND b.rappro = ".$search_conciliated; if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty); -if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings +if ($search_description) +{ + $search_description_to_use = $search_description; + $arrayoffixedlabels=array( + 'payment_salary', + 'CustomerInvoicePayment', 'CustomerInvoicePaymentBack', + 'SupplierInvoicePayment', 'SupplierInvoicePaymentBack', + 'DonationPayment', + 'ExpenseReportPayment', + 'SocialContributionPayment', + 'SubscriptionPayment', + 'WithdrawalPayment' + ); + foreach($arrayoffixedlabels as $keyforlabel) + { + $translatedlabel = $langs->transnoentitiesnoconv($keyforlabel); + if (preg_match('/'.$search_description.'/i', $translatedlabel)) + { + $search_description_to_use.="|".$keyforlabel; + } + } + $sql.= natural_search("b.label", $search_description_to_use); // Warning some text are just translation keys, not translated strings +} if ($search_bid > 0) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$search_bid; if (! empty($search_type)) $sql.= " AND b.fk_type = '".$db->escape($search_type)."' "; // Search criteria amount -$debit = price2num(str_replace('-', '', $debit)); -$credit = price2num(str_replace('-', '', $credit)); -if ($debit) $sql.= natural_search('- b.amount', $debit, 1); -if ($credit) $sql.= natural_search('b.amount', $credit, 1); +$search_debit = price2num(str_replace('-', '', $search_debit)); +$search_credit = price2num(str_replace('-', '', $search_credit)); +if ($search_debit) $sql.= natural_search('- b.amount', $search_debit, 1); +if ($search_credit) $sql.= natural_search('b.amount', $search_credit, 1); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -853,10 +876,10 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['description']['checked'])) + if (! empty($arrayfields['b.label']['checked'])) { print ''; } if (! empty($arrayfields['b.dateo']['checked'])) @@ -891,13 +914,13 @@ if ($resql) if (! empty($arrayfields['b.debit']['checked'])) { print ''; } if (! empty($arrayfields['b.credit']['checked'])) { print ''; } if (! empty($arrayfields['balancebefore']['checked'])) @@ -937,7 +960,7 @@ if ($resql) // Fields title print ''; if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center "); if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); @@ -1142,7 +1165,7 @@ if ($resql) } // Description - if (! empty($arrayfields['description']['checked'])) + if (! empty($arrayfields['b.label']['checked'])) { print "'; } + // If no record found + if ($num == 0) + { + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; + } + print "
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); + else print ''; + print '
'; - //print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '
"; @@ -1557,6 +1580,14 @@ if ($resql) print '
'.$langs->trans("NoRecordFound").'
"; print ""; @@ -1568,12 +1599,6 @@ else dol_print_error($db); } -// If no data to display after a search -if ($_POST["action"] == "search" && ! $num) -{ - print '
'.$langs->trans("NoRecordFound").'
'; -} - // End of page llxFooter(); $db->close(); From 9871dd8770a4ffbe59f700a26191c260a5764d01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 15:27:06 +0200 Subject: [PATCH 093/409] Debug variants --- htdocs/langs/en_US/products.lang | 4 ++-- htdocs/product/stock/product.php | 12 ++++++++---- htdocs/variants/combinations.php | 26 +++++++++++++++++--------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 36ca0ede002..21f4d4947ce 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -208,8 +208,8 @@ UseMultipriceRules=Use price segment rules (defined into product module setup) t PercentVariationOver=%% variation over %s PercentDiscountOver=%% discount over %s KeepEmptyForAutoCalculation=Keep empty to have this calculated automatically from weight or volume of products -VariantRefExample=Example: COL -VariantLabelExample=Example: Color +VariantRefExample=Examples: COL, SIZE +VariantLabelExample=Examples: Color, Size ### composition fabrication Build=Produce ProductsMultiPrice=Products and prices for each price segment diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 2c0515d309c..9ef671e9913 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -804,8 +804,8 @@ if (! $variants) { */ print '
'; + print ''; - print '
'; print ''; print ''; print ''; @@ -918,7 +918,8 @@ if (! $variants) { print ''; print ''; print ''; - print ''; + print ''; + print ''; } } } @@ -926,12 +927,13 @@ if (! $variants) { } } else dol_print_error($db); + // Total line print ''; print ''; print ''; -// Value purchase + // Value purchase print ''; @@ -939,12 +941,13 @@ if (! $variants) { if (empty($conf->global->PRODUIT_MULTIPRICES)) print ($total ? price($totalvaluesell / $total, 1) : ' '); else print $langs->trans("Variable"); print ''; -// Value to sell + // Value to sell print ''; print ""; + print "
' . $langs->trans("Warehouse") . '' . $langs->trans("NumberOfUnit") . '' . dol_print_date($pdluo->eatby, 'day') . '' . dol_print_date($pdluo->sellby, 'day') . '' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '
' . $langs->trans("Total") . ':' . price2num($total, 'MS') . ''; print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : ' '); // This value may have rounding errors print ''; print $totalvalue ? price(price2num($totalvalue, 'MT'), 1) : ' '; print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalvaluesell, 'MT'), 1); else print $langs->trans("Variable"); print '
"; print '
'; @@ -1067,6 +1070,7 @@ if (! $variants) { print ''; print ''.$langs->trans("Total").''; print ''.$stock_total.''; + print ''; print ''; } else diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 3239dbb5060..4a7774b1a08 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -377,6 +377,7 @@ if (! empty($id) || ! empty($ref)) dol_fiche_end(); + $listofvariantselected = ''; // Create or edit a varian if ($action == 'add' || ($action == 'edit')) { @@ -386,7 +387,7 @@ if (! empty($id) || ! empty($ref)) //print dol_fiche_head(); $features = $_SESSION['addvariant_'.$object->id]; //First, sanitize - print '
'; + $listofvariantselected = '
'; if (! empty($features)) { foreach ($features as $feature) { @@ -400,16 +401,14 @@ if (! empty($id) || ! empty($ref)) continue; } - print '' . $prodattr->label . ':'. $prodattr_val->value . ' '; + $listofvariantselected .= '' . $prodattr->label . ':'. $prodattr_val->value . ' '; } } - print '
'; - print '

'; + $listofvariantselected .= '
'; //print dol_fiche_end(); } else { $title = $langs->trans('EditProductCombination'); } - print load_fiche_titre($title); if ($action == 'add') { $prodattr_all = $prodattr->fetchAll(); @@ -499,6 +498,10 @@ if (! empty($id) || ! empty($ref)) '; + + print load_fiche_titre($title); + print '
'."\n"; print ''; print ''."\n"; @@ -507,9 +510,9 @@ if (! empty($id) || ! empty($ref)) print ''."\n"; } - print dol_fiche_head(); + print dol_fiche_head(); - ?> + ?> @@ -524,6 +527,7 @@ if (! empty($id) || ! empty($ref)) print ''; foreach ($prodattr_all as $attr) { + //print ''; print ''; } print ''; @@ -561,6 +565,10 @@ if (! empty($id) || ! empty($ref)) "> + +
+ +
variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?> isProduct()) print ''.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight').''; ?> - getLibStatut(2, 0) ?> - getLibStatut(2, 1) ?> + getLibStatut(2, 0) ?> + getLibStatut(2, 1) ?> From 67d76787eba1dd3493dc435c36d5695751584131 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 15:29:06 +0200 Subject: [PATCH 094/409] Add new hidden conf VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT --- htdocs/product/stock/product.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 9ef671e9913..944b3ce96cd 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -764,7 +764,7 @@ if (empty($reshook)) if ($user->rights->stock->mouvement->creer) { - if (! $variants) { + if (! $variants || ! empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { print '' . $langs->trans("CorrectStock") . ''; } else @@ -780,7 +780,7 @@ if (empty($reshook)) //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) if ($user->rights->stock->mouvement->creer) { - if (! $variants) { + if (! $variants || ! empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { print '' . $langs->trans("TransferStock") . ''; } else From cef935468d6669765ee563b97cb0275824e4799e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Oct 2019 18:40:39 +0200 Subject: [PATCH 095/409] Update list.php --- htdocs/compta/bank/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 843b3b0e323..df5442f02d6 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -454,7 +454,7 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['b.account_number']['checked'])) { print ''; - if (! empty($conf->accounting->enabled)) + if (! empty($conf->accounting->enabled) && ! empty($objecttmp->account_number)) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $objecttmp->account_number, 1); @@ -472,7 +472,7 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) { print ''; - if (! empty($conf->accounting->enabled)) + if (! empty($conf->accounting->enabled) && ! empty($objecttmp->fk_accountancy_journal)) { $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objecttmp->fk_accountancy_journal); From 9c94ffeea9cb61efd5cdb2dc3cf6693d9709ef3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 18:40:41 +0200 Subject: [PATCH 096/409] Fix css --- htdocs/comm/mailing/cibles.php | 2 +- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 3cc5f12566d..532e792bd6e 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -338,7 +338,7 @@ if ($object->fetch($id) >= 0) print '
'; if (empty($obj->picto)) $obj->picto='generic'; - print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto); + print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle pictomodule"'); print ' '; print $obj->getDesc(); print '
'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 46d24b08cc6..0189a3988dd 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1293,6 +1293,9 @@ div.nopadding { .pictowarning { vertical-align: text-bottom; } +.pictomodule { + width: 14px; +} .fiche .arearef img.pictoedit, .fiche .arearef span.pictoedit, .fiche .fichecenter img.pictoedit, .fiche .fichecenter span.pictoedit, .tagtdnote span.pictoedit { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a9e94eb885c..8e0cf75047b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1483,6 +1483,9 @@ table.noborder tr.liste_titre td { .pictowarning { vertical-align: text-bottom; } +.pictomodule { + width: 14px; +} .fiche .arearef img.pictoedit, .fiche .arearef span.pictoedit, .fiche .fichecenter img.pictoedit, .fiche .fichecenter span.pictoedit, .tagtdnote span.pictoedit { From 650cd2b54ffe616cff7228a0478291812b08ffdd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 18:41:33 +0200 Subject: [PATCH 097/409] Prepare 10.0.3 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 94455858e8b..fffd9be3636 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From b424fc6e274a2596428291cd8b4612978f6a1e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Oct 2019 18:57:08 +0200 Subject: [PATCH 098/409] Update list.php --- htdocs/compta/bank/list.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 843b3b0e323..de8c743803c 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -505,8 +505,13 @@ foreach ($accounts as $key=>$type) if ($result<0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } else { - print $result->nbtodo; - if ($result->nbtodolate) print '   ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; + print ''.$result->nbtodo.''; + if ($result->nbtodolate) { + print ' '; + print ''; + print ' '.$result->nbtodolate; + print ''; + } } } else print $langs->trans("FeatureDisabled"); From c338db6c367be395ae2f8df826875adeb0475281 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 19:16:36 +0200 Subject: [PATCH 099/409] Fix unlink picto --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a17b3c19c5f..1aee5e67cd5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3135,7 +3135,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $marginleftonlyshort=0; } elseif ($pictowithouttext == 'unlink') { - $fakey = 'fa-chain-broken'; + $fakey = 'fa-unlink'; $facolor = '#555'; } elseif ($pictowithouttext == 'playdisabled') { @@ -3169,6 +3169,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ //$facolor = '#444'; $marginleftonlyshort=0; } + //this snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only. //class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes $reg=array(); From 33f620603107909a180a3c5293022ca2b33088a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Oct 2019 20:12:24 +0200 Subject: [PATCH 100/409] NEW Add link to export target of emailings into a CSV file. --- htdocs/comm/mailing/cibles.php | 76 +++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 1e467331d90..4ca8b75af31 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -54,16 +54,17 @@ if (! $sortorder) $sortorder="ASC"; $id=GETPOST('id', 'int'); $rowid=GETPOST('rowid', 'int'); $action=GETPOST('action', 'aZ09'); -$search_lastname=GETPOST("search_lastname"); -$search_firstname=GETPOST("search_firstname"); -$search_email=GETPOST("search_email"); -$search_other=GETPOST("search_other"); -$search_dest_status=GETPOST('search_dest_status'); +$search_lastname=GETPOST("search_lastname", 'alphanohtml'); +$search_firstname=GETPOST("search_firstname", 'alphanohtml'); +$search_email=GETPOST("search_email", 'alphanohtml'); +$search_other=GETPOST("search_other", 'alphanohtml'); +$search_dest_status=GETPOST('search_dest_status', 'alphanohtml'); // Search modules dirs $modulesdir = dolGetModulesDirs('/mailings'); $object = new Mailing($db); +$result=$object->fetch($id); /* @@ -112,7 +113,7 @@ if ($action == 'add') } } -if (GETPOST('clearlist')) +if (GETPOST('clearlist', 'int')) { // Loading Class $obj = new MailingTargets($db); @@ -123,6 +124,50 @@ if (GETPOST('clearlist')) */ } +if (GETPOST('exportcsv', 'int')) +{ + $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'csv'; + header('Content-Type: text/csv'); + header('Content-Disposition: attachment;filename=' . $completefilename); + + // List of selected targets + $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,"; + $sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; + $sql .= " WHERE mc.fk_mailing=".$object->id; + $sql .= $db->order($sortfield, $sortorder); + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $sep = ','; + + while ($obj = $db->fetch_object($resql)) + { + print $obj->rowid . $sep; + print $obj->lastname . $sep; + print $obj->firstname . $sep; + print $obj->email . $sep; + print $obj->other . $sep; + print $obj->date_envoi . $sep; + print $obj->tms . $sep; + print $obj->source_url . $sep; + print $obj->source_id . $sep; + print $obj->source_type . $sep; + print $obj->error_text . $sep; + print "\n"; + } + + exit; + } + else + { + dol_print_error($db); + } + exit; +} + if ($action == 'delete') { // Ici, rowid indique le destinataire et id le mailing @@ -437,10 +482,11 @@ if ($object->fetch($id) >= 0) $param = "&id=".$object->id; //if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname); - if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname); - if ($search_email) $param.= "&search_email=".urlencode($search_email); - if ($search_other) $param.= "&search_other=".urlencode($search_other); + if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname); + if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname); + if ($search_email) $param.= "&search_email=".urlencode($search_email); + if ($search_other) $param.= "&search_other=".urlencode($search_other); + if ($page) $param.= "&page=".urlencode($page); print ''; print ''; @@ -449,11 +495,12 @@ if ($object->fetch($id) >= 0) print ''; print ''; - $cleartext=''; + $morehtmlcenter=''; if ($allowaddtarget) { - $cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'id.'" class="button reposition">'.$langs->trans("TargetsReset").''; + $morehtmlcenter=''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition">'.$langs->trans("TargetsReset").''; } - print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $cleartext, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); + $morehtmlcenter.=' id.'">'.$langs->trans("Download").''; + print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); print ''; @@ -466,9 +513,6 @@ if ($object->fetch($id) >= 0) print ''; print ''; - - if ($page) $param.= "&page=".$page; - print '
'; print ''; From bb21d048f476d749836ddfb29ac196e6487787f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Oct 2019 22:08:11 +0200 Subject: [PATCH 101/409] keep a copy of object for trigger --- htdocs/contact/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 4139176e84e..9de1672db90 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -250,6 +250,7 @@ if (empty($reshook)) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->contact->supprimer) { $result=$object->fetch($id); + $object->oldcopy = clone $object; $object->old_lastname = GETPOST("old_lastname"); $object->old_firstname = GETPOST("old_firstname"); From 2d3a6d2108f5aa09853830c26d05defd155ee0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:05:21 +0200 Subject: [PATCH 102/409] Update card.php --- htdocs/societe/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 39754b14fe0..e2a8f731856 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -817,6 +817,7 @@ if (empty($reshook)) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { $object->fetch($socid); + $object->oldcopy = clone $object; $result = $object->delete($socid, $user); if ($result > 0) From f6a2fd6eb88a31cf2a96dcfdd2d061a829d66884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:08:32 +0200 Subject: [PATCH 103/409] Update card.php --- htdocs/user/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index bdef850fa6b..edcb99678bb 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -156,6 +156,7 @@ if (empty($reshook)) { $object = new User($db); $object->fetch($id); + $object->oldcopy = clone $object; $result = $object->delete($user); if ($result < 0) { From 9eaad235640851791a4ea6fa013446c33fcf78a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:12:53 +0200 Subject: [PATCH 104/409] Update api_contacts.class.php --- htdocs/societe/class/api_contacts.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index b2432afe243..cfddddb7b96 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -292,7 +292,7 @@ class Contacts extends DolibarrApi { throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } - + $this->contact->oldcopy = clone $this->contact; return $this->contact->delete($id); } From 809d98129f5640ead0c2ee3601c66d66d5c13bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:14:45 +0200 Subject: [PATCH 105/409] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3d2104cc6f2..adcde4b0d5e 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -418,7 +418,7 @@ class Thirdparties extends DolibarrApi // External modules should update their ones too if (!$errors) { -$reshook = $hookmanager->executeHooks('replaceThirdparty', array( + $reshook = $hookmanager->executeHooks('replaceThirdparty', array( 'soc_origin' => $soc_origin->id, 'soc_dest' => $object->id ), $soc_dest, $action); @@ -488,6 +488,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } + $this->company->oldcopy = $this->company; return $this->company->delete($id); } From 0ae1e8c2a98990f7257c73d4a4a433849c5a257f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:17:57 +0200 Subject: [PATCH 106/409] Update api_users.class.php --- htdocs/user/class/api_users.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 72690c65dcb..9549fbe2ef1 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -350,7 +350,7 @@ class Users extends DolibarrApi { throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } - + $this->useraccount->oldcopy = clone $this->useraccount; return $this->useraccount->delete(DolibarrApiAccess::$user); } From 352df8241e6e9c8405563a2a22db3f82f06ab88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:19:40 +0200 Subject: [PATCH 107/409] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index adcde4b0d5e..ed3b26e04ac 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -488,7 +488,7 @@ class Thirdparties extends DolibarrApi if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $this->company->oldcopy = $this->company; + $this->company->oldcopy = clone $this->company; return $this->company->delete($id); } From 499eb87173aa6b35a843808aca8a5e03e7414c5c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Oct 2019 08:20:37 +0200 Subject: [PATCH 108/409] lang file for holidays is holiday --- htdocs/core/modules/holiday/modules_holiday.php | 4 ++-- htdocs/holiday/document.php | 4 +--- htdocs/holiday/list.php | 2 +- htdocs/index.php | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index 9bd0a448ebc..8797d1f377c 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -96,7 +96,7 @@ class ModelNumRefHolidays public function info() { global $langs; - $langs->load("holidays"); + $langs->load("holiday"); return $langs->trans("NoDescription"); } @@ -108,7 +108,7 @@ class ModelNumRefHolidays public function getExample() { global $langs; - $langs->load("holidays"); + $langs->load("holiday"); return $langs->trans("NoExample"); } diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index a594a920e74..30803a9ecbc 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array('other', 'holidays', 'companies')); +$langs->loadLangs(array('other', 'holiday', 'companies')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -48,8 +48,6 @@ $confirm = GETPOST('confirm', 'alpha'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'holiday', $id, 'holiday'); -$langs->load("holiday"); - // Get parameters $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index f74d731e8bd..1c03e3801b6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('users', 'holidays', 'hrm')); +$langs->loadLangs(array('users', 'holiday', 'hrm')); // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/index.php b/htdocs/index.php index d6ce8c90067..5eee02efa1e 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -218,7 +218,7 @@ if (empty($user->societe_id)) 'askprice', 'projects', 'expensereports', - 'holidays', + 'holiday', 'donations' ); // Dashboard Icon lines From 67278e4781505149fc806501de2a54c746281641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 10:18:41 +0200 Subject: [PATCH 109/409] Update box_last_ticket.php --- htdocs/core/boxes/box_last_ticket.php | 53 +++++++++++++++------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index 5469efd8fc5..18990cd8bb6 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -1,7 +1,8 @@ - * 2016 Christophe Battarel + * Copyright (C) 2013-2016 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018-2019 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 @@ -46,7 +47,7 @@ class box_last_ticket extends ModeleBoxes /** * Constructor - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @param string $param More parameters */ public function __construct($db, $param = '') @@ -70,7 +71,7 @@ class box_last_ticket extends ModeleBoxes $this->max = $max; - dol_include_once("/ticket/class/ticket.class.php"); + require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; $text = $langs->trans("BoxLastTicketDescription", $max); $this->info_box_head = array( @@ -86,7 +87,7 @@ class box_last_ticket extends ModeleBoxes if ($user->rights->ticket->read) { $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; - $sql .= ", s.nom as company_name"; + $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticket_type as type ON type.code=t.type_code"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticket_category as category ON category.code=t.category_code"; @@ -108,7 +109,6 @@ class box_last_ticket extends ModeleBoxes $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $now = gmmktime(); $i = 0; @@ -120,22 +120,30 @@ class box_last_ticket extends ModeleBoxes $late = ''; $ticket = new Ticket($this->db); + $ticket->id = $objp->id; + $ticket->track_id = $objp->track_id; + $ticket->ref = $objp->ref; + $ticket->fk_statut = $objp->fk_statut; + $ticket->subject = $objp->subject; + if ($objp->fk_soc > 0) { + $thirdparty = new Societe($this->db); + $thirdparty->id = $objp->fk_soc; + $thirdparty->email = $objp->socemail; + $thirdparty->client = $objp->client; + $thirdparty->fournisseur = $objp->fournisseur; + $thirdparty->name = $objp->company_name; + $link = $thirdparty->getNomUrl(1); + } else { + $link = dol_print_email($objp->origin_email); + } $r = 0; - // Picto - $this->info_box_contents[$i][0] = array( - 'td' => 'class="left" width="16"', - 'logo' => $this->boximg, - 'url' => dol_buildpath("/ticket/card.php?track_id=" . $objp->track_id, 1), - ); - $r++; - - // Id + // Ticket $this->info_box_contents[$i][$r] = array( 'td' => 'class="left"', - 'text' => $objp->ref, - 'url' => dol_buildpath("/ticket/card.php?track_id=" . $objp->track_id, 1), + 'text' => $ticket->getNomUrl(1), + 'asis' => 1 ); $r++; @@ -143,16 +151,15 @@ class box_last_ticket extends ModeleBoxes $this->info_box_contents[$i][$r] = array( 'td' => 'class="left"', 'text' => $objp->subject, // Some event have no ref - 'url' => dol_buildpath("/ticket/card.php?track_id=" . $objp->track_id, 1), + 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=" . $objp->track_id, ); $r++; // Customer $this->info_box_contents[$i][$r] = array( 'td' => 'class="left"', - 'logo' => ($objp->fk_soc > 0 ? 'company' : ''), - 'text' => ($objp->company_name ? $objp->company_name : $objp->origin_email), - 'url' => ($objp->fk_soc > 0 ? DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->fk_soc : ''), + 'text' => $link, + 'asis' => 1, ); $r++; @@ -164,11 +171,9 @@ class box_last_ticket extends ModeleBoxes $r++; // Statut - $ticketstat = new Ticket($this->db); - $ticketstat->fk_statut = $objp->fk_statut; $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', - 'text' => $ticketstat->getLibStatut(3), + 'text' => $ticket->getLibStatut(3), ); $r++; From 92e4b962faa12b49f205e213bda3eaba7d002fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 10:37:30 +0200 Subject: [PATCH 110/409] Update box_last_modified_ticket.php --- .../core/boxes/box_last_modified_ticket.php | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 87d7e0f7d50..8f86be5a115 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -47,7 +47,7 @@ class box_last_modified_ticket extends ModeleBoxes /** * Constructor - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @param string $param More parameters */ public function __construct($db, $param = '') @@ -71,7 +71,7 @@ class box_last_modified_ticket extends ModeleBoxes $this->max = $max; - dol_include_once("/ticket/class/ticket.class.php"); + require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; $text = $langs->trans("BoxLastModifiedTicketDescription", $max); $this->info_box_head = array( @@ -87,7 +87,7 @@ class box_last_modified_ticket extends ModeleBoxes if ($user->rights->ticket->read) { $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; $sql.= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; - $sql.= ", s.nom as company_name"; + $sql.= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."ticket as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; @@ -107,7 +107,6 @@ class box_last_modified_ticket extends ModeleBoxes $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $now=gmmktime(); $i = 0; @@ -119,23 +118,31 @@ class box_last_modified_ticket extends ModeleBoxes $late = ''; $ticket = new Ticket($this->db); + $ticket->id = $objp->id; + $ticket->track_id = $objp->track_id; + $ticket->ref = $objp->ref; + $ticket->fk_statut = $objp->fk_statut; + $ticket->subject = $objp->subject; + if ($objp->fk_soc > 0) { + $thirdparty = new Societe($this->db); + $thirdparty->id = $objp->fk_soc; + $thirdparty->email = $objp->socemail; + $thirdparty->client = $objp->client; + $thirdparty->fournisseur = $objp->fournisseur; + $thirdparty->name = $objp->company_name; + $link = $thirdparty->getNomUrl(1); + } else { + $link = dol_print_email($objp->origin_email); + } $r=0; - // Picto + // Ticket $this->info_box_contents[$i][0] = array( - 'td' => 'class="left" width="16"', - 'logo' => $this->boximg, - 'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1), - ); - $r++; - - // Id - $this->info_box_contents[$i][$r] = array( 'td' => 'class="left"', - 'text' => $objp->ref, - 'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1), + 'text' => $ticket->getNomUrl(1), + 'asis' => 1, ); $r++; @@ -143,16 +150,15 @@ class box_last_modified_ticket extends ModeleBoxes $this->info_box_contents[$i][$r] = array( 'td' => 'class="left"', 'text' => $objp->subject, // Some event have no ref - 'url' => dol_buildpath("/ticket/card.php?track_id=".$objp->track_id, 1), + 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, ); $r++; // Customer $this->info_box_contents[$i][$r] = array( 'td' => 'class="left"', - 'logo' => ($objp->fk_soc>0?'company':''), - 'text' => ($objp->company_name?$objp->company_name:$objp->origin_email), - 'url' => ($objp->fk_soc>0?DOL_URL_ROOT."/comm/card.php?socid=".$objp->fk_soc:'') + 'text' => $link, + 'asis' => 1, ); $r++; @@ -165,11 +171,9 @@ class box_last_modified_ticket extends ModeleBoxes $r++; // Statut - $ticketstat = new Ticket($this->db); - $ticketstat->fk_statut = $objp->fk_statut; $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', - 'text' => $ticketstat->getLibStatut(3) + 'text' => $ticket->getLibStatut(3) ); $r++; From e50d32dc00536523090307691cd1c0b1d6518119 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Oct 2019 13:20:45 +0200 Subject: [PATCH 111/409] Remove a duplicate line --- htdocs/core/modules/modSociete.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index a0d190c65cd..8d6490becfe 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -269,8 +269,6 @@ class modSociete extends DolibarrModules 't.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel', 'st.code'=>'ProspectStatus','payterm.libelle'=>'PaymentConditions','paymode.libelle'=>'PaymentMode' ); - if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix'; - if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix'; if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->export_fields_array[$r]['s.price_level']='PriceLevel'; // Add multicompany field From 9efc5a1b9d85184c7fab5fb715b8d36f86177662 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Oct 2019 15:00:07 +0200 Subject: [PATCH 112/409] Fix extension --- htdocs/comm/mailing/cibles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 4ca8b75af31..998f4a6c202 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -126,7 +126,7 @@ if (GETPOST('clearlist', 'int')) if (GETPOST('exportcsv', 'int')) { - $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'csv'; + $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'.csv'; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=' . $completefilename); From f91b98d326f6a2f591e6538f1dba9e7ba22ff338 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Oct 2019 20:50:03 +0200 Subject: [PATCH 113/409] Add frequency in template invoice popup --- .../compta/facture/class/facture-rec.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index a71860c01c1..e65db4d2f5e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2012 Cedric Salvador @@ -1241,14 +1241,17 @@ class FactureRec extends CommonInvoice $result=''; $label = '' . $langs->trans("ShowInvoice") . ''; - if (! empty($this->ref)) + if (! empty($this->ref)) { $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->date_last_gen)) + } + if ($this->frequency > 0) { + $label .= '
'.$langs->trans('Frequency') . ': ' . $this->frequency.$this->unit_frequency; + } + if (! empty($this->date_last_gen)) { $label .= '
'.$langs->trans('DateLastGeneration') . ': ' . dol_print_date($this->date_last_gen, 'dayhour'); - if ($this->frequency > 0) - { - if (! empty($this->date_when)) - { + } + if ($this->frequency > 0) { + if (! empty($this->date_when)) { $label .= '
'.$langs->trans('NextDateToExecution') . ': '; $label .= (empty($this->suspended)?'':''). dol_print_date($this->date_when, 'day').(empty($this->suspended)?'':''); // No hour for this property if (! empty($this->suspended)) $label .= ' ('.$langs->trans("Disabled").')'; From 323f31d8323f8e80b1d33d224b5130119f93efe9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Oct 2019 20:54:00 +0200 Subject: [PATCH 114/409] Trans frequency --- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/fiche-rec.php | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index e65db4d2f5e..18d153dc597 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1245,7 +1245,7 @@ class FactureRec extends CommonInvoice $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; } if ($this->frequency > 0) { - $label .= '
'.$langs->trans('Frequency') . ': ' . $this->frequency.$this->unit_frequency; + $label .= '
'.$langs->trans('Frequency') . ': ' . $langs->trans('FrequencyPer_'.$this->unit_frequency, $this->frequency); } if (! empty($this->date_last_gen)) { $label .= '
'.$langs->trans('DateLastGeneration') . ': ' . dol_print_date($this->date_last_gen, 'dayhour'); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 713d5e9554d..fb56ccb916f 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -154,7 +154,7 @@ if (empty($reshook)) // Create predefined invoice if ($action == 'add') { - if (! GETPOST('titre')) + if (! GETPOST('titre', 'nohtml')) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); $action = "create"; @@ -162,15 +162,15 @@ if (empty($reshook)) } $frequency=GETPOST('frequency', 'int'); - $reyear=GETPOST('reyear'); - $remonth=GETPOST('remonth'); - $reday=GETPOST('reday'); - $rehour=GETPOST('rehour'); - $remin=GETPOST('remin'); + $reyear=GETPOST('reyear', 'int'); + $remonth=GETPOST('remonth', 'int'); + $reday=GETPOST('reday', 'int'); + $rehour=GETPOST('rehour', 'int'); + $remin=GETPOST('remin', 'int'); $nb_gen_max=GETPOST('nb_gen_max', 'int'); //if (empty($nb_gen_max)) $nb_gen_max =0; - if (GETPOST('frequency')) + if (GETPOST('frequency', 'int')) { if (empty($reyear) || empty($remonth) || empty($reday)) { @@ -188,12 +188,12 @@ if (empty($reshook)) if (! $error) { - $object->titre = GETPOST('titre', 'alpha'); // deprecated - $object->title = GETPOST('titre', 'alpha'); + $object->titre = GETPOST('titre', 'nohtml'); // deprecated + $object->title = GETPOST('titre', 'nohtml'); $object->note_private = GETPOST('note_private', 'none'); $object->note_public = GETPOST('note_public', 'none'); $object->modelpdf = GETPOST('modelpdf', 'alpha'); - $object->usenewprice = GETPOST('usenewprice'); + $object->usenewprice = GETPOST('usenewprice', 'alpha'); $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); From e2ca646b6e5f6238f2000700b379a2e87a0305f1 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 14 Oct 2019 10:22:47 +0200 Subject: [PATCH 115/409] Fix MS Outlook import error --- htdocs/core/lib/xcal.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index f0edbd6f877..a4ddb68dbd3 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -180,7 +180,9 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) if (! empty($location)) fwrite($calfileh, "LOCATION:".$encoding.$location."\n"); if ($fulldayevent) fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n"); - if ($fulldayevent) fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:1\n"); + + // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2 + if ($fulldayevent) fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n"); // Date must be GMT dates // Current date From 7973b0320166f2cefec0158714e6da9e49eadf2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 11:38:36 +0200 Subject: [PATCH 116/409] NEW Add estimated duration on the BOM module --- htdocs/bom/class/bom.class.php | 5 +- htdocs/core/class/commonobject.class.php | 117 +++++++++++------- .../install/mysql/migration/10.0.0-11.0.0.sql | 2 + htdocs/install/mysql/tables/llx_bom_bom.sql | 1 + htdocs/langs/en_US/mrp.lang | 4 +- 5 files changed, 79 insertions(+), 50 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 44370b40720..73e26de8aea 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -94,6 +94,7 @@ class BOM extends CommonObject 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,), @@ -202,7 +203,7 @@ class BOM extends CommonObject */ public function create(User $user, $notrigger = false) { - if ($this->efficiency < 0 || $this->efficiency > 1) $this->efficiency = 1; + if ($this->efficiency <= 0 || $this->efficiency > 1) $this->efficiency = 1; return $this->createCommon($user, $notrigger); } @@ -412,7 +413,7 @@ class BOM extends CommonObject */ public function update(User $user, $notrigger = false) { - if ($this->efficiency < 0 || $this->efficiency > 1) $this->efficiency = 1; + if ($this->efficiency <= 0 || $this->efficiency > 1) $this->efficiency = 1; return $this->updateCommon($user, $notrigger); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bc1e93314ec..484bb5fa4d4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2572,8 +2572,7 @@ abstract class CommonObject public function updateRangOfLine($rowid, $rang) { $fieldposition = 'rang'; // @TODO Rename 'rang' into 'position' - if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; - if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'position'; + if (in_array($this->table_element_line, array('bom_bomline', 'ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang; $sql.= ' WHERE rowid = '.$rowid; @@ -2879,11 +2878,11 @@ abstract class CommonObject $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL"; elseif ($this->element == 'commande' || $this->element == 'order') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER"; - elseif ($this->element == 'facture') + elseif ($this->element == 'facture' || $this->element == 'invoice') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE"; - elseif ($this->element == 'facture_fourn') + elseif ($this->element == 'facture_fourn' || $this->element == 'supplier_invoice') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_INVOICE"; - elseif ($this->element == 'order_supplier') + elseif ($this->element == 'order_supplier' || $this->element == 'supplier_order') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_ORDER"; elseif ($this->element == 'supplier_proposal') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL"; @@ -6271,18 +6270,12 @@ abstract class CommonObject $value=''; } } - elseif ($type == 'double') + elseif ($type == 'double' || $type == 'real') { if (!empty($value)) { $value=price($value); } } - elseif ($type == 'real') - { - if (!empty($value)) { - $value=price($value); - } - } elseif ($type == 'boolean') { $checked=''; @@ -7115,7 +7108,7 @@ abstract class CommonObject * Function test if type is array * * @param array $info content informations of field - * @return bool + * @return bool true if array */ protected function isArray($info) { @@ -7124,42 +7117,26 @@ abstract class CommonObject if(isset($info['type']) && $info['type']=='array') return true; else return false; } - else return false; - } - - /** - * Function test if type is null - * - * @param array $info content informations of field - * @return bool - */ - protected function isNull($info) - { - if(is_array($info)) - { - if(isset($info['type']) && $info['type']=='null') return true; - else return false; - } - else return false; + return false; } /** * Function test if type is date * * @param array $info content informations of field - * @return bool + * @return bool true if date */ public function isDate($info) { if(isset($info['type']) && ($info['type']=='date' || $info['type']=='datetime' || $info['type']=='timestamp')) return true; - else return false; + return false; } /** * Function test if type is integer * * @param array $info content informations of field - * @return bool + * @return bool true if integer */ public function isInt($info) { @@ -7175,7 +7152,7 @@ abstract class CommonObject * Function test if type is float * * @param array $info content informations of field - * @return bool + * @return bool true if float */ public function isFloat($info) { @@ -7184,14 +7161,14 @@ abstract class CommonObject if (isset($info['type']) && (preg_match('/^(double|real|price)/i', $info['type']))) return true; else return false; } - else return false; + return false; } /** * Function test if type is text * * @param array $info content informations of field - * @return bool + * @return bool true if type text */ public function isText($info) { @@ -7200,7 +7177,39 @@ abstract class CommonObject if(isset($info['type']) && $info['type']=='text') return true; else return false; } - else return false; + return false; + } + + /** + * Function test if field can be null + * + * @param array $info content informations of field + * @return bool true if it can be null + */ + protected function canBeNull($info) + { + if(is_array($info)) + { + if(isset($info['notnull']) && $info['notnull']!='1') return true; + else return false; + } + return true; + } + + /** + * Function test if field is forced to null if zero or empty + * + * @param array $info content informations of field + * @return bool true if forced to null + */ + protected function isForcedToNullIfZero($info) + { + if(is_array($info)) + { + if(isset($info['notnull']) && $info['notnull']=='-1') return true; + else return false; + } + return false; } /** @@ -7216,7 +7225,7 @@ abstract class CommonObject if(isset($info['index']) && $info['index']==true) return true; else return false; } - else return false; + return false; } /** @@ -7309,17 +7318,30 @@ abstract class CommonObject elseif($this->isInt($info)) { if ($field == 'rowid') $this->id = (int) $obj->{$field}; - else $this->{$field} = (int) $obj->{$field}; + else + { + if ($this->isForcedToNullIfZero($info)) + { + if (empty($obj->{$field})) $this->{$field} = null; + else $this->{$field} = (double) $obj->{$field}; + } + else + { + $this->{$field} = (int) $obj->{$field}; + } + } } elseif($this->isFloat($info)) { - $this->{$field} = (double) $obj->{$field}; - } - elseif($this->isNull($info)) - { - $val = $obj->{$field}; - // zero is not null - $this->{$field} = (is_null($val) || (empty($val) && $val!==0 && $val!=='0') ? null : $val); + if ($this->isForcedToNullIfZero($info)) + { + if (empty($obj->{$field})) $this->{$field} = null; + else $this->{$field} = (double) $obj->{$field}; + } + else + { + $this->{$field} = (double) $obj->{$field}; + } } else { @@ -7376,7 +7398,8 @@ abstract class CommonObject if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now); if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id; unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. - + if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref']=dol_string_nospecial($fieldvalues['ref']); // If field is a ref,we sanitize data + $keys=array(); $values = array(); foreach ($fieldvalues as $k => $v) { diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index a857898f5dc..42097685f6f 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2'); -- For v11 +ALTER TABLE llx_bom_bom ADD COLUMN duration double(8,4) DEFAULT NULL; + create table llx_categorie_warehouse ( fk_categorie integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index d66c3f9ffbf..d195dc4ec5d 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -26,6 +26,7 @@ CREATE TABLE llx_bom_bom( fk_product integer, qty double(24,8), efficiency double(8,4) DEFAULT 1, + duration double(8,4) DEFAULT NULL, date_creation datetime NOT NULL, date_valid datetime, tms timestamp, diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 29bb88a80a4..f9c24aadc17 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -21,4 +21,6 @@ NewMO=New Manufacturing Order QtyToProduce=Qty to produce DateStartPlannedMo=Date start planned DateEndPlannedMo=Date end planned -KeepEmptyForAsap=Empty means 'As Soon As Possible' \ No newline at end of file +KeepEmptyForAsap=Empty means 'As Soon As Possible' +EstimatedDuration=Estimated duration +EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM \ No newline at end of file From ef09da87945859d5e68ba03bafff77ac92bdce32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 11:45:13 +0200 Subject: [PATCH 117/409] Fix CSRF check --- htdocs/admin/modulehelp.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index d5b0f864be6..de9d1677932 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -21,7 +21,9 @@ * \brief Page to activate/disable all modules */ -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disabled because this page is into a popup on module search page and we want to avoid to have an Anti CSRF token error (done if MAIN_SECURITY_CSRF_WITH_TOKEN is on) when we make a second search after closing popup. + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; From a33fb4777736de9e14b96618b1256c254d95e679 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 12:10:14 +0200 Subject: [PATCH 118/409] Work on MO module --- htdocs/core/modules/modBom.class.php | 6 +++--- htdocs/core/modules/modVariants.class.php | 2 ++ htdocs/langs/en_US/mrp.lang | 4 ++++ htdocs/theme/eldy/img/object_mrp.png | Bin 0 -> 548 bytes htdocs/theme/md/img/object_movement.png | Bin 0 -> 548 bytes htdocs/theme/md/img/object_mrp.png | Bin 0 -> 548 bytes 6 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 htdocs/theme/eldy/img/object_mrp.png create mode 100644 htdocs/theme/md/img/object_movement.png create mode 100644 htdocs/theme/md/img/object_mrp.png diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 9502c4c0af8..92cd956a260 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -54,14 +54,14 @@ class modBom extends DolibarrModules // It is used to group modules by family in module setup page $this->family = "products"; // Module position in the family on 2 digits ('01', '10', '20', ...) - $this->module_position = '90'; + $this->module_position = '60'; // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); // Module label (no space allowed), used if translation string 'ModuleBomName' not found (Bom is name of module). $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleBomDesc' not found (Bom is name of module). - $this->description = "Bill of Materials (BOM) definitions for Manufacturing Resource Planning"; + $this->description = "Module to define your Bills Of Materials (BOM). Can be used for Manufacturing Resource Planning by the module Manufacturing Orders (MO)"; // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "Bill of Materials definitions. They can be used to make Manufacturing Resource Planning"; @@ -75,7 +75,7 @@ class modBom extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto='generic'; + $this->picto='bom'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 31e008b2870..728107ea08f 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -53,6 +53,8 @@ class modVariants extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "products"; + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = '50'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index f9c24aadc17..9d8e85f889d 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -1,6 +1,10 @@ +Mrp=Manufacturing Orders +MRPDescription=Module to manage Manufacturing Orders (MO). MRPArea=MRP Area +MrpSetupPage=Setup of module MO MenuBOM=Bills of material LatestBOMModified=Latest %s Bills of materials modified +Bom=Bills of Material BillOfMaterials=Bill of Material BOMsSetup=Setup of module BOM ListOfBOMs=List of bills of material - BOM diff --git a/htdocs/theme/eldy/img/object_mrp.png b/htdocs/theme/eldy/img/object_mrp.png new file mode 100644 index 0000000000000000000000000000000000000000..38b59646d710dfac4f94e01bbf41bb6b1779c0c6 GIT binary patch literal 548 zcmV+<0^9wGP)NCbZ?_my9^sP^Lq==>fRY)$Zp?_lD zm4N3MYAVYy+g(Qz_l6<+!_ZICIQp>xHv%7>!@AUfkS5^?d@B=4{3G}lxxXF++Oh+gwij(rEZ`+=bs!~^1 zJ=C%giU~|D3(2Rz|4_O4PGRIUz|zVW@yXQN-wZ(zYl%!YLVY0J1 mN5A$LDKQhLw=ZjNO#cI4PwLNUR3Co;00001s=)Ifzm#A|bYiS|b)bxV3E9MBBK;fUyVJCZIttE=F*Ppj+_g z6%XK!ZR90Gl8{kVy$)NMn>@pos|wr?IUtiZL`Xv=%?NisA{rd@^xL8vj-~*CCk` znkwDt8i)zfb18P_vLwkrJK>vncIbf+yYum>Xm?ExZtD+!)X1uk=Hu$Il>bBY_4)qt zc;H5Daph}LmA7Lxf2%yhm)Yp2c6$_NufFn*(yh{y!IQ;@!NSvWUt@CV0&m=o9>F)y zPWMFC{*(^amI__NCbZ?_my9^sP^Lq==>fRY)$Zp?_lD zm4N3MYAVYy+g(Qz_l6<+!_ZICIQp>xHv%7>!@AUfkS5^?d@B=4{3G}lxxXF++Oh+gwij(rEZ`+=bs!~^1 zJ=C%giU~|D3(2Rz|4_O4PGRIUz|zVW@yXQN-wZ(zYl%!YLVY0J1 mN5A$LDKQhLw=ZjNO#cI4PwLNUR3Co;0000 Date: Mon, 14 Oct 2019 12:27:44 +0200 Subject: [PATCH 119/409] Fix trans export --- htdocs/exports/export.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index df298153062..c404fc2b264 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Load translation files required by the page -$langs->loadlangs(array('exports', 'other', 'users', 'companies', 'projects')); +$langs->loadlangs(array('admin', 'exports', 'other', 'users', 'companies', 'projects', 'suppliers', 'products')); // Everybody should be able to go on this page //if (! $user->admin) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5996d643624..bef32dfcd84 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1061,6 +1061,7 @@ CompanyTown=Town CompanyCountry=Country CompanyCurrency=Main currency CompanyObject=Object of the company +IDCountry=ID country Logo=Logo DoNotSuggestPaymentMode=Do not suggest NoActiveBankAccountDefined=No active bank account defined From b4827dbe067e6755665a268262c9ea2deb59f4fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 12:30:26 +0200 Subject: [PATCH 120/409] Prepare 10.0.3 --- ChangeLog | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ee409bb7588..3583c10385b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,8 +2,68 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 10.0.2 compared to 10.0.1 ***** +***** ChangeLog for 10.0.3 compared to 10.0.2 ***** +FIX: #11702 +FIX: #11861 No consistent code to manage measuring units +FIX: #11942 +FIX: #12026 +FIX: #12040 +FIX: #12041 +FIX: #12054 +FIX: #12083 +FIX: #12088 +FIX: access to public interface when origin email has an alias. +FIX: Alias name is not into the email recipient label. +FIX: allow standalone credit note even if no invoice +FIX: an admin can not access his own permissions after enabling advanced +FIX: an admin can not access his own permissions after enabling advanced permissions +FIX: Attachement of linked files on ticket when sending a message +FIX: avoid non numeric warning +FIX: Bad currency var used in stripe for connect +FIX: Bad list of ticket on public interface for ticket emailcollector +FIX: Can't modify vendor invoice if transfered into accountancy +FIX: change product type must be allowed if we activate hidden conf +FIX: colspan on VAT quadri report +FIX: CSS +FIX: Debug feature orderstoinvoice for suppliers +FIX: do not output return code on screen after a select of bank account +FIX: Edit of ticket module parameters erased others +FIX: empty cache when we want to load specific warehouses in select +FIX: escape email alias +FIX: expedition.class.php +FIX: Export of leave request show the number of open days +FIX: Filtering the HTTP Header "Accept-Language". +FIX: Filter on project on ticket list +FIX: Filter "Open all" of ticket was ko. +FIX: Force downlaod of file with .noexe as octet-stream mime type +FIX: form not closed. +FIX: hidden conf to prevent from changing product_type +FIX: If product account not suggested during bind, it is not preselected +FIX: If we share invoice, we need to see discount created from a deposit on each entity +FIX: Import of product using units +FIX: label of thirdparty is wrong on open project list +FIX: Look and feel v10 +FIX: missing begin() +FIX: missing "$this->id" in "fetch" function +FIX: navigation on ticket tab of projects +FIX: new invoice with generic thirdparty in takepos +FIX: Pb in units of shipments +FIX: regression with option to hide picto on top menu +FIX: selection of project i am contact of. +FIX: Send email from expense report card. +FIX: shipping card: missing user error messages when classifying closed or billed +FIX: SQL injection on qty +FIX: stripe payment when there is a quote into address +FIX: Substitution of __PROJECT_XXX__ not done +FIX: TakePOS no invoice validation control and good payment translate +FIX: the access of the bank account of one user +FIX: top menu right padding +FIX: Update of leave request when CSRF with token is on +FIX: Var not enough sanitized +FIX: wrong test +FIX: XSS +***** ChangeLog for 10.0.2 compared to 10.0.1 ***** FIX: #10460 compatibility with MariaDB 10.4 FIX: #11401 Adherent unknown language key FIX: #11422 Can't edit his own events with standard rights From 4e52276d1f99e2aff354b9e32a849f38f95a37ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2019 13:14:02 +0200 Subject: [PATCH 121/409] fix travis --- htdocs/product/inventory/inventory.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index c91834e54e5..c36dd3e47a6 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -288,9 +288,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; } - include DOL_DOCUMENT_ROOT.'/product/inventory/tpl/inventory.tpl.php'; - } // End of page From 84c00a0133fbfcc6275331c019cad210ef101562 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 14:44:14 +0200 Subject: [PATCH 122/409] css --- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 91b50b2a249..f0f74cc1e44 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -70,7 +70,7 @@ $colorbackbody='255,255,255'; $colortexttitlenotab='110,80,20'; $colortexttitle='0,0,0'; $colortext='0,0,0'; -$colortextlink='10, 20, 120'; +$colortextlink='10, 20, 110'; $fontsize='0.86em'; $fontsizesmaller='0.75em'; $topMenuFontSize='1.2em'; From 369f29b1f3c19ddf7f574706704eba013ab78b2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 14:51:44 +0200 Subject: [PATCH 123/409] 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 ddbea5cd43b..850631c6382 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1102,7 +1102,7 @@ div.blockvmenulogo .menulogocontainer { margin: px; margin-left: 8px; - margin-right: 8px; + margin-right: 2px; padding: 0; height: px; /* width: 100px; */ From 0b19c4ff953ca25acbea7424985b6518d2da836c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 14:53:22 +0200 Subject: [PATCH 124/409] 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 850631c6382..9a7972c2381 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1102,7 +1102,7 @@ div.blockvmenulogo .menulogocontainer { margin: px; margin-left: 8px; - margin-right: 2px; + margin-right: 4px; padding: 0; height: px; /* width: 100px; */ From f9f4faa0d2ec1e76cf0eab382f9d09117c96160a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 14:54:30 +0200 Subject: [PATCH 125/409] 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 9a7972c2381..d2cb0e424c4 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1101,7 +1101,7 @@ div.blockvmenulogo } .menulogocontainer { margin: px; - margin-left: 8px; + margin-left: 12px; margin-right: 4px; padding: 0; height: px; From 9922ff39caf97dd5f6d816cd2532343b6ed91415 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 15:01:37 +0200 Subject: [PATCH 126/409] Fix show duration in list of services --- htdocs/product/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 50b1347da6b..1e6f1317b87 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -171,7 +171,7 @@ $arrayfields=array( 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->service->enabled))), 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), - 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), + 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled))), 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))), 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))), @@ -604,7 +604,7 @@ if ($resql) print ''; } // Duration - if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) + if (! empty($arrayfields['p.duration']['checked'])) { print '
'; @@ -748,7 +748,7 @@ if ($resql) if (! empty($arrayfields['p.barcode']['checked'])) { print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"], "p.barcode", "", $param, "", $sortfield, $sortorder); } - if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) { + if (! empty($arrayfields['p.duration']['checked'])) { print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"], "p.duration", "", $param, '', $sortfield, $sortorder, 'center '); } if (! empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center '); @@ -921,7 +921,7 @@ if ($resql) } // Duration - if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) + if (! empty($arrayfields['p.duration']['checked'])) { print ''; print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { - print ''; - } + //if (!empty($conf->multicurrency->enabled)) { + // print ''; + //} print ''; if ($conf->global->PRODUCT_USE_UNITS) print ''; print ''; @@ -1571,8 +1571,7 @@ else $objp = $db->fetch_object($result); - // - + // Line in view mode if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) { print ''; @@ -1608,21 +1607,21 @@ else { print '\n"; } - // TVA + // VAT print ''; // Price print '\n"; // Price multicurrency - if (!empty($conf->multicurrency->enabled)) { + /*if (!empty($conf->multicurrency->enabled)) { print ''; - } - // Quantite + }*/ + // Quantity print ''; // Unit if($conf->global->PRODUCT_USE_UNITS) print ''; - // Remise + // Discount if ($objp->remise_percent > 0) { print '\n"; @@ -1711,7 +1710,7 @@ else print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } } - // Ligne en mode update + // Line in mode update else { // Ligne carac @@ -1741,18 +1740,34 @@ else $doleditor->Create(); print ''; + + // VAT print ''; + + // Price print ''; + + // Price multicurrency + /*if (!empty($conf->multicurrency->enabled)) { + print ''; + }*/ + + // Quantity print ''; + + // Unit if ($conf->global->PRODUCT_USE_UNITS) { print ''; } + + // Discount print ''; + if (! empty($usemargins)) { print ' - +
'; print ''; @@ -939,7 +939,7 @@ if ($resql) $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); } print $duration_value; - print (! empty($duration_unit) && isset($dur[$duration_unit]) ? ' '.$langs->trans($dur[$duration_unit]) : ''); + print ((! empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : ''); } else { From 0a9cc9656405173ea79b765fbdd4cb6914f966d4 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:01:57 +0200 Subject: [PATCH 127/409] Update document.php Add 2 hidden options for set by default a sort (sort and order) on document page --- htdocs/comm/propal/document.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 14b845a3e8a..8e3bf45bf68 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -60,6 +60,10 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + +if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} +if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} + if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 720245422e6b2c18edba95fcf82dbe7b7dd3a134 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:04:49 +0200 Subject: [PATCH 128/409] Update document.php add 2 hidden options for sort files on document page --- htdocs/commande/document.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 4d784e299fb..8a40ad83d25 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -59,6 +59,10 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + +if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} +if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} + if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 0cd451ef1ad11751d5b935271054c0bb9ce6e75a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 15:06:21 +0200 Subject: [PATCH 129/409] Fix show duration in list of services --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1e6f1317b87..2b36582025f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -941,7 +941,7 @@ if ($resql) print $duration_value; print ((! empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : ''); } - else + elseif (! preg_match('/^[a-z]$/i', $obj->duration)) // If duration is a simple char (like 's' of 'm'), we do not show value { print $obj->duration; } From f6aafea33c42042fac243e5da992910153b5f63e Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:09:59 +0200 Subject: [PATCH 130/409] Update document.php add 2 hidden options for set a default field and a defaut order on document page --- htdocs/projet/document.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index e16e90982a6..b2065029b72 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -62,6 +62,10 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + +if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} +if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} + if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 6ebdce8a9db1dd739800ce3a727e57ef6caa8144 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:13:07 +0200 Subject: [PATCH 131/409] Update document.php add 2 hidden options for set a default field and a default order on document page --- htdocs/societe/document.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 54a2bea1d41..5ea892f0670 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -55,6 +55,10 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + +if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} +if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} + if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="position_name"; From 83b4f41eb5749e267f2219ffe9a68dcf028690ba Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:15:34 +0200 Subject: [PATCH 132/409] Update document.php add 2 hidden options for set a default field sort and a default order on a document page --- htdocs/contact/document.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 6fb2803f715..b081582337e 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -62,6 +62,10 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + + if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} + if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} + if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 92c624daf0bdd80313bed5a4862e750775bf22de Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 14 Oct 2019 15:28:06 +0200 Subject: [PATCH 133/409] add security.lib.php for dol_hash --- htdocs/blockedlog/class/blockedlog.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index d7302a2c795..4413b78a6a4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1048,6 +1048,7 @@ class BlockedLog if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $fingerprint = dol_hash(print_r($mysoc, true).getRandomPassword(1), '5'); From 44476afdac8d09cae7b3e12d2f3794101d707d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:35:04 +0200 Subject: [PATCH 134/409] FIX: No pricing rule on new clean installation There is no pricing rule on new fresh installation of Dolibarr. I think the pricing rule "PRODUCT_PRICE_UNIQ" should be set by default because it is needed to update a product through API REST. --- htdocs/core/modules/modProduct.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index da2ac06dcea..a3e3e539468 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -85,6 +85,13 @@ class modProduct extends DolibarrModules $this->const[$r][3] = 'Module to control product codes'; $this->const[$r][4] = 0; $r++; + + $this->const[$r][0] = "PRODUCT_PRICE_UNIQ"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "1"; + $this->const[$r][3] = 'pricing rule by default'; + $this->const[$r][4] = 0; + $r++; /*$this->const[$r][0] = "PRODUCT_ADDON_PDF"; $this->const[$r][1] = "chaine"; From 5056d7220b8d67a178ec2cbfa0f5ddbc4a7aeb4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 15:36:28 +0200 Subject: [PATCH 135/409] Fix multicurrency not yet supported on contracts --- htdocs/contrat/card.php | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index bbefeb7eb4f..51f5e7382f6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1559,9 +1559,9 @@ else print ''.$langs->trans("ServiceNb", $cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("PriceUHTCurrency").''.$langs->trans("PriceUHTCurrency").''.$langs->trans("Qty").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").'
'.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."'; print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits); print ''.($objp->subprice != '' ? price($objp->subprice) : '')."'.price($objp->multicurrency_subprice).''.$objp->qty.''.$langs->trans($object->lines[$cursorline-1]->getLabelOfUnit()).''.$objp->remise_percent."%'; print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1); print ''.price($objp->multicurrency_subprice).''; print $form->selectUnits($objp->fk_unit, "unit"); print '%'; @@ -2063,6 +2078,7 @@ else if ($action != 'editline') { $forcetoshowtitlelines=1; + if (empty($object->multicurrency_code)) $object->multicurrency_code = $conf->currency; // TODO Remove this when multicurrency supported on contracts // Add free products/services $object->formAddObjectLine(1, $mysoc, $soc); From 4f10009113a776462c26c4500d3c24c593dc9d63 Mon Sep 17 00:00:00 2001 From: atm-josselin Date: Mon, 14 Oct 2019 15:39:38 +0200 Subject: [PATCH 136/409] Add fields definition in product batch class for extrafields compatibility --- htdocs/product/stock/class/productlot.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index f3cec8f9a98..dd811a66cf6 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -53,6 +53,19 @@ class Productlot extends CommonObject */ public $ismultientitymanaged = 1; + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch'), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), + 'fk_user_author'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511) + ); + /** * @var int Entity */ From e326c232452645506a11ffd295e0cc2f72c7d7fd Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 14 Oct 2019 15:48:24 +0200 Subject: [PATCH 137/409] add missing translation --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index e6b960be0ce..c101f73fca0 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -307,7 +307,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right - // Positionne $this->atleastonediscount si on a au moins une remise + // Set $this->atleastonediscount if you have at least one discount for ($i = 0 ; $i < $nblines ; $i++) { if ($object->lines[$i]->remise_percent) @@ -361,7 +361,7 @@ class pdf_einstein extends ModelePDFCommandes } } - // Affiche notes + // Displays notes $notetoshow=empty($object->note_public)?'':$object->note_public; if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { @@ -461,7 +461,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // VAT Rate if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) @@ -503,7 +503,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); - // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva + // Collection of totals by value of vat in $this->vat["rate"] = total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; From fd90ebe63ba6780881497255567dc64617156a40 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 14 Oct 2019 15:57:29 +0200 Subject: [PATCH 138/409] add missing translation --- .../modules/commande/doc/pdf_eratosthene.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 90efc67cd7f..9688d160303 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -430,7 +430,7 @@ class pdf_eratosthene extends ModelePDFCommandes { $pdf->rollbackTransaction(true); - // prepar pages to receive notes + // prepare pages to receive notes while ($pagenb < $pageposafternote) { $pdf->AddPage(); $pagenb++; @@ -464,7 +464,7 @@ class pdf_eratosthene extends ModelePDFCommandes } - // apply note frame to previus pages + // apply note frame to previous pages $i = $pageposbeforenote; while ($i < $pageposafternote) { $pdf->setPage($i); @@ -526,7 +526,7 @@ class pdf_eratosthene extends ModelePDFCommandes } - // Use new auto collum system + // Use new auto column system $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); // tab simulation to know line height @@ -636,7 +636,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // VAT Rate if ($this->getColumnStatus('vat')) @@ -701,7 +701,7 @@ class pdf_eratosthene extends ModelePDFCommandes $reshook=$hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook - // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva + // Collection of totals by value of vat in $this->vat["rate"] = total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; From 28339920b3cf3d3e952c524c9262fbc2a345729b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 16:00:03 +0200 Subject: [PATCH 139/409] Translation --- htdocs/compta/facture/class/facture.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index baaed787023..713c68c8e8a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1233,7 +1233,7 @@ class Facture extends CommonInvoice */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '') { - global $langs, $conf, $user; + global $langs, $conf, $user, $mysoc; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips @@ -1276,11 +1276,11 @@ class Facture extends CommonInvoice if (! empty($this->total_ht)) $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->trans('AmountVAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000' - $label.= '
' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->transcountry('AmountLT1', $mysoc->country_code) . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_localtax2) && $this->total_localtax2 != 0) - $label.= '
' . $langs->trans('LT2') . ': ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->transcountry('AmountLT2', $mysoc->country_code) . ': ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($moretitle) $label.=' - '.$moretitle; @@ -2136,7 +2136,7 @@ class Facture extends CommonInvoice if ($this->paye != 1) { $this->db->begin(); - + $now=dol_now(); dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG); @@ -3557,7 +3557,7 @@ class Facture extends CommonInvoice $cluser->fetch($obj->fk_user_closing); $this->user_closing = $cluser; } - + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); $this->date_validation = $this->db->jdate($obj->datev); From dba9450b0104e74245ebab78734b70a041757a2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 16:03:12 +0200 Subject: [PATCH 140/409] css --- htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index f9e3d4336f0..f6f854d9635 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -48,7 +48,7 @@ foreach($linkedObjectBlock as $key => $objectlink) ?>
trans("RepeatableInvoice"); ?>getNomUrl(1); ?>getNomUrl(1); ?> date_when, 'day'); ?> Date: Mon, 14 Oct 2019 16:07:54 +0200 Subject: [PATCH 141/409] css --- htdocs/theme/eldy/global.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d2cb0e424c4..2eb5a4d17e9 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -785,6 +785,9 @@ table[summary="list_of_modules"] .fa-cog { font-size: 1.5em; } +.linkedcol-element { + min-width: 100px; +} /* ============================================================================== */ /* Styles to hide objects */ @@ -865,6 +868,10 @@ table[summary="list_of_modules"] .fa-cog { .minwidth300imp { min-width: 300px !important; } .minwidth400imp { min-width: 300px !important; } .minwidth500imp { min-width: 300px !important; } + + .linkedcol-element { + min-width: unset; + } } /* Force values for small screen 1000 */ From 4b7987374b699fb7168bd238409f3a3083a955f8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 14 Oct 2019 14:46:04 +0000 Subject: [PATCH 142/409] Fixing style errors. --- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6babe8076a8..45cc0399a93 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1287,11 +1287,11 @@ class Propal extends CommonObject $object->datep = $now; // deprecated $object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600); if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $object->ref_client = ''; - if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING==1) + if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING==1) { $object->note_private = ''; $object->note_public = ''; - } + } // Create clone $object->context['createfromclone']='createfromclone'; $result=$object->create($user); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7f5432682ab..70edd98a2f0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1046,11 +1046,11 @@ class Facture extends CommonInvoice $object->close_code = ''; $object->close_note = ''; $object->products = $object->lines; // For backward compatibility - if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING==1) + if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING==1) { $object->note_private = ''; $object->note_public = ''; - } + } // Loop on each line of new invoice foreach($object->lines as $i => $line) From dbdc62b0289c1cd71bffd0acd29d569e72d8f869 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 18:41:46 +0200 Subject: [PATCH 143/409] Fix td --- htdocs/compta/prelevement/create.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 61db16c505c..3aaad5662a3 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -142,7 +142,7 @@ if ($nb < 0 || $nb1 < 0 || $nb11 < 0) { dol_print_error($bprev->error); } -print ''; +print '
'; print ''; print ''; print ''; print ''; + print ''; print ''; } else From 2257706a3026edc8908941bbb87d2ce6d6868e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Mon, 14 Oct 2019 22:22:20 +0200 Subject: [PATCH 159/409] New: Update product type with update method --- htdocs/product/class/api_products.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 2a9f407bf54..81e2659d918 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -246,8 +246,13 @@ class Products extends DolibarrApi } $this->product->$field = $value; } + + $updatetype = false; + if ($this->product->type != $oldproduct->type && ($this->product->isProduct() || $this->product->isService())) { + $updatetype = true; + } - $result = $this->product->update($id, DolibarrApiAccess::$user, 1, 'update'); + $result = $this->product->update($id, DolibarrApiAccess::$user, 1, 'update', $updatetype); // If price mode is 1 price per product if ($result > 0 && ! empty($conf->global->PRODUCT_PRICE_UNIQ)) { From 3429cb7c1d8dc4d4a43b4372b077a1e998ea6ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Mon, 14 Oct 2019 22:42:38 +0200 Subject: [PATCH 160/409] New: Update product type with update method --- htdocs/product/class/product.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1b46a656511..aa0c575d8d7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -787,13 +787,14 @@ class Product extends CommonObject * Update a record into database. * If batch flag is set to on, we create records into llx_product_batch * - * @param int $id Id of product - * @param User $user Object user making update - * @param int $notrigger Disable triggers - * @param string $action Current action for hookmanager ('add' or 'update') + * @param int $id Id of product + * @param User $user Object user making update + * @param int $notrigger Disable triggers + * @param string $action Current action for hookmanager ('add' or 'update') + * @param int $updatetype Update product type * @return int 1 if OK, -1 if ref already exists, -2 if other error */ - public function update($id, $user, $notrigger = false, $action = 'update') + public function update($id, $user, $notrigger = false, $action = 'update', $updatetype = false) { global $langs, $conf, $hookmanager; @@ -939,6 +940,11 @@ class Product extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."product"; $sql.= " SET label = '" . $this->db->escape($this->label) ."'"; + + if ($updatetype && ($this->isProduct() || $this->isService())) { + $sql.= ", fk_product_type = " . $this->type; + } + $sql.= ", ref = '" . $this->db->escape($this->ref) ."'"; $sql.= ", ref_ext = ".(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null"); $sql.= ", default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null"); From b77d2f2ff2d71ac8c1948ee25db8e2b63804f78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2019 23:27:37 +0200 Subject: [PATCH 161/409] Update box_task.php --- htdocs/core/boxes/box_task.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 59b31086db5..dbe1757d55d 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -134,7 +134,13 @@ class box_task extends ModeleBoxes }); }); '; - + // set cookie by js + $boxcontent.=''; + $this->info_box_contents[0][] = array( + 'tr'=>'class="nohover"', + 'td' => 'class="nohover"', + 'textnoformat' => $boxcontent, + ); $sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress"; @@ -163,7 +169,7 @@ class box_task extends ModeleBoxes $sql.= $this->db->plimit($max, 0); $result = $this->db->query($sql); - $i = 0; + $i = 1; if ($result) { $num = $this->db->num_rows($result); while ($objp = $this->db->fetch_object($result)) { @@ -183,8 +189,12 @@ class box_task extends ModeleBoxes $label = $projectstatic->getNomUrl(1).' '.$taskstatic->getNomUrl(1).' '.dol_htmlentities($taskstatic->label); - $boxcontent.= getTaskProgressView($taskstatic, $label, true, false, true); + $boxcontent = getTaskProgressView($taskstatic, $label, true, false, true); + $this->info_box_contents[$i][] = array( + 'td' => '', + 'text' => $boxcontent, + ); $i++; } } else { @@ -192,15 +202,6 @@ class box_task extends ModeleBoxes } } - // set cookie by js - if(empty($i)){ - $boxcontent.=''; - } - - $this->info_box_contents[0][] = array( - 'td' => '', - 'text' => $boxcontent, - ); } /** From 540f20c18f7c0df6726ee35d21d9d11c8d04a326 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 23:49:26 +0200 Subject: [PATCH 162/409] css --- htdocs/theme/eldy/global.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 353c14041f4..0fe2236c33a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1114,8 +1114,8 @@ div.blockvmenulogo } .menulogocontainer { margin: px; - margin-left: 12px; - margin-right: 4px; + margin-left: 11px; + margin-right: 9px; padding: 0; height: px; /* width: 100px; */ From a53c7cfca8d9887e566b21717f59c153072c5f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Oct 2019 00:13:52 +0200 Subject: [PATCH 163/409] Update box_last_modified_ticket.php --- htdocs/core/boxes/box_last_modified_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 8f86be5a115..56299c60429 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -166,7 +166,7 @@ class box_last_modified_ticket extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', - 'text' => dol_print_date($this->db->idate($objp->datec), 'dayhour') + 'text' => dol_print_date($datec, 'dayhour') ); $r++; From 194072fc60ec7728877f51bacbf54407644211bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Oct 2019 00:14:43 +0200 Subject: [PATCH 164/409] Update box_last_ticket.php --- htdocs/core/boxes/box_last_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index 18990cd8bb6..cf4b7f305f7 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -166,7 +166,7 @@ class box_last_ticket extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', - 'text' => dol_print_date($this->db->idate($objp->datec), 'dayhour'), + 'text' => dol_print_date($datec, 'dayhour'), ); $r++; From 415379c4f2e4d9ffd19c454a92999d293e3c93ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 00:27:09 +0200 Subject: [PATCH 165/409] Link show tutorial in middle --- htdocs/accountancy/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 4eab81ea49f..0eeccbd3395 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -88,7 +88,7 @@ if ($conf->accounting->enabled) } - print load_fiche_titre($langs->trans("AccountancyArea"), $showtutorial . $resultboxes['selectboxlist'], 'accountancy'); + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); print '
'; // hideobject is to start hidden print "
\n"; From f50a75194c205863d4bd420e1f7be402be38d5ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 00:44:22 +0200 Subject: [PATCH 166/409] Removed warning --- htdocs/core/class/conf.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 535db40e0e4..60b33e51188 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -227,10 +227,7 @@ class Conf $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); foreach ($filesList as $file) { $file=dol_sanitizeFileName($file); - include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; - foreach ($file2bddconsts as $key=>$value) { - $this->global->$key=$value; - } + include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file must set $this->global->XXX vars. } } @@ -669,6 +666,8 @@ class Conf if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; + if (! isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 1; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; From a1c93cb2e6c5a42a496f2a24bd46dd8dc5d28704 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 02:45:12 +0200 Subject: [PATCH 167/409] MAIN_ACTIVATE_HTML5 is now always on now (so option removed). Look and feel v11 --- htdocs/accountancy/bookkeeping/list.php | 4 ++-- htdocs/core/class/conf.class.php | 3 +-- htdocs/core/lib/functions.lib.php | 7 +++---- htdocs/exports/class/export.class.php | 3 +-- htdocs/theme/eldy/btn.inc.php | 22 ++++++++++++++------ htdocs/theme/eldy/dropdown.inc.php | 2 +- htdocs/theme/eldy/global.inc.php | 18 +++++++++++++--- htdocs/theme/eldy/theme_vars.inc.php | 2 +- htdocs/theme/md/style.css.php | 5 +++++ htdocs/ticket/card.php | 12 +++++++---- htdocs/ticket/class/actions_ticket.class.php | 4 ++-- 11 files changed, 55 insertions(+), 27 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b5f0c06738a..2958a229d24 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -518,9 +518,9 @@ else $buttonLabel = $langs->trans("ExportList"); // Button re-export if (! empty($conf->global->ACCOUNTING_REEXPORT)) { - $newcardbutton =''.img_picto($langs->trans("Activated"), 'switch_on').' '; + $newcardbutton =''.img_picto($langs->trans("Activated"), 'switch_on').' '; } else { - $newcardbutton =''.img_picto($langs->trans("Disabled"), 'switch_off').' '; + $newcardbutton =''.img_picto($langs->trans("Disabled"), 'switch_off').' '; } $newcardbutton.= ''.$langs->trans("IncludeDocsAlreadyExported").''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 60b33e51188..287d8121213 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -439,7 +439,6 @@ class Conf // Set some default values //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month - $this->global->MAIN_ACTIVATE_HTML5=1; $this->global->MAIN_MAIL_USE_MULTI_PART=1; // societe @@ -666,7 +665,7 @@ class Conf if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; - if (! isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 1; + if (! isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f178a25f4c2..7bda225978f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4125,7 +4125,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict if ($picto == 'setup') $picto='generic'; $return.= "\n"; - $return.= '
'.$langs->trans("NbOfInvoiceToWithdraw").''; @@ -161,6 +161,7 @@ print ''; if ($mesg) print $mesg; print "
\n"; + print '
'; print ''; if ($nb) { @@ -193,6 +194,7 @@ else } print "
\n"; + print "
\n"; print '
'; @@ -245,7 +247,7 @@ if ($resql) print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit); - print ''; + print '
'; print ''; print ''; print ''; @@ -299,7 +301,10 @@ if ($resql) $i++; } } - else print ''; + else + { + print ''; + } print "
'.$langs->trans("Invoice").''.$langs->trans("ThirdParty").'
'.$langs->trans("None").'
'.$langs->trans("None").'
"; print ""; print "
\n"; From 3b84e2bac34b72a200bdad73fed5710b0930e464 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 19:21:13 +0200 Subject: [PATCH 144/409] Use img-thumb css --- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/core/lib/website2.lib.php | 2 +- htdocs/theme/eldy/global.inc.php | 6 ++++++ htdocs/theme/eldy/theme_vars.inc.php | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 66698be76cc..be5871bf6e3 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -397,7 +397,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); else $title=$langs->trans("ShowPreview"); - print ''.$title.''; + print ''.$title.''; print '
'; if ($subdir == $selected_theme) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 9b2abe22904..ba2505cc15a 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -433,7 +433,7 @@ function showWebsiteTemplates(Website $website) if (! empty($urladvanced)) $ret.=''; else $ret.=''; print $ret; - print ''.$title.''; + print ''.$title.''; print ''; print '
'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2eb5a4d17e9..353c14041f4 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -789,6 +789,12 @@ table[summary="list_of_modules"] .fa-cog { min-width: 100px; } +.img-skinthumb { + width: 160px; + height: 120px; +} + + /* ============================================================================== */ /* Styles to hide objects */ /* ============================================================================== */ diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index f0f74cc1e44..37569ebcd6c 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -67,7 +67,7 @@ $colorbacklinepairhover='230,237,244'; // line hover $colorbacklinepairchecked='230,237,244'; // line checked $colorbacklinebreak='233,228,230'; // line break $colorbackbody='255,255,255'; -$colortexttitlenotab='110,80,20'; +$colortexttitlenotab='140,80,10'; // 140,80,10 or 10,140,80 $colortexttitle='0,0,0'; $colortext='0,0,0'; $colortextlink='10, 20, 110'; From 502d154cea7fd7c85415463762fca7ec7ad304b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2019 20:01:35 +0200 Subject: [PATCH 145/409] Update check_notifications.php --- htdocs/core/ajax/check_notifications.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index dd994823a4b..02e304b3d44 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Juanjo Menent + * Copyright (C) 2019 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 @@ -16,6 +17,7 @@ * along with this program. If not, see . */ +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); From 45b3d623bbe90e57252377a6f6efc4404bf33a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2019 20:30:31 +0200 Subject: [PATCH 146/409] Update list.php --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 8985ee33de2..1da06b03d63 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -805,7 +805,7 @@ if ($resql) if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'],$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total_ht','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'],$_SERVER['PHP_SELF'],'f.localtax1','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'],$_SERVER['PHP_SELF'],'f.localtax2','',$param,'align="right"',$sortfield,$sortorder); From 056f7f826bfaad2048597b4a785467176fcee0d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 20:41:28 +0200 Subject: [PATCH 147/409] Clean code --- htdocs/modulebuilder/template/myobject_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 72bc424c53c..132bf158ac8 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -446,7 +446,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone if (! empty($user->rights->mymodule->write)) { - print ''; + print '' . $langs->trans("ToClone") . ''."\n"; } /* From 5a5599754075cdff0d484c9f43566ce3e89690d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 20:53:18 +0200 Subject: [PATCH 148/409] Update pdf_eratosthene.modules.php --- 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 9688d160303..d3f7f3016a0 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -701,7 +701,7 @@ class pdf_eratosthene extends ModelePDFCommandes $reshook=$hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook - // Collection of totals by value of vat in $this->vat["rate"] = total_tva + // Collection of totals by value of vat in $this->tva["rate"] = total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; From 3866ac60363a90376dfa6e4e906310888054bbcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 21:18:22 +0200 Subject: [PATCH 149/409] Update document.php --- htdocs/societe/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 5ea892f0670..971944c4f30 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -56,8 +56,8 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} -if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} +if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; } +if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; } if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="position_name"; From c8d3aea18ae84e43d8030224d181ad53baf0a8c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 21:20:17 +0200 Subject: [PATCH 150/409] Update document.php --- htdocs/commande/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 8a40ad83d25..515e14095bd 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -60,8 +60,8 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} -if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} +if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; } +if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; } if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 15d4a185996d3e29a7b5765a0b86121cea6513b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 21:21:04 +0200 Subject: [PATCH 151/409] Update document.php --- htdocs/projet/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index b2065029b72..10c7a140df7 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -63,8 +63,8 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} -if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} +if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; } +if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; } if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From e5e94f5e7a0c938f3900b58e3e77214586d3aaa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 21:23:08 +0200 Subject: [PATCH 152/409] Update document.php --- htdocs/contact/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index b081582337e..ad8bbb68e5f 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -63,8 +63,8 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; - if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} - if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} + if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; } + if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; } if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 176436ec341665648a8d75f07d5a7c674086ca2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2019 21:23:52 +0200 Subject: [PATCH 153/409] Update document.php --- htdocs/comm/propal/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 8e3bf45bf68..eca5ce52fa7 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -61,8 +61,8 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (isset($conf->global->MAIN_DOC_SORT_FIELD)){$sortfield=$conf->global->MAIN_DOC_SORT_FIELD;} -if (isset($conf->global->MAIN_DOC_SORT_ORDER)){$sortorder=$conf->global->MAIN_DOC_SORT_ORDER;} +if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; } +if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; } if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; From 7ce5ddbf025a2bb6e7f895929348105d20fbdafc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 14 Oct 2019 21:25:43 +0200 Subject: [PATCH 154/409] Internationalization --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index d2dd1f56218..badf7343295 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -269,7 +269,7 @@ class pdf_strato extends ModelePDFContract $tab_top = 90; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); - // Affiche notes + // Display notes if (! empty($object->note_public)) { $tab_top -= 2; @@ -411,7 +411,7 @@ class pdf_strato extends ModelePDFContract $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -613,7 +613,7 @@ class pdf_strato extends ModelePDFContract pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->CONTRACT_DRAFT_WATERMARK); } - //Prepare la suite + //Prepare next $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); @@ -727,7 +727,7 @@ class pdf_strato extends ModelePDFContract $this->recipient = $object->thirdparty; //Recipient name - // On peut utiliser le nom de la societe du contact + // You can use the name of the contact company if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { From b88059433c18706f26bd1f9d0ed5a878c4bc1cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2019 21:36:38 +0200 Subject: [PATCH 155/409] Update list.php --- htdocs/fourn/commande/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 6410f2c9e57..5f0ca9f9be1 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -349,7 +349,7 @@ if (empty($reshook)) { $fk_parent_line = 0; } - $result = $object->addline( + $result = $object->addline( $desc, $lines[$i]->subprice, $lines[$i]->qty, @@ -492,7 +492,9 @@ $sql.= ' cf.date_creation as date_creation, cf.tms as date_update,'; $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_title,"; $sql.= " u.firstname, u.lastname, u.photo, u.login, u.email as user_email"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 From 6761e1ef3334dcddf425d81076dc4f5bbfa5cbed Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 14 Oct 2019 21:38:21 +0200 Subject: [PATCH 156/409] Internationalization --- .../expedition/doc/pdf_espadon.modules.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 8d29edec7d8..40ae16aff59 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -218,7 +218,7 @@ class pdf_espadon extends ModelePdfExpedition if ($conf->expedition->dir_output) { - // Definition de $dir et $file + // Definition of $dir and $file if ($object->specimen) { $dir = $conf->expedition->dir_output."/sending"; @@ -390,10 +390,10 @@ class pdf_espadon extends ModelePdfExpedition } - // Use new auto collum system + // Use new auto column system $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); - // Simulation de tableau pour connaitre la hauteur de la ligne de titre + // Table simulation to know the height of the title line $pdf->startTransaction(); $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); $pdf->rollbackTransaction(true); @@ -606,10 +606,10 @@ class pdf_espadon extends ModelePdfExpedition $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - // Affiche zone totaux + // Display total area $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); - // Pied de page + // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -653,12 +653,12 @@ class pdf_espadon extends ModelePdfExpedition /** * Show total to pay * - * @param PDF $pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice - * @param int $deja_regle Montant deja regle - * @param int $posy Position depart + * @param int $deja_regle Amount already paid + * @param int $posy Start Position * @param Translate $outputlangs Objet langs - * @return int Position pour suite + * @return int Position for suite */ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -673,7 +673,7 @@ class pdf_espadon extends ModelePdfExpedition $tab2_hl = 4; $pdf->SetFont('', 'B', $default_font_size - 1); - // Tableau total + // Total table $col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { @@ -824,7 +824,7 @@ class pdf_espadon extends ModelePdfExpedition pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SHIPPING_DRAFT_WATERMARK); } - //Prepare la suite + //Prepare next $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); @@ -1006,7 +1006,7 @@ class pdf_espadon extends ModelePdfExpedition } //Recipient name - // On peut utiliser le nom de la societe du contact + // You can use the name of the contact company if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { From 30099a821b471cbbcc91ef587fea43c46a43d212 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 14 Oct 2019 19:39:00 +0000 Subject: [PATCH 157/409] Fixing style errors. --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 40ae16aff59..ddc07db0380 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -656,7 +656,7 @@ class pdf_espadon extends ModelePdfExpedition * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Amount already paid - * @param int $posy Start Position + * @param int $posy Start Position * @param Translate $outputlangs Objet langs * @return int Position for suite */ From 234dfec351344e7234175d54274edc4cc8fcda0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2019 21:53:25 +0200 Subject: [PATCH 158/409] add missing td --- htdocs/product/stock/product.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index b91c5d9c5ec..345151138e0 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1073,6 +1073,7 @@ if (! $variants) { print '
'.$langs->trans("Total").''.$stock_total.'
'; // maring bottom must be same than into print_barre_list + $return.= '
'; // maring bottom must be same than into print_barre_list if ($picto) $return.= ''; $return.= ''; } - if (! empty($arrayfields['a.datep2']['checked'])) { + if (! empty($arrayfields['a.datep2']['checked'])) { print ''; @@ -548,6 +548,7 @@ if ($resql) $actionstatic->type_label=$obj->type_label; $actionstatic->type_picto=$obj->type_picto; $actionstatic->label=$obj->label; + $actionstatic->location = $obj->location; $actionstatic->note=dol_htmlentitiesbr($obj->note); print ''; @@ -609,11 +610,11 @@ if ($resql) print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note); print ''; } - + $formatToUse = $obj->fulldayevent?'day':'dayhour'; // Start date if (! empty($arrayfields['a.datep']['checked'])) { print ''; } From 12f1962085501bd3f735ae56d0558fba3bc306ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 00:40:42 +0200 Subject: [PATCH 181/409] Better error message when module file is corrupted --- htdocs/admin/modules.php | 2 +- htdocs/langs/en_US/errors.lang | 1 + htdocs/mrp/class/mo.class.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 787f3ded291..f26e657679a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -190,7 +190,7 @@ if ($action=='install') //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { - setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'
'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors'); + setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
'.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors'); $error++; } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index f8c3c1a1aee..0b4b9b61746 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -196,6 +196,7 @@ ErrorPhpMailDelivery=Check that you don't use a too high number of recipients an ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed. ErrorTaskAlreadyAssigned=Task already assigned to user ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format. +ErrorModuleFileSeemsToHaveAWrongFormat2=At least one mandatory directory must exists into zip of module: %s or %s ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (%s) does not match expected name syntax: %s ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s. ErrorNoWarehouseDefined=Error, no warehouses defined. diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index a459a582bba..d485ec0ef16 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1,3 +1,4 @@ + * Copyright (C) ---Put here your own copyright and developer email--- From b0355dd1498368d293cf1a61cb5ee1e380c06dbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 01:20:58 +0200 Subject: [PATCH 182/409] Module BOM have now status DRAFT, VALIDATED, DISABLED --- htdocs/bom/bom_card.php | 143 ++++++++++++++++++++++- htdocs/bom/class/bom.class.php | 103 +++++++++------- htdocs/commande/class/commande.class.php | 2 +- htdocs/core/class/commonobject.class.php | 53 ++++++++- htdocs/langs/en_US/mrp.lang | 5 +- 5 files changed, 252 insertions(+), 54 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 5f3ec89da61..899fcdbe0e6 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -206,6 +206,62 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } + + if ($action == 'confirm_close' && $confirm == 'yes' && $permissionedit) + { + $result = $object->cancel($user); + if ($result >= 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissionedit) + { + $result = $object->reopen($user); + if ($result >= 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } } @@ -339,13 +395,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } $text = $langs->trans('ConfirmValidateBom', $numref); - if (! empty($conf->notification->enabled)) + /*if (! empty($conf->notification->enabled)) { require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object); - } + }*/ $formquestion=array(); if (! empty($conf->bom->enabled)) @@ -362,7 +418,67 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea ); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + } + + // Confirmation of closing + if ($action == 'close') + { + $text = $langs->trans('ConfirmCloseBom', $object->ref); + /*if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object); + }*/ + + $formquestion=array(); + if (! empty($conf->bom->enabled)) + { + $langs->load("mrp"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + ); + } + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220); + } + + // Confirmation of reopen + if ($action == 'reopen') + { + $text = $langs->trans('ConfirmReopenBom', $object->ref); + /*if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object); + }*/ + + $formquestion=array(); + if (! empty($conf->bom->enabled)) + { + $langs->load("mrp"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + ); + } + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220); } // Clone confirmation @@ -546,20 +662,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + // Validate if ($user->rights->bom->write && $object->status == BOM::STATUS_DRAFT) { - print ''; + if (is_array($object->lines) && count($object->lines) > 0) + { + print '' . $langs->trans("Validate") . ''; + } + else + { + print '' . $langs->trans("Validate") . ''; + } } + // Close / Cancel if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED) { - print ''; + print '' . $langs->trans("Disable") . ''; + } + + // Re-open + if ($user->rights->bom->write && $object->status == BOM::STATUS_CANCELED) + { + print '' . $langs->trans("ReOpen") . ''; } // Clone if ($user->rights->bom->write) { - print ''; + print '' . $langs->trans("ToClone") . ''; } /* diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index c8855c9cc03..3968c6d2813 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -640,62 +640,75 @@ class BOM extends CommonObject * Set draft status * * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - public function setDraft($user) + public function setDraft($user, $notrigger = 0) { - global $conf, $langs; + // Protection + if ($this->status <= self::STATUS_DRAFT) + { + return 0; + } - $error=0; + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + }*/ - // Protection - if ($this->status <= self::STATUS_DRAFT) - { - return 0; - } + return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'BOM_UNVALIDATE'); + } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ + /** + * Set cancel status + * + * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, 0=Nothing done, >0 if OK + */ + public function cancel($user, $notrigger = 0) + { + // Protection + if ($this->status != self::STATUS_VALIDATED) + { + return 0; + } - $this->db->begin(); + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + }*/ - $sql = "UPDATE ".MAIN_DB_PREFIX."bom"; - $sql.= " SET status = ".self::STATUS_DRAFT; - $sql.= " WHERE rowid = ".$this->id; + return $this->setStatusCommon($user, self::STATUS_CANCELED, 'BOM_CLOSE'); + } - dol_syslog(get_class($this)."::setDraft", LOG_DEBUG); - if ($this->db->query($sql)) - { - if (! $error) - { - $this->oldcopy= clone $this; - } + /** + * Set cancel status + * + * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, 0=Nothing done, >0 if OK + */ + public function reopen($user, $notrigger = 0) + { + // Protection + if ($this->status != self::STATUS_CANCELED) + { + return 0; + } - if (!$error) { - // Call trigger - $result=$this->call_trigger('BOM_UNVALIDATE', $user); - if ($result < 0) $error++; - } + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + }*/ - if (!$error) { - $this->status=self::STATUS_DRAFT; - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -1; - } + return $this->setStatusCommon($user, self::STATUS_VALIDATED, 'BOM_REOPEN'); } /** diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 16d9dcdc3d8..66a15857a04 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -647,7 +647,7 @@ class Commande extends CommonOrder $now=dol_now(); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= ' SET fk_statut = '.self::STATUS_CLOSED.','; $sql.= ' fk_user_cloture = '.$user->id.','; $sql.= " date_cloture = '".$this->db->idate($now)."'"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 484bb5fa4d4..d17d49e326e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7399,7 +7399,7 @@ abstract class CommonObject if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id; unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref']=dol_string_nospecial($fieldvalues['ref']); // If field is a ref,we sanitize data - + $keys=array(); $values = array(); foreach ($fieldvalues as $k => $v) { @@ -7857,6 +7857,57 @@ abstract class CommonObject } } + + /** + * Set draft status + * + * @param User $user Object user that modify + * @param int $status New status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @param string $triggercode Trigger code to use + * @return int <0 if KO, >0 if OK + */ + public function setStatusCommon($user, $status, $notrigger = 0, $triggercode = '') + { + $error=0; + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql.= " SET status = ".$status; + $sql.= " WHERE rowid = ".$this->id; + + if ($this->db->query($sql)) + { + if (! $error) + { + $this->oldcopy= clone $this; + } + + if (! $error && ! $notrigger) { + // Call trigger + $result=$this->call_trigger($triggercode, $user); + if ($result < 0) $error++; + } + + if (!$error) { + $this->status = $status; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + } + + /** * Initialise object with example values * Id must be 0 if object instance is a specimen diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 9d8e85f889d..601fe792cd6 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -27,4 +27,7 @@ DateStartPlannedMo=Date start planned DateEndPlannedMo=Date end planned KeepEmptyForAsap=Empty means 'As Soon As Possible' EstimatedDuration=Estimated duration -EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM \ No newline at end of file +EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM +ConfirmValidateBom=Are you sure you want to validate this BOM (you will be able to use it to build new Manufacturing Orders) +ConfirmCloseBom=Are you sure you want to cancel this BOM (you won't be able to use it to build new Manufacturing Orders anymore) ? +ConfirmReopenBom=Are you sure you want to re-open this BOM (you will be able to use it to build new Manufacturing Orders) \ No newline at end of file From d3df04c5aa4b9cd6ca856715e695c30eb1e51a86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 01:36:07 +0200 Subject: [PATCH 183/409] Mutualize code --- htdocs/bom/bom_card.php | 84 ------------------ htdocs/bom/class/bom.class.php | 9 +- htdocs/core/actions_addupdatedelete.inc.php | 88 ++++++++++++++++++- .../template/class/myobject.class.php | 76 ++++++++++++++++ 4 files changed, 168 insertions(+), 89 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 899fcdbe0e6..15ae8f3c21f 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -178,90 +178,6 @@ if (empty($reshook)) $action = ''; } } - - if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit) - { - $result = $object->valid($user); - if ($result >= 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - if ($action == 'confirm_close' && $confirm == 'yes' && $permissionedit) - { - $result = $object->cancel($user); - if ($result >= 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissionedit) - { - $result = $object->reopen($user); - if ($result >= 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 3968c6d2813..284191d0672 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -513,7 +513,7 @@ class BOM extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <=0 if OK, 0=Nothing done, >0 if KO */ - public function valid($user, $notrigger = 0) + public function validate($user, $notrigger = 0) { global $conf, $langs; @@ -553,7 +553,7 @@ class BOM extends CommonObject $this->newref = $num; // Validate - $sql = "UPDATE ".MAIN_DB_PREFIX."bom_bom"; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql.= " SET ref = '".$this->db->escape($num)."',"; $sql.= " status = ".self::STATUS_VALIDATED.","; $sql.= " date_valid='".$this->db->idate($now)."',"; @@ -683,7 +683,7 @@ class BOM extends CommonObject return -1; }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, 'BOM_CLOSE'); + return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'BOM_CLOSE'); } /** @@ -708,9 +708,10 @@ class BOM extends CommonObject return -1; }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, 'BOM_REOPEN'); + return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN'); } + /** * Return a link to the object card (with optionaly the picto) * diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 66428eea974..abe80b5a832 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -18,7 +18,7 @@ /** * \file htdocs/core/actions_addupdatedelete.inc.php - * \brief Code for common actions cancel / add / update / delete / clone + * \brief Code for common actions cancel / add / update / update_extras / delete / deleteline / validate / cancel / reopen / clone */ @@ -231,6 +231,92 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiont } } +// Action validate object +if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit) +{ + $result = $object->valid($user); + if ($result >= 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// Action close object +if ($action == 'confirm_close' && $confirm == 'yes' && $permissionedit) +{ + $result = $object->cancel($user); + if ($result >= 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// Action reopen object +if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissionedit) +{ + $result = $object->reopen($user); + if ($result >= 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } +} // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd)) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 371c4498da8..5c17723e4dd 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -489,6 +489,82 @@ class MyObject extends CommonObject return $this->deleteLineCommon($user, $idline, $notrigger); } + + /** + * Set draft status + * + * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, >0 if OK + */ + public function setDraft($user, $notrigger = 0) + { + // Protection + if ($this->status <= self::STATUS_DRAFT) + { + return 0; + } + + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + }*/ + + return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'BOM_UNVALIDATE'); + } + + /** + * Set cancel status + * + * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, 0=Nothing done, >0 if OK + */ + public function cancel($user, $notrigger = 0) + { + // Protection + if ($this->status != self::STATUS_VALIDATED) + { + return 0; + } + + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + }*/ + + return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'BOM_CLOSE'); + } + + /** + * Set back to validated status + * + * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, 0=Nothing done, >0 if OK + */ + public function reopen($user, $notrigger = 0) + { + // Protection + if ($this->status != self::STATUS_CANCELED) + { + return 0; + } + + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + }*/ + + return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN'); + } + /** * Return a link to the object card (with optionaly the picto) * From ffc48209702ed36c9effb9c30764ed925144cf0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 02:05:23 +0200 Subject: [PATCH 184/409] Fix counter of BOM --- htdocs/bom/bom_card.php | 4 ++-- htdocs/bom/class/bom.class.php | 6 +++--- htdocs/core/actions_addupdatedelete.inc.php | 2 +- htdocs/core/modules/bom/mod_bom_advanced.php | 6 +++--- htdocs/core/modules/bom/mod_bom_standard.php | 10 +++++----- htdocs/langs/en_US/mrp.lang | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 15ae8f3c21f..8e6551e92ea 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -97,8 +97,8 @@ if (empty($reshook)) $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; if (empty($backtopage)) { - if (empty($id)) $backtopage = $backurlforlist; - else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id; + if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist; + else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__'); } $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 284191d0672..d8e5387f075 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -524,7 +524,7 @@ class BOM extends CommonObject // Protection if ($this->statut == self::STATUS_VALIDATED) { - dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); + dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); return 0; } @@ -560,7 +560,7 @@ class BOM extends CommonObject $sql.= " fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::valid()", LOG_DEBUG); + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -597,7 +597,7 @@ class BOM extends CommonObject $dirdest = $conf->bom->dir_output.'/'.$newref; if (! $error && file_exists($dirsource)) { - dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest); + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); if (@rename($dirsource, $dirdest)) { diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index abe80b5a832..7082bc5e882 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -234,7 +234,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiont // Action validate object if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit) { - $result = $object->valid($user); + $result = $object->validate($user); if ($result >= 0) { // Define output language diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index be6bd9f095d..eed79c037fd 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -118,11 +118,11 @@ class mod_bom_advanced extends ModeleNumRefboms /** * Return next free value * - * @param Societe $objsoc Object thirdparty + * @param Product $objprod Object product * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - public function getNextValue($objsoc, $object) + public function getNextValue($objprod, $object) { global $db,$conf; @@ -139,7 +139,7 @@ class mod_bom_advanced extends ModeleNumRefboms $date = ($object->date_bom ? $object->date_bom : $object->date); - $numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', $objsoc, $date); + $numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date); return $numFinal; } diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index af7e173bbae..5eacb3289df 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -108,16 +108,16 @@ class mod_bom_standard extends ModeleNumRefboms /** * Return next free value * - * @param Societe $objsoc Object thirdparty + * @param Product $objprod Object product * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - public function getNextValue($objsoc, $object) + public function getNextValue($objprod, $object) { global $db,$conf; // D'abord on recupere la valeur max - $posindice=8; + $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."bom_bom"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; @@ -137,9 +137,9 @@ class mod_bom_standard extends ModeleNumRefboms } //$date=time(); - $date=$object->date; + $date=$object->date_creation; $yymm = strftime("%y%m", $date); - +; if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s", $max+1); diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 601fe792cd6..9fbbe6a7161 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -28,6 +28,6 @@ DateEndPlannedMo=Date end planned KeepEmptyForAsap=Empty means 'As Soon As Possible' EstimatedDuration=Estimated duration EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM -ConfirmValidateBom=Are you sure you want to validate this BOM (you will be able to use it to build new Manufacturing Orders) +ConfirmValidateBom=Are you sure you want to validate the BOM with the reference %s (you will be able to use it to build new Manufacturing Orders) ConfirmCloseBom=Are you sure you want to cancel this BOM (you won't be able to use it to build new Manufacturing Orders anymore) ? ConfirmReopenBom=Are you sure you want to re-open this BOM (you will be able to use it to build new Manufacturing Orders) \ No newline at end of file diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 01d800f23c8..c443641ffd6 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -129,7 +129,7 @@ if (empty($reshook)) $permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0); $backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1); if (empty($backtopage)) { - if (empty($id)) $backtopage = $backurlforlist; + if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist; else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); } $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record From b0de030f3e732aa8fb9b0244b4fd03688cd52981 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 02:05:47 +0200 Subject: [PATCH 185/409] phpcs --- htdocs/core/modules/bom/mod_bom_standard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index 5eacb3289df..eefbc7570c0 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -139,7 +139,7 @@ class mod_bom_standard extends ModeleNumRefboms //$date=time(); $date=$object->date_creation; $yymm = strftime("%y%m", $date); -; + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s", $max+1); From fc90916de944287e9327915ca7de3336c51be4b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 03:17:53 +0200 Subject: [PATCH 186/409] Look and feel v11 --- htdocs/bom/bom_list.php | 48 +- htdocs/mrp/mo_list.php | 21 +- htdocs/product/inventory/list.php | 92 ++- htdocs/product/stock/class/entrepot.class.php | 24 + htdocs/product/stock/list.php | 592 ++++++++++++------ 5 files changed, 479 insertions(+), 298 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 635f0f9db65..46473d52ddb 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -21,6 +21,7 @@ * \ingroup bom * \brief List page for bom */ + // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -99,7 +100,7 @@ $arrayfields=array(); foreach($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); } // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) @@ -179,8 +180,9 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) +if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +} // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -213,6 +215,7 @@ foreach($object->fields as $key => $val) // Add fields from extrafields if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +} // Add where from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook @@ -258,7 +261,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".dol_buildpath('/bom/bom_card.php', 1).'?id='.$id); + header("Location: ".DOL_URL_ROOT.'/bom/bom_card.php?id='.$id); exit; } @@ -290,7 +293,8 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); foreach($search as $key => $val) { - $param.= '&search_'.$key.'='.urlencode($search[$key]); + if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey); + else $param.= '&search_'.$key.'='.urlencode($search[$key]); } if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -315,19 +319,7 @@ print ''; print ''; print ''; -$newcardbutton=''; -//if ($user->rights->bom->creer) -//{ - $newcardbutton=''.$langs->trans('New').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -//} -//else -//{ -// $newcardbutton=''.$langs->trans('New').''; -// $newcardbutton.= ''; -// $newcardbutton.= ''; -//} +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cubes', 0, $newcardbutton, '', $limit); @@ -338,10 +330,10 @@ $objecttmp=new BOM($db); $trackid='xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; -if ($sall) +if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
'; } $moreforfilter = ''; @@ -424,7 +416,7 @@ $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sort $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print '
'."\n"; @@ -460,12 +452,14 @@ while ($i < min($num, $limit)) foreach($object->fields as $key => $val) { $cssforfield=(empty($val['css'])?'':$val['css']); - if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; - + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; @@ -488,7 +482,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; } @@ -442,7 +429,7 @@ foreach($object->fields as $key => $val) if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index b81e989cbb9..59c81c83e29 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -21,6 +21,7 @@ * \brief List page for inventory */ +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -30,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; // Load translation files required by the page $langs->loadLangs(array("stocks","other")); -$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation @@ -47,7 +48,7 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -67,7 +68,7 @@ if (! $sortorder) $sortorder="ASC"; // Security check $socid=0; -if ($user->societe_id > 0) +if ($user->societe_id > 0) // Protection if external user { //$socid = $user->societe_id; accessforbidden(); @@ -101,10 +102,10 @@ $arrayfields=array(); foreach($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); } // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -119,8 +120,6 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); /* * Actions - * - * Put here all code to do according to value of "$action" parameter */ if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } @@ -164,8 +163,6 @@ if (empty($reshook)) /* * View - * - * Put here all code to render page */ $form=new Form($db); @@ -192,10 +189,10 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) { $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -$sql=preg_replace('/, $/', '', $sql); +$sql=preg_replace('/,\s*$/', '', $sql); $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)"; -if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('myobject').")"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; else $sql.=" WHERE 1 = 1"; foreach($search as $key => $val) { @@ -218,11 +215,14 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +} // Add where from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/','', $sql); */ $sql.=$db->order($sortfield, $sortorder); @@ -231,18 +231,17 @@ $sql.=$db->order($sortfield, $sortorder); $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 + $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 { $page = 0; $offset = 0; } } -// if total resultset is smaller the limit, no need to do paging. +// 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) { - $resql = $result; $num = $nbtotalofrecords; } else @@ -274,21 +273,6 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; @@ -296,7 +280,8 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); foreach($search as $key => $val) { - $param.= '&search_'.$key.'='.urlencode($search[$key]); + if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey); + else $param.= '&search_'.$key.'='.urlencode($search[$key]); } if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -308,7 +293,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -321,7 +306,9 @@ print ''; print ''; print ''; -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, '', '', $limit); +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write); + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); // Add code for pre mass action (confirmation or email presend form) $topicmail="Information"; @@ -330,7 +317,7 @@ $objecttmp=new Inventory($db); $trackid='inve'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; -if ($sall) +if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; @@ -415,13 +402,15 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine=0; -if (! empty($extrafields->attributes[$object->table_element]['computed'])) { +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object @@ -448,16 +437,21 @@ while ($i < min($num, $limit)) print ''; foreach($object->fields as $key => $val) { - $align=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; - if ($key == 'status') $align.=($align?' ':'').'center'; + $cssforfield=(empty($val['css'])?'':$val['css']); + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) { - print ''; - print $object->showOutputField($val, $key, $obj->$key, ''); + print ''; + if ($key == 'status') print $object->getLibStatut(5); + elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + else print $object->showOutputField($val, $key, $obj->$key, ''); print ''; if (! $i) $totalarray['nbfield']++; if (! empty($val['isameasure'])) @@ -474,7 +468,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; if (! $i) $totalarray['nbfield']++; - print ''; + print ''."\n"; $i++; } diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 824934992bf..004ad49ce46 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -95,6 +95,30 @@ class Entrepot extends CommonObject // List of short language codes for status public $statuts = array(); + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10), + 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-2, 'showoncombobox'=>1, 'position'=>25), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35), + 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>-2, 'position'=>40), + 'fk_parent' =>array('type'=>'integer', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), + 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45), + 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50), + 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55), + 'fk_departement' =>array('type'=>'integer', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-2, 'position'=>65), + //'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82), + //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>-2, 'position'=>84), + //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-2, 'position'=>85), + 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-2, 'position'=>200), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), + ); + + /** * Constructor * diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index ae39ba63f3b..b38888be9bb 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -28,34 +28,50 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; // Load translation files required by the page -$langs->load("stocks"); +$langs->loadLangs(array("stocks","other")); -// Security check -$result=restrictedArea($user, 'stock'); +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'stocklist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); +$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_ref=GETPOST("sref", "alpha")?GETPOST("sref", "alpha"):GETPOST("search_ref", "alpha"); $search_label=GETPOST("snom", "alpha")?GETPOST("snom", "alpha"):GETPOST("search_label", "alpha"); $search_status=GETPOST("search_status", "int"); +// Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; -$sortfield = GETPOST("sortfield"); -$sortorder = GETPOST("sortorder"); +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="ASC"; -$page = GETPOST("page"); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $limit * $page; + +// Security check +$result=restrictedArea($user, 'stock'); + $year = strftime("%Y", time()); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Entrepot($db); -$hookmanager->initHooks(array('stocklist')); $extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->inventory->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('stocklist')); -// fetch optionals attributes and labels +// Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); + $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); @@ -69,30 +85,69 @@ $fieldstosearchall = array( 'e.town'=>'Town', ); - -// Extra fields -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +// Definition of fields for list +$arrayfields=array( + 'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'position'=>70), + 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71), + 'sellvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72), +); +foreach($object->fields as $key => $val) { - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + // If $val['visible']==0, then we never show the field + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); } +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } +} +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers +$parameters=array(); +$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)) { - $search_ref=""; - $sall=""; - $search_label=""; - $search_status=""; - $search_array_options=array(); + // 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_ref=""; + $sall=""; + $search_label=""; + $search_status=""; + $toselect=''; + $search_array_options=array(); + } + 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='Entrepot'; + $objectlabel='Warehouse'; + $permtoread = $user->rights->stock->lire; + $permtodelete = $user->rights->stock->supprimer; + $uploaddir = $conf->stock->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -103,6 +158,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $form=new Form($db); $warehouse=new Entrepot($db); +$now=dol_now(); + +$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; +$title = $langs->trans("ListOfWarehouses"); + + +// Build and execute select +// -------------------------------------------------------------------- $sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,"; $sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; // Add fields from extrafields @@ -115,16 +178,16 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) { $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -//$sql=preg_replace('/, $/', '', $sql); -$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; +$sql=preg_replace('/,\s*$/', '', $sql); +$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as e"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)"; $sql.= " WHERE e.entity IN (".getEntity('stock').")"; if ($search_ref) $sql.= natural_search("e.ref", $search_ref); // ref if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$search_status; -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -149,189 +212,308 @@ if ($result) } } $sql.= $db->order($sortfield, $sortorder); -$sql.= $db->plimit($limit+1, $offset); -$result = $db->query($sql); -if ($result) +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $num = $db->num_rows($result); - - $i = 0; - - $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; - llxHeader("", $langs->trans("ListOfWarehouses"), $help_url); - - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($search_ref) $param.="&search_ref=".urlencode($search_ref); - if ($search_label) $param.="&search_label=".urlencode($search_label); - if ($search_status) $param.="&search_status=".urlencode($search_status); - if ($sall) $param.="&sall=".urlencode($sall); - - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - - $newcardbutton=''; - if ($user->rights->stock->creer) + $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 { - $newcardbutton=''.$langs->trans('MenuNewWarehouse').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $page = 0; + $offset = 0; } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'generic', 0, $newcardbutton, '', $limit); - - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; - } - - $moreforfilter=''; - - print '
'; - print '
'.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).''; $return.= '
'.$titre.'
'; @@ -4187,11 +4187,10 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', print "\n"; print "\n"; - print ''; // maring bottom must be same than into load_fiche_tire + print '
'; // maring bottom must be same than into load_fiche_tire // Left - //if ($picto && $titre) print ''; - print ''; // User assigned - print ''; // Progression diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 2a9fc198592..f6d03d3360a 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -197,7 +197,7 @@ class ActionsTicket print $langs->trans("InitialMessage"); print ''; @@ -208,7 +208,7 @@ class ActionsTicket $msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message; include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $uselocalbrowser = true; - $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET); + $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_4, '95%'); $doleditor->Create(); } else { // Deal with format differences (text / HTML) From 2ed96c9e5ffe5c6632bbc036d18d607f1e6e2040 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 02:54:19 +0200 Subject: [PATCH 168/409] Fix scrutinizer --- htdocs/contact/class/contact.class.php | 4 +-- .../box_accountancy_suspense_account.php | 4 +-- htdocs/core/lib/ticket.lib.php | 1 + ...rface_90_modSociete_ContactRoles.class.php | 25 +++++++++++-------- htdocs/ticket/class/ticket.class.php | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 560a6e2bc0d..1d88ebc87aa 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1514,8 +1514,8 @@ class Contact extends CommonObject /** * Get Contact roles for a thirdparty * - * @param string $element element type - * @return array|int + * @param string $element Element type + * @return array|int Array of contact roles or -1 * @throws Exception */ public function getContactRoles($element = '') diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php index 03c0f0ab7ae..86971e1e042 100644 --- a/htdocs/core/boxes/box_accountancy_suspense_account.php +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -74,7 +74,7 @@ class box_accountancy_suspense_account extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; - $bookkeepingstatic = new BookKeeping($this->db); + //$bookkeepingstatic = new BookKeeping($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount")); @@ -103,7 +103,7 @@ class box_accountancy_suspense_account extends ModeleBoxes $this->info_box_contents[0][1] = array( 'td' => 'class="right"', - 'text' => '' . $nbSuspenseAccount . '', + 'text' => '' . $nbSuspenseAccount . '', 'asis' => 1 ); } else { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 53afbe50dce..543bdb025fa 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -151,6 +151,7 @@ function showDirectPublicLink($object) require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $email = CMailFile::getValidAddress($object->origin_email, 2); + $url = ''; if ($email) { $url = dol_buildpath('/public/ticket/view.php', 3).'?track_id='.$object->track_id.'&email='.$email; diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index 13eb44d4eee..79b99e59a8f 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -90,20 +90,23 @@ class InterfaceContactRoles extends DolibarrTriggers if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); } - foreach($TContact as $i => $infos) { - foreach ($TContactAlreadyLinked as $contactData) { - if($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]); + if (is_array($TContact)) + { + foreach($TContact as $i => $infos) { + foreach ($TContactAlreadyLinked as $contactData) { + if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]); + } } - } - $nb = 0; - foreach($TContact as $infos) { - $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); - if($res > 0) $nb++; - } + $nb = 0; + foreach($TContact as $infos) { + $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); + if ($res > 0) $nb++; + } - if($nb > 0) { - setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs'); + if($nb > 0) { + setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs'); + } } } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5443e943583..0daba74be77 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1609,7 +1609,7 @@ class Ticket extends CommonObject * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message - * @return void + * @return int <0 if KO, >0 if OK */ public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) { From 568faef7f4c2f77087fd9005b9a0b37dd0bffc85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 04:08:34 +0200 Subject: [PATCH 169/409] Fix encoding of message --- htdocs/takepos/takepos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index bd14e227876..311bcd00d8b 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -396,7 +396,7 @@ function Refresh() { function New() { // If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined console.log("New with place = , js place="+place); - var r = confirm(' 0 ? $langs->trans("ConfirmDeletionOfThisPOSSale") : $langs->trans("ConfirmDiscardOfThisPOSSale")); ?>'); + var r = confirm(' 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>'); if (r == true) { $("#poslines").load("invoice.php?action=delete&place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); From 33cc0c017cf43eb87bb784c5da9a1d480e589e90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 04:20:51 +0200 Subject: [PATCH 170/409] responsive --- htdocs/hrm/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index ef8df639d26..80a9366186c 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -225,7 +225,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) print ''; print ''; - print ''; + print ''; print ''; $starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning'; @@ -304,7 +304,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -376,7 +376,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; From 00bac9e98911fea926babb7806a35e5accd264d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Oct 2019 08:02:59 +0200 Subject: [PATCH 171/409] Update interface_50_modAgenda_ActionsAuto.class.php Update agenda.lang Update agenda.lang Update interface_50_modAgenda_ActionsAuto.class.php --- htdocs/langs/en_US/agenda.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 8ad19e06695..465846a43db 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -76,6 +76,7 @@ ContractSentByEMail=Contract %s sent by email OrderSentByEMail=Sales order %s sent by email InvoiceSentByEMail=Customer invoice %s sent by email SupplierOrderSentByEMail=Purchase order %s sent by email +ORDER_SUPPLIER_DELETEInDolibarr=Purchase order %s deleted SupplierInvoiceSentByEMail=Vendor invoice %s sent by email ShippingSentByEMail=Shipment %s sent by email ShippingValidated= Shipment %s validated From 0d69ae9e8c0a6a8f6b025b546c65c0c70fccce84 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 15 Oct 2019 09:52:14 +0200 Subject: [PATCH 172/409] NEW mode for list thirdparty API (add supplier) add new mode for more universel use of the api and easy switch between customer's and supplier's modes --- htdocs/societe/class/api_thirdparties.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index ed3b26e04ac..b5ae7d94c03 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -117,6 +117,7 @@ class Thirdparties extends DolibarrApi * @param int $mode Set to 1 to show only customers * Set to 2 to show only prospects * Set to 3 to show only those are not customer neither prospect + * Set to 4 to show only suppliers * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')" * @return array Array of thirdparty objects */ @@ -143,6 +144,7 @@ class Thirdparties extends DolibarrApi if ($mode == 1) $sql.= " AND t.client IN (1, 3)"; if ($mode == 2) $sql.= " AND t.client IN (2, 3)"; if ($mode == 3) $sql.= " AND t.client IN (0)"; + if ($mode == 4) $sql.= " AND t.fournisseur IN (1)"; $sql.= ' AND t.entity IN ('.getEntity('societe').')'; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; //if ($email != NULL) $sql.= " AND s.email = \"".$email."\""; From 63a60c7811465eb5e46d53c1a16d6ef5483cac64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 11:13:14 +0200 Subject: [PATCH 173/409] NEW Add option MAIN_PDF_FORCE_FONT_SIZE --- htdocs/core/lib/pdf.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d16fc569961..b233b937be7 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -240,14 +240,18 @@ function pdf_getPDFFont($outputlangs) */ function pdf_getPDFFontSize($outputlangs) { + global $conf; + $size=10; // By default, for FPDI or ISO language on TCPDF - if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 one like DejaVuSans if required (slower) + if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 font like DejaVuSans if required (slower) { - if ($outputlangs->trans('FONTSIZEFORPDF')!='FONTSIZEFORPDF') + if ($outputlangs->trans('FONTSIZEFORPDF') != 'FONTSIZEFORPDF') { $size = (int) $outputlangs->trans('FONTSIZEFORPDF'); } } + if (! empty($conf->global->MAIN_PDF_FORCE_FONT_SIZE)) $size = $conf->global->MAIN_PDF_FORCE_FONT_SIZE; + return $size; } From a45ad29e71e6b6cfd83d544bb3c0a4f2186fa5b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 11:32:53 +0200 Subject: [PATCH 174/409] Doc --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3583c10385b..d4e1356b493 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 10.0.3 compared to 10.0.2 ***** +IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. +The unit were not saved correctly in database making calculation on shipments wrong. +Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to this version. +Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored. + FIX: #11702 FIX: #11861 No consistent code to manage measuring units FIX: #11942 From 9ce71c26aa7b7f673a1319cf45a5ebf82b17205b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 11:41:22 +0200 Subject: [PATCH 175/409] Use alpha logo by default --- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 5 +++-- htdocs/theme/dolibarr_logo_squarred_alpha.png | Bin 0 -> 8921 bytes 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 htdocs/theme/dolibarr_logo_squarred_alpha.png diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 39e2150280e..5f27a68d63a 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -137,7 +137,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout } else { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png'; } $title=$langs->trans("GoIntoSetupToChangeLogo"); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5d6bf501d82..cf95da29568 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -482,7 +482,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); $logoContainerAdditionalClass = 'backgroundforcompanylogo'; - if(!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)){ + if(! empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)){ $logoContainerAdditionalClass = ''; } @@ -496,7 +496,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = }*/ else { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png'; + $logoContainerAdditionalClass = ''; } $title=$langs->trans("GoIntoSetupToChangeLogo"); diff --git a/htdocs/theme/dolibarr_logo_squarred_alpha.png b/htdocs/theme/dolibarr_logo_squarred_alpha.png new file mode 100644 index 0000000000000000000000000000000000000000..06e69ad8b7b66c0fb6b464644290dd3bcc66064e GIT binary patch literal 8921 zcmZ`<1z40%w||MH6;x7?PH9oP6cGU_kuDV!lm_Wq1^!ASDUGy%AV{|~C?KtLH!RH( zyL)Hx|Hb{jdmo;ChJD}JGiOfz&Y20)R9Ct{a+L&vpbN_P?>>YeT<|Y0L_`3FefOag zFc3UdRk{mduz%_GxzXSWvBP}>X9$uW#eQ&J#MVfFhlH<`)f5TmNyv%WaNgxr;z1BI zqR{gMm+yvkUv<3$XOHw@qmOc;2S(a_p>1=ffowLK#}#hGe~mi_dFv6X###> z|2cFT=;Go-R{-DiS0KQ?5Do<05W*1xbHPJ-@Qw1H1G9!cF$MJC4;k+JakvEkHYZ)k zosI(f0A2#QYDN~~6G5C11P7Ak{xdA_Ai$S@5d}Y>fgp<#2urlIgX6zA)Beu|{$3sa z-~p73!GjY+Q2L+cu)}fJ!zSqQpXKClmtJQ62QPomiOj7dBl<7qvAbsbv+IBD^Y2|V zD|rA0|G6U-R+mfAKM4GvvIGy|Y&q-~cyX3$czcs66i)O=-dG_v!i!R;rjcLcDtcE? zi@~Wf^)Jd?Unv?XxxI2dx~uA?SLWubsHA6KR^~=RflLDmOFJ!Um}wP%GDKk%-13lF zveql3`m@OI(Sb{+Mp94xtSvX}SKpbT5M~%l1#P378}=core<>7b-0klJw*fMM=`Oj zaNot%&W|YamFZQrL91WWu4<@;5s8CSLvuZI)ggp+*yQQ>Q%iHzjj7SAQuIa{r+#Xj zz&bk36_qcy5FFN8|7!AeoI@a`0Jj@9HtH3K7vY;;iF2cvYLAYom6f$i?A(z2M;-x{ zrwc#Pjmg)C&U7X6tgX~d$EpQIZR|rYjMJN=4*&X9Q_JINVhBicPdEvA>SJE*e?dEL zb!D0z?*X~|Dl@k)^))iL$@8kFEgT=4d9J7l!SCpr8Zv0Nld0u~(w)%zHTY;~mwIda z6i$|M#o3Ng3EJ7ZFY*uqHIWPz3vd|AntR{93#8ZH9q-CjAc_c&6&&s;4Xe#4&s5a} z>JKc;&)|Em&X~}fEPaEO)zfRx-O)&))XKz!&rpv>RctG`$WDyz4K74kmXX2E89|q* z&M0!TsMg{o&`d{g&p|OIZamoxoD_Zy)@erdj6>M`p_-)mz;_L%4eQl+mb&(8OT`mc zNp)?*4twobUK2x_D+Ic+9g8BIS@C@zD6W~vl(?Ii-0)kBbAQK_P*-s3~k95mNwU#-y48EBEtK+mdk#0}VPI=3$N;uWz zYmd|gV4bDug=OLbk_X8B4DE=B_N7A)a=tP5-x^EBVV@691O0KKNSJ>CuYk|`M)W{s zuPjfT{aEb80dmdV$>Z}U;MnrIXKR;lx1cMG5JpwA?M!`U^io$7VG7^4FXJ>JL@neO zYq4TGX^Cj$L2ab z5ohNb0ZAA`ka%G@y{r&wU&^xMug$QoN=E&w5dy#YD4mKS?p(;nyt(t+YVNdz6m@Zd zYQyeeV2Pczzh)<$z$2Xf5)sbftV&FySQciRYq_H-pX4>LG>fGUQRTUEOZEGRGo;Sy zEt*tHMa3XZtmvQ0H}1MmCq2)>pgxWo=}^ERW^2v}#zbEf$}a{zS^hPnrt|?bgQG6) z57LTDlnZqFQLXfrYASt6l1pru-ImmJ1(XCnq$#tU4@3YHx5aOwSagXlqXLOm|b_GhKc>d)HD3^xxhF>9o_%;oLNO=D{E z=pOQ8cf&_#227w`&HjN#ibJ6gR;m_{bv(R}W#V)7ek60B&*9M;WrE!wC=xN_3Y zzLI8U{pynjKh81sJgM3TqQ1JA-PQ~uPG^*}I%A6Os!Va%nu_4%IkDI*J6wp{D)#~H zd+;=#3xVqP=^vQlpuk%FTvka(R%PAkZXTZ?)j2Z{=*3u3%@^YDC3xXtH?a7li*2y4 zZttlEA=Z9+jt9e4?-1AnwocGS}HUQ405 z!1&07g$#yO9M%b={X9P|zM%rsmy)B~vk+A_HOwTD+3>yBw)hN+Vhz6cYCupcwc2!j zLOFup^puDi7Z)i*7@Wb5-syX8CX-h)fhY-t0~I{MJDof@8Z}{l*PIAJO-!!e_Dfbd zawBL0a6uTHc(qwgPjFOBiTxHwmS04R`Bu<(>HM9sYkL3)ejUVjaDe~Go>lCL>T?M7 zk-`aCq=|?ez7Xi>h5Ah=_3fM{cQApSUF^bIL~fcU+dJic676?W1Js#mTpLj(4;R0^hsAno3}Bz1c~<-Um#+zUHNk*$T8CtrG-ry=U?| z9%si?xuoZ-7bW;ONj5zH!VHi{X;xJpx2(ef-?;#Le(+=tBxv9J!=;@&ii`y-*Pi_y zwg))a*()YFkjKZ?8xX{xKG+^{-!fHP(!=#Y_sN12&X;Zm=&cXQc8$o~?_neS_btY_ zP`XAAWSJsvNFgDEg?8!W6WcX(I~&*Iae$R}#;ndOWodU@_#-}J5wCm-r$<3VGfh~S zfsn3Z?~28w&SkLYU;oa^no(EA-mMbC#+p%+!517H#m&nTetVcoIIo8FFS5J`1=qW6 z?uJ*Xs;5Qz9xL^+dmUDiDB!@)h9*W5yqCXm9G|46#l%szrLT3zlitR3>vew<_Rq&+ z2oS~nLK#G7K7JdfiXR(e5Xk0G+{xL~2p#t=(WfPW9B#gHIl70Mip!fG-#tZ-Jwshr zG2eK1Te#@CLufG_!+iKPhAT?sL5VD=$s0dds@Kk3ollg&n?VH1Zi^(W#Q#_!`hi{+B|No6_B*`-koVaXa;!1 zd+^r;BdM-k5RBK%bRwHuIckTEu;axQ>$!bpHuI&R%t3VQmdFgob#vp>M`*zqM`+j| z&(iNWcIsx>!T4e8iLKYu-g({(pyLElU-x9^T}MZB*}VB&9!v8a6;^?{3}QD8v}=uk z2g|dpu5N~Lth=>F9Z1cs%lQbjhttLwJDmhn?T79NI}T|+gCjG)a=yilRDd;^68BMU^_gr9qXq}J6mGgsp$KmoT^`8fXD3+yU5}A zji&?aDDJ=8H!tjbES_XSG%Q+ng^V9^RMiU%Zm6^2-K}1)m-o9H*a7s^lv|4UtC&T2~|xP=1)p$Pjm1b9^Iy0%N|AW{ioX z_oj*1w>;fK?W79!g&8eLr?|g=@Wi7ULWVQ-L=Z!fh z?Cmli7`Xg4JyROw1)l=z^?40BH#a_gg93a?cz$rH__I4t# zch0%tRLxrakbr*`434*a>OLe_FZ05CG1YQzsdkC$6N;@kMa;Gkv9EOoiYkVMowSK< z|F`jN4NHd$(W7QD)HHO@mon!guEm5i$_o81wN4WX@5YCiH6~9tYLIX3rIYs$^PeAg z&%=S%SUenNPmsCxa%)cVsfofKF%*C$g}o5Vk@g-pnZ@=d=~rv5i5E->K7nXbD#c{L zDChY!TR}OM?vaVGFL1Co;v^~)Blv_Z=&0}LgI=zAq&Xpn<%6rw6c$G*nMDy+lmWz0 z)5q1V)v$=ElgAq`Z5Ua@&K$b~%mYD6tCPH-X1lX9zI@B`26H1Pwi+xR+Y_{lkXqt* zl#@@T74d#7Y4cbP8~BQ+M*U7~YznO(;qJD+iU*+%-tw`aRt$aY6%lxVv+GZTcg=&t z?qx4t#e3UtEFMoxOwKk|hr42zQ?0%)R$aMAUha2o6_?pweA~Pc#ewlYRwA8?65+h7 zqnIG%R1Jk*J<+`Cn7|&+5D&rMR8&^WY`I%~^1^YNm_f(JUtBfgA%a0O+tu?QIr@JN zxfZZHd6Niv=23*(;A}r!I74FXWN&A1Y>IB$%c?7^p|RSwIgh2GSZUiFlwQrr9lCd& zjdGctezj_GLQ3wqkS5Y_OlrPE!_z=hz?m4phm|XCGBwhk{A7_|IYSwusHs-1fQp_} zfC`7t`0MZ`PNmrRxVt?+(Qg1axY$^|r$@^2c9={HxD{M>yOWeYv%FrFLgMAZ7o0od zclcmrSgjmMN_ow7Eha^O@00#E@?)47&JXzc$)yc%qYsEIfHlcrp}Sc^V}__?ttb9_ z|9jUVr3cC{N22y@J{pfvSKMQ<+FS|EreBK^$qlWz?fj!e;dHzYq=u7TXX^?Q7Q!%E zV_SYu!=)pnYhQ*?IB9|u&mfYgLILPbV`C~Plt@_#4M?$D6p^W~FUhHxDwH6+P?%2v z>Z+e^y0%js_%QHR6Y7M4D2ug>{gg153wMNYI{8#_TE2a0q>PDo-3YrGc7K96()+)&cUMtSQWiok=I&v!b7v$NaM z;;~HTCK^fwM4GDvUrPiz7RKy#1^UDB4Sh%@n7=m*u>5%>T!3X^fihj6$mhqyCI_Jn zL0E2WtsYUeyTkSC!M$Zl6h4N~S;lLE$R{R~lXp7Xh~<^F?!HBR7OcjHEWB`kn&U=B zTjp|H)BvJmTHADqO9%-LVMqn~ZIB+^?=(BxF<*Db>9+)f^Sh8B`jr>5@rV5k7up~g~U zB8m1ZkkVhV&}{lIGZHnOXP+pXetaLrY+C!6K^A1;7&_4`KRK3#54~Hd5x+)HQdI%= z1zP71U>F=4+kx=_@AP?Dg&P?HlP4kpZJo$lr$&@mi-;H|+Z4nHqJo%JgF}L!4t>F~ z6Z>9{`!fgY>ONLO!gzcz8{9|(Qv!U#Z|H~m;q=1yi6ji64QuQ^mIC@)0wVnnlOTo! zVz~3w<&bj6qfA3#8ZRgg|3J}SMR};cTH~`|Z{uK1rgLMElZZu+ z3$lYAfv=kag**TY#!|ds0G~6MDiG|47-)A$*8k9Q0Wf|uW%A8G9ecDW+2v^rr4*t|C&}&R zSO@UPi+d3!T9-#ny@NrR$*Cd00>ihX*_O!^nc;LRXE)-xAeXQ^*x*s@X6#!-;ZzT8 zV3RVu#cE`z#Id{eswGCEmjkG4=8NZ%&N2~8$L7?ilNxG@8XJM%cEEB&LsqXOqn2x8 zlU#e>H^0}JOCS}eJ&gB$X!wwU$#Wg{rW5bG*vRijEH@Ey9zCl7fxXLA@qGXVVB@`K z3!z>|ZISf%Z*m%iV}%gI3y#C^2}}Cl)C_eR#(pmz>BJDTlG_wa$KSkJPCR#?25PiQ z$DvFVGZW_*5Pw$pIhIS;X6(hZBnbenB;B1)@a8b}n|IzuOP6*Z_yN9$xdr)y{7#d^ z?z&|6`^kFDw%MLi!$I^~DF zAcpum1IyeQCO0krm{ItM)+6szIort4*5%gzBv9Zkf5TLeo26U?LGNCwVU?%q!1($G zaAk4%Tn)x+W*!)(T-0eSDO-e0rDq5>3*+r2CPdFUBWhUr1rPRO5vhg^z`(ykv<*$K zzcwse?4-JFA#Jfn|qJ$A+EIQC2S2{JOW-jf?c=DvZ?^vw4n zsgn3G1rT&5nE94Gv~Oa2?1QjJ*;h2~e&^mgy|$4k4GH`+MA(ZSh*wb!o*z?H4?1c% zJ}WZ|{EEJFu$@7(sR}$Pss;x}J$Z3;=j$;q?7cQjp5EUdNph3YnqGcefFna+Ps@` z5@JBXM8mPq9NS}rg`K-Ui0`!u3qRY~F01MsKSoXhNIL)8a+HMihy<=qKqyAo84h?9 zf3pAOgJ=V1j+(e=PIz(94%=JF8D~vj^nQNUr*abtPzDI34oA?*a)WRw&KY|3DkyD2 z0Kf?;VI#b2TSV=Mr84uek%Jn^v|;GMsL|Ktl(VQ_St5 zwEJcXCr4iKWhG=Cl z&`l1vpRE1qHiZv*1;?{>99>22&u=fB;ma$E;5HFK7w3Ot#1KBcM>0$#a5emk7>BBf zgU$hq+^?9rnadz*ZEj%b<@|I39DxjObo>UEAYTC>Nt>V4sU9eBbzM)HNJMlVODS1@JCu# zDyQw+m(=rz(p?$c3dcnyG`u zZhUmLG~d<3IO&zSyduVONqY6La>}!184)aVY7~f-5^VFD$rJBbIW=CM z^Y-@DTm~m|qEA4ovbb%Z*xq4ZFXrL2dhgGJ#CzT+N#vYz9#5-<+!dAAezS{jGY#mK zH2xYCHzdSp`0Tx2I3?$&CIAu7KmzHvG)^vw%*1xxdfa3aCw7`xZ(|9!VTJBAJ^_0( z<92RKsyNZ>X8kwkLgd`pj}g^{|7Bq?|} z8%Y8;igr%3eMCFn?7FaRP~q#fyCv8gbW-2b+ysh5(k-JelE*84XudJYnt*Q~X`p5H znX@$MV|4bVN|eoQr#*7UpdlI(knWmCNBXJ6d|d2yXPm7AUSp33r05f)8qssf`Xwdm zv<&UIk3;c6W@x@tVbv42;8Qs<|6C5>f*bv}2Hzp38ikI}+?EyHG>YZHZb?kcwb$#C z8g3kcV;ma_Y&(=%x-wt%c%~7N+m`{%_ zwrR`#s`jYdcrR#tD@DY9*6@kLJ}G=WYNn|g7OBvmlp}o9Mb%~5xc7L&)@cM(`|{t6 z%5p@HbH@=8x5{e+ZiiDrxg3E$V?mc7B}LTK5*_BGUWppB5cJG+G6YQjxW2j?hLEWe zuU_o!04H?{%m7IR+D$dPboBszkJwN0lkI+lKB#?r?R)_~eRwwZxr?R|o7IYm-b?oYZ&uq1}Ba4z@}A*DuO}+}&KUl%3LL>rB%sm}*KV zGxh5&C@_Cf7f(h_oJ8l&_b-onWRU|AMjqt6kVc=KEUe4}i$}w=5k;d1r615pmnb`X^fShd+Y&ErCWxH|(YE((bv3LZ`QM%5` z)@iwJ*&JP}hRb3OfWG<2$d<~MuZ8j%a_3p^VV4t*gCXucD9|3n0E?;Sa>u@TRrAGm z$=B(iWy<{sYcr>52G@@G^{GNeM?3?_DWP=D`m#(GkB#F4N6gm(^PM$A-UDD@lo_d0 zH{%M&6QxVtO@5eF2JZTts!aKLFJ`=m_$&Rm>HSMzXriGzzRpP>o;fmad?5B%sp;c1VHR}>Zf z`qQ?*YJe#V=-TCnRD=u6g7fNy+Fo!jX$Q%WNJM zq|v!h$0Sq3o@zWM_rA5iytukYQogZcDyJf>_G%I*fVMOniug+4N`WEvE2Oaw<6C@b29Ku#Rt z#DK$GN3y*9cclYSdEA0(1-#!gt5#NCHI9TAS-pIr0SeZPPvtUTc-q$xmuGJioD!y1 zQZVa>t}ZB%kgTb(wE$qMB^#W*t#$7L3Soc{t)|W;<-6cKvA@x*jn@w``n|ary=8xG zXk03@ww8;P6&yF4R*y_2<@65?FrFHYnMwSj?@@T-Ob#tn0qq>3c4x>Oswjj0{b~Sk zGEiik-xqMwQPxkr@{faZZg~y?a4ZgTABc;fT>bZ7H6Abw%5F~Hwg@H{@hs_^%kU|`np`1}4r!iV!K1;DXDmGfu%)Uoe6Gao6CSUxI(*mn7<6jQ-64cIc!51u%Al@|>Jd z9M}-ZW6Z$K{=eG?*hQTJ-EcsVB!#=cA;70R9t8j4NDlJLPYmI;Uj7!p8oRq-myoie L`rV>CkKg Date: Tue, 15 Oct 2019 14:29:27 +0200 Subject: [PATCH 176/409] Fix non-numeric value encountered on ical export --- htdocs/comm/action/class/actioncomm.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5803c0afc20..1ce4dce01a0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1543,6 +1543,19 @@ class ActionComm extends CommonObject $event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type']=$type; $datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); + + // fix for -> Warning: A non-numeric value encountered + if(is_numeric($this->db->jdate($obj->datep2))) + { + $dateend = $this->db->jdate($obj->datep2) + - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + } + else + { + // use start date as fall-back to avoid import erros on empty end date + $datestart = $dateend; + } + $dateend=$this->db->jdate($obj->datep2)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); $duration=($datestart && $dateend)?($dateend - $datestart):0; $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":""); From 6a8e8907efc528598cec19f395a8f97e53399d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Oct 2019 17:55:07 +0200 Subject: [PATCH 177/409] Update list.php --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 893a3935cba..511166991bf 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -267,7 +267,7 @@ $sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.to $sql.= ' p.datec as date_creation, p.tms as date_update,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql.= ' u.login'; -if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,"; +if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); From e94d47daf74ccb62122e236cb6599d1f980f1816 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 19:57:23 +0200 Subject: [PATCH 178/409] Work on MRP module --- htdocs/bom/bom_card.php | 91 ++++++++++++++++++- htdocs/bom/class/bom.class.php | 2 +- htdocs/commande/card.php | 2 +- .../install/mysql/migration/10.0.0-11.0.0.sql | 2 + .../install/mysql/tables/llx_bom_bomline.sql | 2 +- htdocs/mrp/index.php | 3 +- 6 files changed, 97 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 5e24724b6f7..5f3ec89da61 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -42,6 +42,11 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard $backtopage = GETPOST('backtopage', 'alpha'); $lineid = GETPOST('lineid', 'int'); +// PDF +$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); +$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + // Initialize technical objects $object=new BOM($db); $extrafields = new ExtraFields($db); @@ -173,6 +178,34 @@ if (empty($reshook)) $action = ''; } } + + if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit) + { + $result = $object->valid($user); + if ($result >= 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } } @@ -286,6 +319,52 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); } + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); + } + + // Confirmation of validation + if ($action == 'validate') + { + // We check that object has a temporary ref + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV') { + $object->fetch_product(); + $numref = $object->getNextNumRef($object->product); + } else { + $numref = $object->ref; + } + + $text = $langs->trans('ConfirmValidateBom', $numref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object); + } + + $formquestion=array(); + if (! empty($conf->bom->enabled)) + { + $langs->load("mrp"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + ); + } + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + } + // Clone confirmation if ($action == 'clone') { // Create an array for form @@ -467,10 +546,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + if ($user->rights->bom->write && $object->status == BOM::STATUS_DRAFT) + { + print ''; + } + + if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED) + { + print ''; + } + // Clone if ($user->rights->bom->write) { - print ''; + print ''; } /* diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 73e26de8aea..c8855c9cc03 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1052,7 +1052,7 @@ class BOMLine extends CommonObject 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), - 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), + 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); public $rowid; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 968607ed660..0d13537037c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1924,7 +1924,7 @@ if ($action == 'create' && $usercancreate) // Confirmation of validation if ($action == 'validate') { - // on verifie si l'objet est en numerotation provisoire + // We check that object has a temporary ref $ref = substr($object->ref, 1, 4); if ($ref == 'PROV') { $numref = $object->getNextNumRef($soc); diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 42097685f6f..1a8379d857a 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -50,6 +50,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2'); -- For v11 ALTER TABLE llx_bom_bom ADD COLUMN duration double(8,4) DEFAULT NULL; +ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0; +ALTER TABLE llx_bom_bomline DROP COLUMN rank; create table llx_categorie_warehouse ( diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index cb7079cf16a..330f1bb18d6 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -23,6 +23,6 @@ CREATE TABLE llx_bom_bomline( import_key varchar(14), qty double(24,8) NOT NULL, efficiency double(8,4) NOT NULL DEFAULT 1, - position integer NOT NULL + position integer NOT NULL DEFAULT 0 -- END MODULEBUILDER FIELDS ) ENGINE=innodb; diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index f5f723a8fac..b6c20cde620 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -175,7 +175,7 @@ print '
'; */ $max=5; -$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem"; +$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status"; $sql.= " FROM ".MAIN_DB_PREFIX."bom_bom as a"; $sql.= " WHERE a.entity IN (".getEntity('bom').")"; $sql.= $db->order("a.tms", "DESC"); @@ -200,6 +200,7 @@ if ($resql) $staticbom->id=$obj->rowid; $staticbom->ref=$obj->ref; $staticbom->date_modification=$obj->datem; + $staticbom->status=$obj->status; print '
'; print ''; From d2eeb9e749711b5363af954ec7889fd501588ddc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2019 19:59:16 +0200 Subject: [PATCH 179/409] Wor kon BOM --- htdocs/mrp/ChangeLog.md | 5 + htdocs/mrp/README.md | 3 + htdocs/mrp/admin/setup.php | 151 ++++ htdocs/mrp/class/mo.class.php | 746 ++++++++++++++++++ htdocs/mrp/core/modules/modMrp.class.php | 349 ++++++++ htdocs/mrp/lib/mrp.lib.php | 54 ++ htdocs/mrp/lib/mrp_mo.lib.php | 83 ++ htdocs/mrp/mo_agenda.php | 262 ++++++ htdocs/mrp/mo_card.php | 550 +++++++++++++ htdocs/mrp/mo_document.php | 167 ++++ htdocs/mrp/mo_list.php | 602 ++++++++++++++ htdocs/mrp/mo_note.php | 165 ++++ htdocs/mrp/modulebuilder.txt | 3 + htdocs/mrp/sql/llx_mrp_mo.key.sql | 35 + htdocs/mrp/sql/llx_mrp_mo.sql | 39 + htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql | 19 + htdocs/mrp/sql/llx_mrp_mo_extrafields.sql | 23 + 17 files changed, 3256 insertions(+) create mode 100644 htdocs/mrp/ChangeLog.md create mode 100644 htdocs/mrp/README.md create mode 100644 htdocs/mrp/admin/setup.php create mode 100644 htdocs/mrp/class/mo.class.php create mode 100644 htdocs/mrp/core/modules/modMrp.class.php create mode 100644 htdocs/mrp/lib/mrp.lib.php create mode 100644 htdocs/mrp/lib/mrp_mo.lib.php create mode 100644 htdocs/mrp/mo_agenda.php create mode 100644 htdocs/mrp/mo_card.php create mode 100644 htdocs/mrp/mo_document.php create mode 100644 htdocs/mrp/mo_list.php create mode 100644 htdocs/mrp/mo_note.php create mode 100644 htdocs/mrp/modulebuilder.txt create mode 100644 htdocs/mrp/sql/llx_mrp_mo.key.sql create mode 100644 htdocs/mrp/sql/llx_mrp_mo.sql create mode 100644 htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql create mode 100644 htdocs/mrp/sql/llx_mrp_mo_extrafields.sql diff --git a/htdocs/mrp/ChangeLog.md b/htdocs/mrp/ChangeLog.md new file mode 100644 index 00000000000..416bad1d559 --- /dev/null +++ b/htdocs/mrp/ChangeLog.md @@ -0,0 +1,5 @@ +# CHANGELOG MRP FOR DOLIBARR ERP CRM + +## 1.0 +Initial version + diff --git a/htdocs/mrp/README.md b/htdocs/mrp/README.md new file mode 100644 index 00000000000..b23e31fb577 --- /dev/null +++ b/htdocs/mrp/README.md @@ -0,0 +1,3 @@ +# MRP Module + +Module to manage Manufacturing Orders (MO) \ No newline at end of file diff --git a/htdocs/mrp/admin/setup.php b/htdocs/mrp/admin/setup.php new file mode 100644 index 00000000000..8d7df29b383 --- /dev/null +++ b/htdocs/mrp/admin/setup.php @@ -0,0 +1,151 @@ + + * Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson + * + * 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 mrp/admin/setup.php + * \ingroup mrp + * \brief Mrp setup page. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +global $langs, $user; + +// Libraries +require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; +require_once '../lib/mrp.lib.php'; +//require_once "../class/myclass.class.php"; + +// Translations +$langs->loadLangs(array("admin", "mrp")); + +// Access control +if (! $user->admin) accessforbidden(); + +// Parameters +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +$arrayofparameters=array( + 'MRP_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1), + 'MRP_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1) +); + + + +/* + * Actions + */ + +if ((float) DOL_VERSION >= 6) +{ + include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +} + + + +/* + * View + */ + +$page_name = "MrpSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mrp'); + +// Configuration header +$head = mrpAdminPrepareHead(); +dol_fiche_head($head, 'settings', '', -1, "mrp"); + +// Setup page goes here +echo ''.$langs->trans("MrpSetupPage").'

'; + + +if ($action == 'edit') +{ + print '
'; + print ''; + print ''; + + print '
'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).''; + print ''; if ($picto && $titre) print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath); print '
'.$titre; if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') print ' ('.$totalnboflines.')'; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index cd4d70c2518..d6b6a8676ae 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -399,8 +399,7 @@ class Export $szFilterField=''; break; case 'Status': - if (! empty($conf->global->MAIN_ACTIVATE_HTML5)) $szFilterField=''; - else $szFilterField=''; + $szFilterField=''; break; case 'Boolean': $szFilterField='
' . $langs->trans("AssignedTo") . ''; + print '
'; + print ''; + } + print '
'; + print $langs->trans("AssignedTo"); + if ($object->fk_statut < 8 && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { + print '' . img_edit($langs->trans('Modify'), '') . '
'; + print '
'; if ($object->fk_user_assign > 0) { $userstat->fetch($object->fk_user_assign); print $userstat->getNomUrl(1); @@ -892,9 +899,6 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print ' '; print ''; } - if ($object->fk_statut < 8 && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { - print '' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . ''; - } print '
'; if ($user->rights->ticket->manage) { - print '' . img_edit($langs->trans('Modify')) . ''; + print '' . img_edit($langs->trans('Modify')) . ''; } print '
'.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(-1, 'leave').''.$userstatic->getNomUrl(-1, 'leave').''.$typeleaves[$obj->fk_type]['label'].'
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.$userstatic->getNomUrl(-1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm), 'day').''.$deplacementstatic->LibStatut($obj->fk_statut, 3).'
'.$expensereportstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.$userstatic->getNomUrl(-1).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->dm), 'day').''.$expensereportstatic->LibStatut($obj->status, 3).'
'.$staticbom->getNomUrl(1, 32).'
'; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); + print $form->textwithpicto($langs->trans($key), $tooltiphelp); + print '
'; + + print '
'; + print ''; + print '
'; + + print ''; + print '
'; +} +else +{ + if (! empty($arrayofparameters)) + { + print ''; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); + print $form->textwithpicto($langs->trans($key), $tooltiphelp); + print '' . $conf->global->$key . '
'; + + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; + } + else + { + print '
'.$langs->trans("NothingToSetup"); + } +} + + +// Page end +dol_fiche_end(); + +llxFooter(); +$db->close(); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php new file mode 100644 index 00000000000..a459a582bba --- /dev/null +++ b/htdocs/mrp/class/mo.class.php @@ -0,0 +1,746 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 class/mo.class.php + * \ingroup mrp + * \brief This file is a CRUD class file for Mo (Create/Read/Update/Delete) + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class for Mo + */ +class Mo extends CommonObject +{ + /** + * @var string ID to identify managed object + */ + public $element = 'mo'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'mrp_mo'; + + /** + * @var int Does mo support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var int Does mo support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 1; + + /** + * @var string String with name of icon for mo. Must be the part after the 'object_' into object_mo.png + */ + public $picto = 'mrp'; + + + const STATUS_DRAFT = 0; + const STATUS_VALIDATED = 1; // To produce + const STATUS_INPROGRESS = 2; + const STATUS_DONE = 3; + const STATUS_CANCELED = -1; + + + + /** + * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>-1, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',), + 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'index'=>1, 'comment'=>"Qty to produce",), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), + 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",), + 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'), + 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), + 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'Done', '-1'=>'Canceled')), + ); + public $rowid; + public $ref; + public $entity; + public $label; + public $qty; + public $fk_soc; + public $note_public; + public $note_private; + public $date_creation; + public $tms; + public $fk_user_creat; + public $fk_user_modif; + public $import_key; + public $status; + public $fk_product; + public $date_start_planned; + public $date_end_planned; + public $fk_bom; + public $fk_project; + // END MODULEBUILDER PROPERTIES + + + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'mrp_moline'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + //public $fk_element = 'fk_mo'; + + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'Moline'; + + /** + * @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('mrp_modet'); + + /** + * @var MoLine[] Array of subtable lines + */ + //public $lines = array(); + + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0; + + // Unset fields that are disabled + foreach($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + foreach($this->fields as $key => $val) + { + if (is_array($val['arrayofkeyval'])) + { + foreach($val['arrayofkeyval'] as $key2 => $val2) + { + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone an object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $langs, $extrafields; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $result = $object->fetchCommon($fromid); + if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines(); + + // get lines so they will be clone + //foreach($this->lines as $line) + // $line->fetch_optionals(); + + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->table_element); + foreach($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + if (! $error) + { + // copy internal contacts + if ($this->copy_linked_contact($object, 'internal') < 0) + { + $error++; + } + } + + if (! $error) + { + // copy external contacts if same company + if (property_exists($this, 'socid') && $this->socid == $object->socid) + { + if ($this->copy_linked_contact($object, 'external') < 0) + $error++; + } + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetchLines() + { + $this->lines=array(); + + $result = $this->fetchLinesCommon(); + return $result; + } + + + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records=array(); + + $sql = 'SELECT '; + $sql .= $this->getFieldList(); + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; + else $sql .= ' WHERE 1 = 1'; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key=='t.rowid') { + $sqlwhere[] = $key . '='. $value; + } + elseif (strpos($key, 'date') !== false) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } + elseif ($key=='customsql') { + $sqlwhere[] = $value; + } + else { + $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < min($limit, $num)) + { + $obj = $this->db->fetch_object($resql); + + $record = new self($this->db); + $record->setVarsFromFetchObj($obj); + + $records[$record->id] = $record; + + $i++; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** + * Delete a line of object in database + * + * @param User $user User that delete + * @param int $idline Id of line to delete + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int >0 if OK, <0 if KO + */ + public function deleteLine(User $user, $idline, $notrigger = false) + { + if ($this->status < 0) + { + $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; + return -2; + } + + return $this->deleteLineCommon($user, $idline, $notrigger); + } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $conf, $langs, $hookmanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + + $label = '' . $langs->trans("Mo") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowMo"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action,$hookmanager; + $hookmanager->initHooks(array('modao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } + + /** + * Return label of the 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 getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return the status + * + * @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) + { + // phpcs:enable + if (empty($this->labelstatus)) + { + global $langs; + //$langs->load("mrp"); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); + } + + if ($mode == 0) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 1) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 2) + { + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + } + elseif ($mode == 3) + { + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); + } + elseif ($mode == 4) + { + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + } + elseif ($mode == 5) + { + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); + } + elseif ($mode == 6) + { + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); + } + } + + /** + * Load the info information in the object + * + * @param int $id Id of object + * @return void + */ + public function info($id) + { + $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; + $sql.= ' fk_user_creat, fk_user_modif'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql.= ' WHERE t.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + } + + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } + + /** + * Create an array of lines + * + * @return array|int array of lines if OK, <0 if KO + */ + public function getLinesArray() + { + $this->lines=array(); + + $objectline = new MoLine($this->db); + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_mo = '.$this->id)); + + if (is_numeric($result)) + { + $this->error = $this->error; + $this->errors = $this->errors; + return $result; + } + else + { + $this->lines = $result; + return $this->lines; + } + } + + /** + * 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 + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) + { + global $conf,$langs; + + $langs->load("mrp"); + + if (! dol_strlen($modele)) { + + $modele = 'standard'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->MO_ADDON_PDF)) { + $modele = $conf->global->MO_ADDON_PDF; + } + } + + $modelpath = "core/modules/mrp/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } + + /** + * Action executed by scheduler + * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + //public function doScheduledJob($param1, $param2, ...) + public function doScheduledJob() + { + global $conf, $langs; + + //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; + + $error = 0; + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $now = dol_now(); + + $this->db->begin(); + + // ... + + $this->db->commit(); + + return $error; + } +} + +/** + * Class MoLine. You can also remove this and generate a CRUD class for lines objects. + */ +class MoLine +{ + // To complete with content of an object MoLine + // We should have a field rowid, fk_mo and position +} diff --git a/htdocs/mrp/core/modules/modMrp.class.php b/htdocs/mrp/core/modules/modMrp.class.php new file mode 100644 index 00000000000..7e57f70c6c8 --- /dev/null +++ b/htdocs/mrp/core/modules/modMrp.class.php @@ -0,0 +1,349 @@ + + * Copyright (C) 2018-2019 Nicolas ZABOURI + * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson + * + * 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 . + */ + +/** + * \defgroup mrp Module Mrp + * \brief Mrp module descriptor. + * + * \file htdocs/mrp/core/modules/modMrp.class.php + * \ingroup mrp + * \brief Description and activation file for module Mrp + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + +/** + * Description and activation class for module Mrp + */ +class modMrp extends DolibarrModules +{ + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $langs,$conf; + $this->db = $db; + + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 660; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'mrp'; + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = "products"; + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = '62'; + // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); + // Module label (no space allowed), used if translation string 'ModuleMrpName' not found (Mrp is name of module). + $this->name = preg_replace('/^mod/i', '', get_class($this)); + // Module description, used if translation string 'ModuleMrpDesc' not found (Mrp is name of module). + $this->description = "MRPDescription"; + // Used only if file README.md and README-LL.md not found. + $this->descriptionlong = "Module to Manage Manufacturing Orders (MO)"; + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' + $this->version = 'dolibarr'; + // Url to the file with your last numberversion of this module + //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; + + // Key used in llx_const table to save module status enabled/disabled (where MRP 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. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto='mrp'; + // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) + $this->module_parts = array( + // Set this to 1 if module has its own trigger directory (core/triggers) + 'triggers' => 0, + // Set this to 1 if module has its own login method file (core/login) + 'login' => 0, + // Set this to 1 if module has its own substitution function file (core/substitutions) + 'substitutions' => 0, + // Set this to 1 if module has its own menus handler directory (core/menus) + 'menus' => 0, + // Set this to 1 if module overwrite template dir (core/tpl) + 'tpl' => 0, + // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'barcode' => 0, + // Set this to 1 if module has its own models directory (core/modules/xxx) + 'models' => 0, + // Set this to 1 if module has its own theme directory (theme) + 'theme' => 0, + // Set this to relative path of css file if module has its own css file + 'css' => array( + // '/mrp/css/mrp.css.php', + ), + // Set this to relative path of js file if module must load a js on all pages + 'js' => array( + // '/mrp/js/mrp.js.php', + ), + // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all' + 'hooks' => array( + // 'data' => array( + // 'hookcontext1', + // 'hookcontext2', + // ), + // 'entity' => '0', + ), + // Set this to 1 if features of module are opened to external users + 'moduleforexternal' => 0, + ); + // Data directories to create when module is enabled. + // Example: this->dirs = array("/mrp/temp","/mrp/subdir"); + $this->dirs = array("/mrp/temp"); + // Config pages. Put here list of php page, stored into mrp/admin directory, to use to setup module. + $this->config_page_url = array("setup.php@mrp"); + // Dependencies + // A condition to hide module + $this->hidden = false; + // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->depends = array('modBom'); + $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + $this->langfiles = array("mrp"); + $this->phpmin = array(5,5); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(8,0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + //$this->automatic_activation = array('FR'=>'MrpWasAutomaticallyActivatedBecauseOfYourCountryChoice'); + //$this->always_enabled = true; // If true, can't be disabled + + // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(1 => array('MRP_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), + // 2 => array('MRP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) + // ); + $this->const = array( + // 1 => array('MRP_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + ); + + // Some keys to add into the overwriting translation tables + /*$this->overwrite_translation = array( + 'en_US:ParentCompany'=>'Parent company or reseller', + 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' + )*/ + + if (! isset($conf->mrp) || ! isset($conf->mrp->enabled)) { + $conf->mrp=new stdClass(); + $conf->mrp->enabled=0; + } + + // Array to add new pages in new tabs + $this->tabs = array(); + // Example: + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mrp:$user->rights->mrp->read:/mrp/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mrp:$user->rights->othermodule->read:/mrp/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) + // 'contact' to add a tab in contact view + // 'contract' to add a tab in contract view + // 'group' to add a tab in group view + // 'intervention' to add a tab in intervention view + // 'invoice' to add a tab in customer invoice view + // 'invoice_supplier' to add a tab in supplier invoice view + // 'member' to add a tab in fundation member view + // 'opensurveypoll' to add a tab in opensurvey poll view + // 'order' to add a tab in customer order view + // 'order_supplier' to add a tab in supplier order view + // 'payment' to add a tab in payment view + // 'payment_supplier' to add a tab in supplier payment view + // 'product' to add a tab in product view + // 'propal' to add a tab in propal view + // 'project' to add a tab in project view + // 'stock' to add a tab in stock view + // 'thirdparty' to add a tab in third party view + // 'user' to add a tab in user view + + // Dictionaries + $this->dictionaries=array(); + /* Example: + $this->dictionaries=array( + 'langs'=>'mylangfile@mrp', + // List of tables we want to see into dictonnary editor + 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), + // Label of tables + 'tablib'=>array("Table1","Table2","Table3"), + // Request to select fields + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), + // Sort order + 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), + // List of fields (result of select to show dictionary) + 'tabfield'=>array("code,label","code,label","code,label"), + // List of fields (list of fields to edit a record) + 'tabfieldvalue'=>array("code,label","code,label","code,label"), + // List of fields (list of fields for insert) + 'tabfieldinsert'=>array("code,label","code,label","code,label"), + // Name of columns with primary key (try to always name it 'rowid') + 'tabrowid'=>array("rowid","rowid","rowid"), + // Condition to show each dictionary + 'tabcond'=>array($conf->mrp->enabled,$conf->mrp->enabled,$conf->mrp->enabled) + ); + */ + + // Boxes/Widgets + // Add here list of php file(s) stored in mrp/core/boxes that contains a class to show a widget. + $this->boxes = array( + // 0 => array( + // 'file' => 'mrpwidget1.php@mrp', + // 'note' => 'Widget provided by Mrp', + // 'enabledbydefaulton' => 'Home', + // ), + // ... + ); + + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week + $this->cronjobs = array( + // 0 => array( + // 'label' => 'MyJob label', + // 'jobtype' => 'method', + // 'class' => '/mrp/class/mo.class.php', + // 'objectname' => 'Mo', + // 'method' => 'doScheduledJob', + // 'parameters' => '', + // 'comment' => 'Comment', + // 'frequency' => 2, + // 'unitfrequency' => 3600, + // 'status' => 0, + // 'test' => '$conf->mrp->enabled', + // 'priority' => 50, + // ), + ); + // Example: $this->cronjobs=array( + // 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50) + // ); + + // Permissions provided by this module + $this->rights = array(); + $r=0; + // Add here entries to declare new permissions + /* BEGIN MODULEBUILDER PERMISSIONS */ + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read objects of Mrp'; // Permission label + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update objects of Mrp'; // Permission label + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete objects of Mrp'; // Permission label + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $r++; + /* END MODULEBUILDER PERMISSIONS */ + + // Main menu entries to add + $this->menu = array(); + $r=0; + // Add here entries to declare new menus + /* BEGIN MODULEBUILDER TOPMENU */ + /* END MODULEBUILDER LEFTMENU MO */ + + // Exports profiles provided by this module + $r=1; + /* BEGIN MODULEBUILDER EXPORT MO */ + /* + $langs->load("mrp"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='mo@mrp'; + $keyforclass = 'Mo'; $keyforclassfile='/mymobule/class/mo.class.php'; $keyforelement='mo'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='mo'; $keyforaliasextra='extra'; $keyforelement='mo'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'mo as t'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')'; + $r++; */ + /* END MODULEBUILDER EXPORT MO */ + + // Imports profiles provided by this module + $r=1; + /* BEGIN MODULEBUILDER IMPORT MO */ + /* + $langs->load("mrp"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='mo@mrp'; + $keyforclass = 'Mo'; $keyforclassfile='/mymobule/class/mo.class.php'; $keyforelement='mo'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='mo'; $keyforaliasextra='extra'; $keyforelement='mo'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'mo as t'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')'; + $r++; */ + /* END MODULEBUILDER IMPORT MO */ + } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result=$this->_load_tables('/mrp/sql/'); + if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + + // Create extrafields during init + //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + //$extrafields = new ExtraFields($this->db); + //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled'); + //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled'); + //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled'); + //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mrp', '$conf->mrp->enabled'); + //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled'); + + $sql = array(); + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + return $this->_remove($sql, $options); + } +} diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php new file mode 100644 index 00000000000..7ee1fcd04c7 --- /dev/null +++ b/htdocs/mrp/lib/mrp.lib.php @@ -0,0 +1,54 @@ + + * + * 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 mrp/lib/mrp.lib.php + * \ingroup mrp + * \brief Library files with common functions for Mrp + */ + +/** + * Prepare admin pages header + * + * @return array + */ +function mrpAdminPrepareHead() +{ + global $langs, $conf; + + $langs->load("mrp"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/mrp/admin/setup.php", 1); + $head[$h][1] = $langs->trans("Settings"); + $head[$h][2] = 'settings'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@mrp:/mrp/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@mrp:/mrp/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, null, $head, $h, 'mrp'); + + return $head; +} diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php new file mode 100644 index 00000000000..6189761269e --- /dev/null +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -0,0 +1,83 @@ +. + */ + +/** + * \file lib/mrp_mo.lib.php + * \ingroup mrp + * \brief Library files with common functions for Mo + */ + +/** + * Prepare array of tabs for Mo + * + * @param Mo $object Mo + * @return array Array of tabs + */ +function moPrepareHead($object) +{ + global $db, $langs, $conf; + + $langs->load("mrp"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/mrp/mo_card.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) + { + $nbNote = 0; + if (!empty($object->note_private)) $nbNote++; + if (!empty($object->note_public)) $nbNote++; + $head[$h][0] = dol_buildpath('/mrp/mo_note.php', 1).'?id='.$object->id; + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + $head[$h][2] = 'note'; + $h++; + } + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = $conf->mrp->dir_output . "/mo/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); + $nbLinks=Link::count($db, $object->element, $object->id); + $head[$h][0] = dol_buildpath("/mrp/mo_document.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans('Documents'); + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + $head[$h][2] = 'document'; + $h++; + + $head[$h][0] = dol_buildpath("/mrp/mo_agenda.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + $head[$h][2] = 'agenda'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@mrp:/mrp/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@mrp:/mrp/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'mo@mrp'); + + return $head; +} diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php new file mode 100644 index 00000000000..aab1ff10581 --- /dev/null +++ b/htdocs/mrp/mo_agenda.php @@ -0,0 +1,262 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 mo_agenda.php + * \ingroup mrp + * \brief Page of Mo events + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +dol_include_once('/mrp/class/mo.class.php'); +dol_include_once('/mrp/lib/mrp_mo.lib.php'); + + +// Load translation files required by the page +$langs->loadLangs(array("mrp","other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +if (GETPOST('actioncode', 'array')) +{ + $actioncode=GETPOST('actioncode', 'array', 3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); +} +$search_agenda_label=GETPOST('search_agenda_label'); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'mrp', $id); + +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='a.datep,a.id'; +if (! $sortorder) $sortorder='DESC'; + +// Initialize technical objects +$object=new Mo($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('moagenda','globalcard')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity] . "/" . $object->id; + + + +/* + * Actions + */ + +$parameters=array('id'=>$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)) +{ + // Cancel + if (GETPOST('cancel', 'alpha') && ! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + + // 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 + { + $actioncode=''; + $search_agenda_label=''; + } +} + + + +/* + * View + */ + +$contactstatic = new Contact($db); + +$form = new Form($db); + +if ($object->id > 0) +{ + $title=$langs->trans("Agenda"); + //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + $help_url = ''; + llxHeader('', $title, $help_url); + + if (! empty($conf->notification->enabled)) $langs->load("mails"); + $head = moPrepareHead($object); + + + dol_fiche_head($head, 'agenda', $langs->trans("Mo"), -1, $object->picto); + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->mrp->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + + $object->info($object->id); + dol_print_object_info($object, 1); + + print '
'; + + dol_fiche_end(); + + + + // Actions buttons + + $objthirdparty=$object; + $objcon=new stdClass(); + + $out='&origin='.$object->element.'&originid='.$object->id; + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; + } + + + print '
'; + + if (! empty($conf->agenda->enabled)) + { + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } + + print '
'; + + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + $param='&id='.$object->id.'&socid='.$socid; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + + + //print load_fiche_titre($langs->trans("ActionsOnMo"), '', ''); + + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + + // TODO Replace this with same code than into list.php + //show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + } +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php new file mode 100644 index 00000000000..f15b45b96e5 --- /dev/null +++ b/htdocs/mrp/mo_card.php @@ -0,0 +1,550 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 mo_card.php + * \ingroup mrp + * \brief Page to create/edit/view mo + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. +//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies + + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/mrp/class/mo.class.php'); +dol_include_once('/mrp/lib/mrp_mo.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("mrp", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'mocard'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); +//$lineid = GETPOST('lineid', 'int'); + +// Initialize technical objects +$object=new Mo($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('mocard','globalcard')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all", 'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); +} + +if (empty($action) && empty($id) && empty($ref)) $action='view'; + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0); +//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); + +$permissionnote=$user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php +$permissionedit=$user->rights->mrp->write; // Used by the include of actions_lineupdown.inc.php +$permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php + + + +/* + * Actions + * + * Put here all code to do according to value of "action" parameter + */ + +$parameters=array(); +$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)) +{ + $error=0; + + $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0); + $backurlforlist = dol_buildpath('/mrp/mo_list.php', 1); + if (empty($backtopage)) { + if (empty($id)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/mrp/mo_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } + $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record + + // Actions cancel, add, update, delete or clone + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + + // Actions to send emails + $trigger_name='MO_SENTBYMAIL'; + $autocopy='MAIN_MAIL_AUTOCOPY_MO_TO'; + $trackid='mo'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; +} + + + + +/* + * View + * + * Put here all code to build page + */ + +$form=new Form($db); +$formfile=new FormFile($db); + +llxHeader('', $langs->trans('Mo'), ''); + +// Example : Adding jquery code +print ''; + + +// Part to create +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Mo")), '', 'cubes'); + + print '
'; + print ''; + print ''; + print ''; + + dol_fiche_head(array(), ''); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + + print '
'."\n"; + + dol_fiche_end(); + + print ' + + '; + + print '
'; + print ''; + print '  '; + print ''; // Cancel for create does not post form if we don't know the backtopage + print '
'; + + print '
'; +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') +{ + print load_fiche_titre($langs->trans("Mo"), '', 'cubes'); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head(); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + dol_fiche_end(); + + print '
'; + print '   '; + print '
'; + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = moPrepareHead($object); + dol_fiche_head($head, 'card', $langs->trans("Mo"), -1, $object->picto); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', '', 0, 1); + } + // Confirmation to delete line + if ($action == 'deleteline') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx + if ($action == 'xxx') + { + $formquestion=array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('lineid' => $lineid); + $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; + + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref bis + $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->mrp->write) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(); + } else { + $morehtmlref.=''; + } + } + } + */ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); + + + /* + * Lines + */ + + if (! empty($object->table_element_line)) + { + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + '; + + if (! empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + { + print ''; + } + + if (! empty($object->lines)) + { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') + { + if ($action != 'editline') + { + // Add products/services form + $object->formAddObjectLine(1, $mysoc, $soc); + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } + } + + if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + { + print '
'; + } + print '
'; + + print "
\n"; + } + + + // Buttons for actions + + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + if (empty($reshook)) + { + // Send + print '' . $langs->trans('SendMail') . ''."\n"; + + // Modify + if (! empty($user->rights->mrp->write)) + { + print ''.$langs->trans("Modify").''."\n"; + } + else + { + print ''.$langs->trans('Modify').''."\n"; + } + + // Clone + if (! empty($user->rights->mrp->write)) + { + print ''; + } + + /* + if ($user->rights->mrp->write) + { + if ($object->status == 1) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + */ + + // Delete (need delete permission, or if draft, just need create/modify permission) + if (! empty($user->rights->mrp->delete) || (! empty($object->fields['status']) && $object->status == $object::STATUS_DRAFT && ! empty($user->rights->mrp->write))) + { + print ''.$langs->trans('Delete').''."\n"; + } + else + { + print ''.$langs->trans('Delete').''."\n"; + } + } + print '
'."\n"; + } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + print ''; // ancre + + // Documents + /*$objref = dol_sanitizeFileName($object->ref); + $relativepath = $comref . '/' . $comref . '.pdf'; + $filedir = $conf->mrp->dir_output . '/' . $objref; + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('mrp', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + */ + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('mo')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'mo', $socid, 1, '', $MAXEVENT, '', $morehtmlright); + + print '
'; + } + + //Select mail models is same action as presend + /* + if (GETPOST('modelselected')) $action = 'presend'; + + // Presend form + $modelmail='inventory'; + $defaulttopic='InformationMessage'; + $diroutput = $conf->product->dir_output.'/inventory'; + $trackid = 'stockinv'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + */ +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php new file mode 100644 index 00000000000..09f34ae583e --- /dev/null +++ b/htdocs/mrp/mo_document.php @@ -0,0 +1,167 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 mo_document.php + * \ingroup mrp + * \brief Tab for documents linked to Mo + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/mrp/class/mo.class.php'); +dol_include_once('/mrp/lib/mrp_mo.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("mrp","companies","other","mails")); + + +$action=GETPOST('action', 'aZ09'); +$confirm=GETPOST('confirm'); +$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); +$ref = GETPOST('ref', 'alpha'); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'mrp', $id); + +// Get parameters +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="name"; +//if (! $sortfield) $sortfield="position_name"; + +// Initialize technical objects +$object=new Mo($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('modocument','globalcard')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->ref); + + +/* + * Actions + */ + +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$title=$langs->trans("Mo").' - '.$langs->trans("Files"); +$help_url=''; +//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +if ($object->id) +{ + /* + * Show tabs + */ + $head = moPrepareHead($object); + + dol_fiche_head($head, 'document', $langs->trans("Mo"), -1, $object->picto); + + + // Build file list + $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); + $totalsize=0; + foreach($filearray as $key => $file) + { + $totalsize+=$file['size']; + } + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + + print '
'; + print ''; + + // Number of files + print ''; + + // Total size + print ''; + + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + + print '
'; + + dol_fiche_end(); + + $modulepart = 'mrp'; + //$permission = $user->rights->mrp->create; + $permission = 1; + //$permtoedit = $user->rights->mrp->create; + $permtoedit = 1; + $param = '&id=' . $object->id; + + //$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->id).'/'; + $relativepathwithnofile='mo/' . dol_sanitizeFileName($object->ref).'/'; + + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; +} +else +{ + accessforbidden('', 0, 1); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php new file mode 100644 index 00000000000..891ad76eaf8 --- /dev/null +++ b/htdocs/mrp/mo_list.php @@ -0,0 +1,602 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 mo_list.php + * \ingroup mrp + * \brief List page for mo + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data +//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// load mrp libraries +require_once __DIR__ . '/class/mo.class.php'; + +// for other modules +//dol_include_once('/othermodule/class/otherobject.class.php'); + +// Load translation files required by the page +$langs->loadLangs(array("mrp","other")); + +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'molist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +$id = GETPOST('id', 'int'); + +// Load variable for pagination +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +//if (! $sortfield) $sortfield="p.date_fin"; +//if (! $sortorder) $sortorder="DESC"; + +// Initialize technical objects +$object = new Mo($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('molist')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Default sort order (if not yet defined by previous GETPOST) +if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. +if (! $sortorder) $sortorder="ASC"; + +// Security check +if (empty($conf->mrp->enabled)) accessforbidden('Module not enabled'); +$socid=0; +if ($user->societe_id > 0) // Protection if external user +{ + //$socid = $user->societe_id; + accessforbidden(); +} +//$result = restrictedArea($user, 'mrp', $id, ''); + + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all", 'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); +} + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); +foreach($object->fields as $key => $val) +{ + if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; +} + +// Definition of fields for list +$arrayfields=array(); +foreach($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); +} +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } +} +$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=''; } + +$parameters=array(); +$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 + { + foreach($object->fields as $key => $val) + { + $search[$key]=''; + } + $toselect=''; + $search_array_options=array(); + } + 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='Mo'; + $objectlabel='Mo'; + $permtoread = $user->rights->mrp->read; + $permtodelete = $user->rights->mrp->delete; + $uploaddir = $conf->mrp->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + + + +/* + * View + */ + +$form=new Form($db); + +$now=dol_now(); + +//$help_url="EN:Module_Mo|FR:Module_Mo_FR|ES:Módulo_Mo"; +$help_url=''; +$title = $langs->trans('ListOfManufacturingOrders'); + + +// Build and execute select +// -------------------------------------------------------------------- +$sql = 'SELECT '; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// 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, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/', '', $sql); +$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; +else $sql.=" WHERE 1 = 1"; +foreach($search as $key => $val) +{ + if ($key == 'status' && $search[$key] == -1) continue; + $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); +} +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +// 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, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + +/* If a group by is required +$sql.= " GROUP BY " +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/','', $sql); +*/ + +$sql.=$db->order($sortfield, $sortorder); + +// 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 + { + $page = 0; + $offset = 0; + } +} +// 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 +{ + $sql.= $db->plimit($limit+1, $offset); + + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); +} + +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/mrp/mo_card.php', 1).'?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +// Example : Adding jquery code +print ''; + +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +foreach($search as $key => $val) +{ + if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey); + else $param.= '&search_'.$key.'='.urlencode($search[$key]); +} +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + //'validate'=>$langs->trans("Validate"), + //'generate_doc'=>$langs->trans("ReGeneratePDF"), + //'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), +); +if ($user->rights->mrp->delete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mrp->write); + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cubes', 0, $newcardbutton, '', $limit); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail="SendMoRef"; +$modelmail="mo"; +$objecttmp=new Mo($db); +$trackid='xxxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($search_all) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; +/*$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
';*/ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // 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); // This also change content of $arrayfields +$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + + +// Fields title search +// -------------------------------------------------------------------- +print ''; +foreach($object->fields as $key => $val) +{ + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['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, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print ''; +print ''."\n"; + + +// Fields title label +// -------------------------------------------------------------------- +print ''; +foreach($object->fields as $key => $val) +{ + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; + } +} +// 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); +$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +print ''."\n"; + + +// Detect if we need a fetch on each output line +$needToFetchEachLine=0; +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } +} + + +// Loop on record +// -------------------------------------------------------------------- +$i=0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + // Store properties in $object + $object->id = $obj->rowid; + foreach($object->fields as $key => $val) + { + if (property_exists($obj, $key)) $object->$key = $obj->$key; + } + + // Show here line of result + print ''; + foreach($object->fields as $key => $val) + { + $cssforfield=(empty($val['css'])?'':$val['css']); + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right'; + + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + if ($key == 'status') print $object->getLibStatut(5); + elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + else print $object->showOutputField($val, $key, $obj->$key, ''); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; + $totalarray['val']['t.'.$key] += $obj->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; + + $i++; +} + +// Show total line +if (isset($totalarray['pos'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + else print ''; + } + } + print ''; +} + +// 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, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + else print ''; + 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 ''; + } + print '
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print '
'."\n"; + +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty=1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&', '&', $param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->mrp->read; + $delallowed=$user->rights->mrp->write; + + print $formfile->showdocuments('massfilesarea_mrp', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php new file mode 100644 index 00000000000..a006f79a609 --- /dev/null +++ b/htdocs/mrp/mo_note.php @@ -0,0 +1,165 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 mo_note.php + * \ingroup mrp + * \brief Car with notes on Mo + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +dol_include_once('/mrp/class/mo.class.php'); +dol_include_once('/mrp/lib/mrp_mo.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("mrp","companies")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object=new Mo($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('monote','globalcard')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'mrp', $id); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity] . "/" . $object->id; + +$permissionnote=1; +//$permissionnote=$user->rights->mrp->creer; // Used by the include of actions_setnotes.inc.php + + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + + +/* + * View + */ + +$form = new Form($db); + +//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$help_url=''; +llxHeader('', $langs->trans('Mo'), $help_url); + +if ($id > 0 || ! empty($ref)) +{ + $object->fetch_thirdparty(); + + $head = moPrepareHead($object); + + dol_fiche_head($head, 'note', $langs->trans("Mo"), -1, $object->picto); + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->mrp->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + dol_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/mrp/modulebuilder.txt b/htdocs/mrp/modulebuilder.txt new file mode 100644 index 00000000000..24ea0d6eac5 --- /dev/null +++ b/htdocs/mrp/modulebuilder.txt @@ -0,0 +1,3 @@ +# DO NOT DELETE THIS FILE MANUALLY +# File to flag module built using official module template. +# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module. \ No newline at end of file diff --git a/htdocs/mrp/sql/llx_mrp_mo.key.sql b/htdocs/mrp/sql/llx_mrp_mo.key.sql new file mode 100644 index 00000000000..071a663dd56 --- /dev/null +++ b/htdocs/mrp/sql/llx_mrp_mo.key.sql @@ -0,0 +1,35 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 http://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_rowid (rowid); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_ref (ref); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_entity (entity); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_qty (qty); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_soc (fk_soc); +ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES user(rowid); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_status (status); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_product (fk_product); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_start_planned (date_start_planned); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_end_planned (date_end_planned); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_bom (fk_bom); +ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_mrp_mo ADD UNIQUE INDEX uk_mrp_mo_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mrp_myotherobject(rowid); + diff --git a/htdocs/mrp/sql/llx_mrp_mo.sql b/htdocs/mrp/sql/llx_mrp_mo.sql new file mode 100644 index 00000000000..dbb8b0faa01 --- /dev/null +++ b/htdocs/mrp/sql/llx_mrp_mo.sql @@ -0,0 +1,39 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 http://www.gnu.org/licenses/. + + +CREATE TABLE llx_mrp_mo( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) DEFAULT '(PROV)' NOT NULL, + entity integer DEFAULT 1 NOT NULL, + label varchar(255), + qty real NOT NULL, + fk_soc integer, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status integer NOT NULL, + fk_product integer NOT NULL, + date_start_planned datetime, + date_end_planned datetime, + fk_bom integer, + fk_project integer + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql b/htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql new file mode 100644 index 00000000000..5b280acc41f --- /dev/null +++ b/htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql @@ -0,0 +1,19 @@ +-- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- +-- 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 http://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_mrp_myobject_extrafields ADD INDEX idx_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/mrp/sql/llx_mrp_mo_extrafields.sql b/htdocs/mrp/sql/llx_mrp_mo_extrafields.sql new file mode 100644 index 00000000000..9245ac1c341 --- /dev/null +++ b/htdocs/mrp/sql/llx_mrp_mo_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- +-- 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 http://www.gnu.org/licenses/. + +create table llx_mrp_myobject_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + From ccd9da99f45dc9a15c6e2223c7f5d7ca32921d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Oct 2019 20:11:15 +0200 Subject: [PATCH 180/409] Update list.php --- htdocs/comm/action/list.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index efb11a7e22b..65f593e26a0 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/comm/action/list.php + * \file htdocs/comm/action/list.php * \ingroup agenda * \brief Page to list actions */ @@ -239,7 +239,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $sql = "SELECT"; if ($usergroup > 0) $sql.=" DISTINCT"; $sql.= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,"; -$sql.= " a.id, a.label, a.note, a.datep as dp, a.datep2 as dp2,"; +$sql.= " a.id, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulldayevent, a.location,"; $sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_element, a.elementtype, a.datec, a.tms as datem,"; @@ -286,14 +286,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; else { - if (is_array($actioncode)) - { - $sql.=" AND c.code IN ('".implode("','", $actioncode)."')"; - } - else - { - $sql.=" AND c.code IN ('".implode("','", explode(',', $actioncode))."')"; - } + if (is_array($actioncode)) + { + $sql.=" AND c.code IN ('".implode("','", $actioncode)."')"; + } + else + { + $sql.=" AND c.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } } @@ -460,7 +460,7 @@ if ($resql) print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0); print '
'; print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0); print '
'; - print dol_print_date($db->jdate($obj->dp), "dayhour"); + print dol_print_date($db->jdate($obj->dp), $formatToUse); $late=0; if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; @@ -626,7 +627,7 @@ if ($resql) // End date if (! empty($arrayfields['a.datep2']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->dp2), "dayhour"); + print dol_print_date($db->jdate($obj->dp2), $formatToUse); print '
'; + 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; diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 891ad76eaf8..2f32058a41f 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -42,20 +42,7 @@ //if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -409,11 +396,11 @@ foreach($object->fields as $key => $val) if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; - if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); else print ''; print '
'; + 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; @@ -484,7 +478,7 @@ while ($i < min($num, $limit)) print '
'."\n"; - - // Fields title search - print ''; - - print ''; - - print ''; - - print ''; - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - - print ''; - - print ''; - - print ''; - - print ''; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("LocationSummary", $_SERVER["PHP_SELF"], "e.lieu", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); - print "\n"; - - if ($num) - { - $warehouse=new Entrepot($db); - $var=false; - $totalarray=array(); - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($result); - - $warehouse->id = $obj->rowid; - $warehouse->ref = $obj->ref; - $warehouse->label = $obj->ref; - $warehouse->lieu = $obj->lieu; - $warehouse->fk_parent = $obj->fk_parent; - $warehouse->statut = $obj->statut; - - print ''; - print ''; - if (! $i) $totalarray['nbfield']++; - // Location - print ''; - if (! $i) $totalarray['nbfield']++; - - // Stock qty - print ''; - if (! $i) $totalarray['nbfield']++; - - // PMP value - print ''; - if (! $i) $totalarray['nbfield']++; - - // Selling value - print ''; - if (! $i) $totalarray['nbfield']++; - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - - // Status - print ''; - if (! $i) $totalarray['nbfield']++; - - print ''; - if (! $i) $totalarray['nbfield']++; - - print "\n"; - - - $i++; - } - - if ($totalnboflines-$offset <= $limit) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - } - - $db->free($result); - - print "
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); - print ''; - $searchpicto=$form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
' . $warehouse->getNomUrl(1) . ''.$obj->lieu.''.price2num($obj->stockqty, 5).''; - if (price2num($obj->estimatedvalue, 'MT')) print price(price2num($obj->estimatedvalue, 'MT'), 1); - else print ''; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($obj->sellvalue, 'MT'), 1); - else - { - $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"), $htmltext); - } - print ''.$warehouse->LibStatut($obj->statut, 5).'
'.$langs->trans("Total").''.price2num($totalStock, 5).''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency); - else - { - $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"), $htmltext); - } - print '
"; - print "
"; - - print ''; +} +// 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 { - dol_print_error($db); + $sql.= $db->plimit($limit+1, $offset); + + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); +} + +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/product/stock/card.php?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +if ($search_ref) $param.="&search_ref=".urlencode($search_ref); +if ($search_label) $param.="&search_label=".urlencode($search_label); +if ($search_status) $param.="&search_status=".urlencode($search_status); +if ($search_all) $param.="&search_all=".urlencode($search_all); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), +); +//if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$newcardbutton = dolGetButtonTitle($langs->trans('MenuNewWarehouse'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->stock->creer); + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail="Information"; +$modelmail="warehouse"; +$objecttmp=new Entrepot($db); +$trackid='ware'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + + +if ($search_all) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; +/*$moreforfilter.='
'; + $moreforfilter.= $langs->trans('MyFilter') . ': '; + $moreforfilter.= '
';*/ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // 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); // This also change content of $arrayfields +$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + +// Fields title search +// -------------------------------------------------------------------- +print ''; + +print ''; + +print ''; + +print ''; +print ''; +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, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +// Status +print ''; + +// Action column +print ''; +print ''."\n"; + +// Fields title label +// -------------------------------------------------------------------- +print ''; +print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("LocationSummary", $_SERVER["PHP_SELF"], "e.lieu", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); +// 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); +$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, '', $sortfield, $sortorder, 'right '); +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +print ''."\n"; + +// Loop on record +// -------------------------------------------------------------------- +$i=0; +$totalarray=array(); +if ($num) +{ + $warehouse=new Entrepot($db); + + $totalarray=array(); + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + $warehouse->id = $obj->rowid; + $warehouse->ref = $obj->ref; + $warehouse->label = $obj->ref; + $warehouse->lieu = $obj->lieu; + $warehouse->fk_parent = $obj->fk_parent; + $warehouse->statut = $obj->statut; + + // Show here line of result + print ''; + print ''; + if (! $i) $totalarray['nbfield']++; + // Location + print ''; + if (! $i) $totalarray['nbfield']++; + + // Stock qty + print ''; + if (! $i) $totalarray['nbfield']++; + + // PMP value + print ''; + if (! $i) $totalarray['nbfield']++; + + // Selling value + print ''; + if (! $i) $totalarray['nbfield']++; + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Status + print ''; + if (! $i) $totalarray['nbfield']++; + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''."\n"; + + + $i++; + } + + if ($totalnboflines-$offset <= $limit) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } +} + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; +print ''; +print ''; +print ''; +print ''; +print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); +print ''; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; +print '
' . $warehouse->getNomUrl(1) . ''.$obj->lieu.''.price2num($obj->stockqty, 5).''; + if (price2num($obj->estimatedvalue, 'MT')) print price(price2num($obj->estimatedvalue, 'MT'), 1); + else print ''; + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($obj->sellvalue, 'MT'), 1); + else + { + $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + print ''.$warehouse->LibStatut($obj->statut, 5).''; + 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("Total").''.price2num($totalStock, 5).''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency); + else + { + $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + print '
'."\n"; +print '
'."\n"; + +print '
'."\n"; + +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty=1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&', '&', $param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->mymodule->read; + $delallowed=$user->rights->mymodule->create; + + print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page From e07e01580db7de0078259127ec3626ff881efa3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 03:34:32 +0200 Subject: [PATCH 187/409] Replace deprecated code with new one --- htdocs/comm/action/list.php | 4 +++- htdocs/compta/bank/bankentries_list.php | 4 +++- htdocs/compta/bank/card.php | 2 +- htdocs/compta/bank/list.php | 11 ++++++++--- htdocs/contact/list.php | 4 +++- htdocs/contrat/list.php | 4 +++- htdocs/contrat/services_list.php | 4 +++- .../modules/stock/doc/pdf_stdmovement.modules.php | 5 ++++- htdocs/expedition/list.php | 4 +++- htdocs/fichinter/list.php | 4 +++- htdocs/fourn/commande/list.php | 4 +++- htdocs/fourn/facture/list.php | 4 +++- htdocs/product/stock/movement_card.php | 4 +++- htdocs/product/stock/movement_list.php | 4 +++- htdocs/projet/list.php | 6 ++++-- htdocs/projet/tasks/list.php | 4 +++- htdocs/reception/list.php | 4 +++- htdocs/societe/list.php | 4 +++- htdocs/supplier_proposal/list.php | 4 +++- htdocs/user/list.php | 4 +++- 20 files changed, 65 insertions(+), 23 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index efb11a7e22b..38ce916aeee 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -247,7 +247,9 @@ $sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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(); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 1b0f7feffe4..7f43b24763a 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -473,7 +473,9 @@ $sql.= " ba.rowid as bankid, ba.ref as bankref,"; $sql.= " bu.url_id,"; $sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index fd5a2b42723..ac32ce98c30 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -627,7 +627,7 @@ else $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; - else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); + else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); print ''; print ''.$langs->trans("BalanceMinimalAllowed").''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 8f87d6f7151..6a143d4a8d1 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -73,7 +73,7 @@ $hookmanager->initHooks(array('bankaccountlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('bank_account'); +$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" @@ -144,7 +144,9 @@ $accounts = array(); $sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_accountancy_journal, b.currency_code, b.datec as date_creation, b.tms as date_update"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 @@ -514,7 +516,10 @@ foreach ($accounts as $key=>$type) } } } - else print $langs->trans("FeatureDisabled"); + else + { + print ''.$langs->trans("FeatureDisabled").''; + } print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1eed9497619..9f3dc206447 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -276,7 +276,9 @@ $sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, $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,"; $sql.= " co.code as country_code"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index fc110d4a396..0fd27d29826 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -218,7 +218,9 @@ $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", 1, 0).') as nb_late,'; $sql.= ' SUM('.$db->ifsql("cd.statut=5", 1, 0).') as nb_closed'; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 3e5b9f55c98..fac71516e99 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -219,7 +219,9 @@ $sql.= " cd.subprice,"; //$sql.= " cd.date_c as date_creation,"; $sql.= " cd.tms as date_update"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php index 2a5f797147e..3ed4ff7e813 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php @@ -253,6 +253,7 @@ class pdf_stdmovement extends ModelePDFMovement $warehousestatic=new Entrepot($db); $movement=new MouvementStock($db); $userstatic=new User($db); + $element = 'movement'; $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,"; $sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,"; @@ -262,7 +263,9 @@ class pdf_stdmovement extends ModelePDFMovement $sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,"; $sql.= " u.login, u.photo, u.lastname, u.firstname"; // Add fields from extrafields - foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); + if (! empty($extrafields->attributes[$element]['label'])) { + foreach ($extrafields->attributes[$element]['label'] as $key => $val) $sql.=($extrafields->attributes[$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 diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index ebe0bcfd8df..1840569fd0e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -192,7 +192,9 @@ $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= ' e.date_creation as date_creation, e.tms as date_update'; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 7160eb8152c..7df7eac69b0 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -209,7 +209,9 @@ if (!empty($conf->contrat->enabled)) { $sql .= ", c.rowid as contrat_id, c.ref as contrat_ref, c.ref_customer as contrat_ref_supplier, c.ref_supplier as contrat_ref_supplier"; } // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 6410f2c9e57..1b1cf0c9b6d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -492,7 +492,9 @@ $sql.= ' cf.date_creation as date_creation, cf.tms as date_update,'; $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_title,"; $sql.= " u.firstname, u.lastname, u.photo, u.login, u.email as user_email"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 862e4d6ece5..4bd6059df3e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -277,7 +277,9 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label"; // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. if (! $search_all) $sql.= ', SUM(pf.amount) as dynamount_payed'; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 0278e1572e6..c08fc8078a8 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -451,7 +451,9 @@ $sql.= " m.type_mouvement,"; $sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,"; $sql.= " u.login, u.photo, u.lastname, u.firstname"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 73b783e09b9..a4831d46844 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -429,7 +429,9 @@ $sql.= " m.fk_projet,"; $sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,"; $sql.= " u.login, u.photo, u.lastname, u.firstname"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 59d727c5027..9a5514ff1cc 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -293,8 +293,10 @@ $sql.= ", s.rowid as socid, s.nom as name, s.email"; $sql.= ", cls.code as opp_status_code"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; -// Add fields for extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// 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 diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 00ef201aa9f..e13b7092b26 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -271,7 +271,9 @@ if (! empty($arrayfields['t.tobill']['checked']) || ! empty($arrayfields['t.bill $sql.=" , SUM(tt.task_duration * ".$db->ifsql("invoice_id IS NULL", "1", "0").") as tobill, SUM(tt.task_duration * ".$db->ifsql("invoice_id IS NULL", "0", "1").") as billed"; } // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 65fdf153dd4..7978f7eaab3 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -427,7 +427,9 @@ $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= ' e.date_creation as date_creation, e.tms as date_update'; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index e29edb07717..7420c417aae 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -388,7 +388,9 @@ if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index f36013b289c..687d98911f2 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -250,7 +250,9 @@ $sql.= " p.rowid as project_id, p.ref as project_ref,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; $sql.= " u.firstname, u.lastname, u.photo, u.login"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 diff --git a/htdocs/user/list.php b/htdocs/user/list.php index d65d852294f..5520465a75d 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -198,7 +198,9 @@ $sql.= " u.tms as date_update, u.datec as date_creation,"; $sql.= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2,"; $sql.= " s.nom as name, s.canvas"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +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 From 42d8f276fca2425ea2873c52aa937964c25d58b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 16 Oct 2019 08:17:13 +0200 Subject: [PATCH 188/409] Update mo.class.php --- htdocs/mrp/class/mo.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index d485ec0ef16..a459a582bba 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1,4 +1,3 @@ - * Copyright (C) ---Put here your own copyright and developer email--- From 4bb16770796b07b197c8e1dcdd6fe5a44efd7340 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Oct 2019 10:39:35 +0200 Subject: [PATCH 189/409] Fix - Accountancy - Various payment - Subledger is not recovered in bank journal --- htdocs/accountancy/journal/bankjournal.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 8003cf1c523..a532379c358 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,12 +4,12 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2018 Frédéric France - * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Eric Seigne + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Eric Seigne * * 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 @@ -387,7 +387,9 @@ if ($result) { $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; $paymentvariousstatic->fetch($paymentvariousstatic->id); $account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word - $tabtp[$obj->rowid][$account_various] += $obj->amount; + $account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word + $tabpay[$obj->rowid]["account_various"] = $account_various; + $tabtp[$obj->rowid][$account_subledger] += $obj->amount; } elseif ($links[$key]['type'] == 'payment_loan') { $paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->ref = $links[$key]['url_id']; @@ -660,11 +662,11 @@ if (! $error && $action == 'writebookkeeping') { $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_various') { - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; + $bookkeeping->subledger_account = $k; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"]; - $accountingaccount->fetch(null, $k, true); + $accountingaccount->fetch(null, $bookkeeping->numero_compte, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; @@ -1123,6 +1125,7 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; + if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"]; $accounttoshow = length_accounta($account_ledger); if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { @@ -1156,7 +1159,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; - if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary'))) // Type of payment with subledger + if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) // Type of payment with subledger { $accounttoshowsubledger = length_accounta($k); if ($accounttoshow != $accounttoshowsubledger) From 5a1682509beb97483b41431dde8f1873d85d4a29 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 16 Oct 2019 11:11:34 +0200 Subject: [PATCH 190/409] FIX It is not possible to create an expedition if there is no unit data --- htdocs/expedition/class/expedition.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 915177164ac..1a9a249effc 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -325,8 +325,8 @@ class Expedition extends CommonObject $sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth $sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth $sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight - $sql.= ", ".$this->weight_units; - $sql.= ", ".$this->size_units; + $sql.= ", ".($this->weight_units>0?$this->weight_units:'NULL'); + $sql.= ", ".($this->size_units>0?$this->size_units:'NULL'); $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); From 517fcf45d144c6c3ce1639432fd04a6a46967ac3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 11:23:06 +0200 Subject: [PATCH 191/409] Look and feel v11 --- htdocs/modulebuilder/index.php | 39 +++++++++++++++++++++++++++++++++- htdocs/societe/card.php | 18 ++++++++-------- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 5cd32512713..0f5ab5e2c90 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -537,6 +537,26 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', } else { + /** + * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + */ + /*public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), @@ -562,14 +582,31 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', $i=10; while ($obj = $db->fetch_object($_results)) { + // fieldname $fieldname = $obj->Field; + // type $type = $obj->Type; if ($type == 'int(11)') $type='integer'; + // notnull $notnull = ($obj->Null == 'YES'?0:1); + // label $label = preg_replace('/_/', ' ', ucfirst($fieldname)); if ($fieldname == 'rowid') $label='ID'; + if ($fieldname == 'import_key') $label='ImportKey'; + // visible + $visible = -1; + if ($fieldname == 'entity') $visible = -2; + if ($fieldname == 'model_pdf') $visible = 0; + // enabled + $enabled = 1; + // default + $default = ''; + if ($fieldname == 'entity') $default=1; - $string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."', 'enabled'=>1, 'visible'=>-2"; + $string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',"; + if ($default != '') $string.= " 'default'=>".$default.","; + $string.= " 'enabled'=>".$enabled.","; + $string.= " 'visible'=>".$visible; if ($notnull) $string.= ", 'notnull'=>".$notnull; if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1"; $string.= ", 'position'=>".$i."),\n"; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e2a8f731856..344fa76fa8d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1293,9 +1293,9 @@ else } // Email / Web - print ''.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).''; + print ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).''; print ''; - print ''.$form->editfieldkey('Web', 'url', '', $object, 0).''; + print ''.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', '', $object, 0).''; print ''; if (! empty($conf->socialnetworks->enabled)) @@ -1335,9 +1335,9 @@ else } // Phone / Fax - print ''.$form->editfieldkey('Phone', 'phone', '', $object, 0).''; + print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).''; print ''; - print ''.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; + print ''.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; print ''; // Prof ids @@ -1916,9 +1916,9 @@ else } // EMail / Web - print ''.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; + print ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email','alpha'), $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; print ''; - print ''.$form->editfieldkey('Web', 'url', '', $object, 0).''; + print ''.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', GETPOST('url','alpha'), $object, 0).''; print ''; if (! empty($conf->socialnetworks->enabled)) @@ -1950,9 +1950,9 @@ else } // Phone / Fax - print ''.$form->editfieldkey('Phone', 'phone', '', $object, 0).''; + print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).''; print ''; - print ''.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; + print ''.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; print ''; // Prof ids @@ -2666,7 +2666,7 @@ else { print ''."\n"; } - + if (! empty($conf->adherent->enabled)) { $adh = new Adherent($db); From 6d05d42c50178f035e07c4342711c7773ca47cb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 11:26:20 +0200 Subject: [PATCH 192/409] Look and feel v11 --- 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 7bda225978f..b3140c7e051 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2220,7 +2220,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type) if (! empty($type)) { $newskype ='
'; - $newskype.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright'); + $newskype.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0); $newskype.=$value; if ($type == 'skype') { From 8d4960954902e7997009d228abf9958ee674fc4d Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Wed, 16 Oct 2019 12:28:50 +0200 Subject: [PATCH 193/409] Fix user time instead of server time it seems that we want to use a user time by clicking on now button. IDEA : may i use client time ??? because if page is old, the now button insert an old time. --- htdocs/core/class/html.form.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d9442e43457..19c01f151cf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5607,10 +5607,10 @@ class Form $reset_scripts = ""; // Generate the date part, depending on the use or not of the javascript calendar - $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y','tzuser').'\');'; /*if ($usecalendar == "eldy") { $base=DOL_URL_ROOT.'/core/'; @@ -5627,7 +5627,7 @@ class Form { if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; - $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H','tzuser').'\');'; if ($fullday) $reset_scripts .= ' } '; } // Update the minute part @@ -5635,7 +5635,7 @@ class Form { if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; - $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M','tzuser').'\');'; if ($fullday) $reset_scripts .= ' } '; } // If reset_scripts is not empty, print the link with the reset_scripts in the onClick From e1521b6c7d28efe5fa495197dcac79dfd7024584 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 12:31:44 +0200 Subject: [PATCH 194/409] Fix phpcs --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 344fa76fa8d..e855cb71b8c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1916,9 +1916,9 @@ else } // EMail / Web - print ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email','alpha'), $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; + print ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; print ''; - print ''.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', GETPOST('url','alpha'), $object, 0).''; + print ''.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).''; print ''; if (! empty($conf->socialnetworks->enabled)) From a9e57fa2b27a8820331885ff0f453d6efd66672e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 12:32:26 +0200 Subject: [PATCH 195/409] Clean page --- htdocs/modulebuilder/index.php | 46 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 0f5ab5e2c90..2e22e9fb23e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1615,7 +1615,7 @@ elseif (! empty($module)) print ''; print '
'; - print load_fiche_titre($langs->trans("DescriptorFile")); + print load_fiche_titre($langs->trans("DescriptorFile"), '', ''); if (! empty($moduleobj)) { @@ -1675,35 +1675,33 @@ elseif (! empty($module)) print ''; print ''; - - print '

'; - - // Readme file - print load_fiche_titre($langs->trans("ReadmeFile")); - - print '
'; - print '
'; - if (dol_is_file($dirread.'/'.$pathtofilereadme)) print $moduleobj->getDescLong(); - else print $langs->trans("ErrorFileNotFound", $pathtofilereadme); - - print '

'; - - // ChangeLog - print load_fiche_titre($langs->trans("ChangeLog")); - - print '
'; - print '
'; - - if (dol_is_file($dirread.'/'.$pathtochangelog)) print $moduleobj->getChangeLog(); - else print $langs->trans("ErrorFileNotFound", $pathtochangelog); - - print '
'; } else { print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; } + if (! empty($moduleobj)) + { + print '

'; + + // Readme file + print load_fiche_titre($langs->trans("ReadmeFile"), '', ''); + + print ''; + if (dol_is_file($dirread.'/'.$pathtofilereadme)) print '
'.$moduleobj->getDescLong().'
'; + else print ''.$langs->trans("ErrorFileNotFound", $pathtofilereadme).''; + + print '

'; + + // ChangeLog + print load_fiche_titre($langs->trans("ChangeLog"), '', ''); + + print ''; + if (dol_is_file($dirread.'/'.$pathtochangelog)) print '
'.$moduleobj->getChangeLog().'
'; + else print ''.$langs->trans("ErrorFileNotFound", $pathtochangelog).''; + } + dol_fiche_end(); } else From bba042c0c31ee10b662bf908996d1dc8aa1dd0e6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 16 Oct 2019 10:34:47 +0000 Subject: [PATCH 196/409] Fixing style errors. --- htdocs/core/class/html.form.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 19c01f151cf..2130a7d7e38 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5607,10 +5607,10 @@ class Form $reset_scripts = ""; // Generate the date part, depending on the use or not of the javascript calendar - $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day','tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d','tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m','tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; /*if ($usecalendar == "eldy") { $base=DOL_URL_ROOT.'/core/'; @@ -5627,7 +5627,7 @@ class Form { if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; - $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; if ($fullday) $reset_scripts .= ' } '; } // Update the minute part @@ -5635,7 +5635,7 @@ class Form { if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; - $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; if ($fullday) $reset_scripts .= ' } '; } // If reset_scripts is not empty, print the link with the reset_scripts in the onClick From 9663205601233fa6fe812ce7d0ec3ce1ad656437 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 13:55:29 +0200 Subject: [PATCH 197/409] FIX css (some buttons not aligned) --- htdocs/theme/eldy/btn.inc.php | 3 ++- htdocs/theme/md/btn.inc.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index a3a952925e3..a9b1a6708a3 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -11,7 +11,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> div.divButAction { margin-bottom: 1.4em; } -div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused { +div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete, +div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete { margin-bottom: 1.4em !important; } div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused { diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index be897e8f841..51cdd1ce11b 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -13,7 +13,8 @@ div.divButAction { margin-bottom: 1.4em; vertical-align: top; } -div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused { +div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete, +div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete { margin-bottom: 1.4em !important; } From 741627897ee2ff709dd59d68787dc60159a27161 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 16 Oct 2019 13:56:11 +0200 Subject: [PATCH 198/409] fix interchanged allocation --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1ce4dce01a0..42e77c898c3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1553,7 +1553,7 @@ class ActionComm extends CommonObject else { // use start date as fall-back to avoid import erros on empty end date - $datestart = $dateend; + $dateend = $datestart; } $dateend=$this->db->jdate($obj->datep2)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); From b9ec45fd49150c01951282b479e2a3b245ed947d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 14:02:13 +0200 Subject: [PATCH 199/409] Clean code --- htdocs/commande/card.php | 20 ++++---- htdocs/compta/facture/card.php | 84 +++++++++++++++++----------------- test/phpunit/FilesLibTest.php | 4 +- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0d13537037c..ea423a0a99c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2543,19 +2543,19 @@ if ($action == 'create' && $usercancreate) // Send if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($usercansend) { - print ''; + print '' . $langs->trans('SendMail') . ''; } else - print ''; + print '' . $langs->trans('SendMail') . ''; } // Valid if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate) { - print ''; + print '' . $langs->trans('Validate') . ''; } // Edit if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) { - print ''; + print '' . $langs->trans('Modify') . ''; } // Create event /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) @@ -2572,9 +2572,9 @@ if ($action == 'create' && $usercancreate) if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($user->rights->ficheinter->creer) { - print ''; + print '' . $langs->trans('AddIntervention') . ''; } else { - print ''; + print '' . $langs->trans('AddIntervention') . ''; } } } @@ -2584,7 +2584,7 @@ if ($action == 'create' && $usercancreate) $langs->load("contracts"); if ($user->rights->contrat->creer) { - print ''; + print '' . $langs->trans('AddContract') . ''; } } @@ -2596,13 +2596,13 @@ if ($action == 'create' && $usercancreate) if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) { if ($user->rights->expedition->creer) { - print ''; + print '' . $langs->trans('CreateShipment') . ''; } else { - print ''; + print '' . $langs->trans('CreateShipment') . ''; } } else { $langs->load("errors"); - print ''; + print 'transnoentitiesnoconv("Shipment"))) . '">' . $langs->trans('CreateShipment') . ''; } } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9467cebde59..2a08c55eeba 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4845,20 +4845,20 @@ elseif ($id > 0 || ! empty($ref)) { if ($usercanunvalidate) { - print ''; + print '' . $langs->trans('Modify') . ''; } else { - print '
' . $langs->trans('Modify') . '
'; + print '' . $langs->trans('Modify') . ''; } } elseif (!$object->is_last_in_cycle()) { - print '
' . $langs->trans('Modify') . '
'; + print '' . $langs->trans('Modify') . ''; } else { - print '
' . $langs->trans('Modify') . '
'; + print '' . $langs->trans('Modify') . ''; } } } else { - print '
' . $langs->trans('Modify') . '
'; + print '' . $langs->trans('Modify') . ''; } } @@ -4874,9 +4874,9 @@ elseif ($id > 0 || ! empty($ref)) { if ($object->close_code != 'replaced' || (! $objectidnext)) // Not replaced by another invoice or replaced but the replacement invoice has been deleted { - print ''; + print '' . $langs->trans('ReOpen') . ''; } else { - print '
' . $langs->trans('ReOpen') . '
'; + print '' . $langs->trans('ReOpen') . ''; } } @@ -4884,19 +4884,19 @@ elseif ($id > 0 || ! empty($ref)) if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { - print ''; + print '' . $langs->trans('Validate') . ''; } } // Send by mail if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($objectidnext) { - print '
' . $langs->trans('SendMail') . '
'; + print '' . $langs->trans('SendMail') . ''; } else { if ($usercansend) { - print ''; + print '' . $langs->trans('SendMail') . ''; } else - print ''; + print '' . $langs->trans('SendMail') . ''; } } @@ -4911,7 +4911,7 @@ elseif ($id > 0 || ! empty($ref)) { print ''.$langs->trans("MakeWithdrawRequest").''; } else { - print '
' . $langs->trans('MakeWithdrawRequest') . '
'; + print '' . $langs->trans('MakeWithdrawRequest') . ''; } } else @@ -4930,18 +4930,18 @@ elseif ($id > 0 || ! empty($ref)) { $langs->load("cashdesk"); $receipt_url=DOL_URL_ROOT."/takepos/receipt.php"; - print ''; + print '' . $langs->trans('POSTicket') .''; } // Create payment if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercanissuepayment) { if ($objectidnext) { - print '
' . $langs->trans('DoPayment') . '
'; + print '' . $langs->trans('DoPayment') . ''; } else { //if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done) // print '
' . $langs->trans('DoPayment') . '
'; //} else { - print ''; + print '' . $langs->trans('DoPayment') . ''; //} } } @@ -4953,27 +4953,27 @@ elseif ($id > 0 || ! empty($ref)) { if ($resteapayer == 0) { - print '
'.$langs->trans('DoPaymentBack').'
'; + print ''.$langs->trans('DoPaymentBack').''; } else { - print ''; + print ''.$langs->trans('DoPaymentBack').''; } } // For standard invoice with excess received if ($object->type == Facture::TYPE_STANDARD && empty($object->paye) && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) < 0 && $usercancreate && empty($discount->id)) { - print ''; + print ''.$langs->trans('ConvertExcessReceivedToReduc').''; } // For credit note if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate && $object->getSommePaiement() == 0) { - print ''; + print '' . $langs->trans('ConvertToReduc') . ''; } // For deposit invoice if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && empty($discount->id)) { - print ''; + print ''.$langs->trans('ConvertToReduc').''; } } @@ -4982,7 +4982,7 @@ elseif ($id > 0 || ! empty($ref)) || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id)) ) { - print ''; + print ''.$langs->trans('ClassifyPaid').''; } // Classify 'closed not completely paid' (possible si validee et pas encore classee payee) @@ -4992,7 +4992,7 @@ elseif ($id > 0 || ! empty($ref)) if ($totalpaye > 0 || $totalcreditnotes > 0) { // If one payment or one credit note was linked to this invoice - print ''; + print '' . $langs->trans('ClassifyPaidPartially') . ''; } else { @@ -5000,11 +5000,11 @@ elseif ($id > 0 || ! empty($ref)) { if ($objectidnext) { - print '
' . $langs->trans('ClassifyCanceled') . '
'; + print '' . $langs->trans('ClassifyCanceled') . ''; } else { - print ''; + print '' . $langs->trans('ClassifyCanceled') . ''; } } } @@ -5013,7 +5013,7 @@ elseif ($id > 0 || ! empty($ref)) // Clone if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - print ''; + print '' . $langs->trans("ToClone") . ''; } // Clone as predefined / Create template @@ -5021,7 +5021,7 @@ elseif ($id > 0 || ! empty($ref)) { if (! $objectidnext && count($object->lines) > 0) { - print ''; + print '' . $langs->trans("ChangeIntoRepeatableInvoice") . ''; } } @@ -5030,7 +5030,7 @@ elseif ($id > 0 || ! empty($ref)) { if (! $objectidnext) { - print ''; + print '' . $langs->trans("CreateCreditNote") . ''; } } @@ -5045,9 +5045,9 @@ elseif ($id > 0 || ! empty($ref)) { if ($usercanunvalidate) { - print ''; + print '' . $langs->trans("CreateCreditNote") . ''; } else { - print '
' . $langs->trans("CreateCreditNote") . '
'; + print '' . $langs->trans("CreateCreditNote") . ''; } } @@ -5063,22 +5063,22 @@ elseif ($id > 0 || ! empty($ref)) { if(($object->total_ttc - $totalcreditnotes ) == 0 ) { - print ''; + print '' . $langs->trans("RemoveSituationFromCycle") . ''; } else { - print ''; + print '' . $langs->trans("RemoveSituationFromCycle") . ''; } } // Create next situation invoice if ($usercancreate && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) { if ($object->is_last_in_cycle() && $object->situation_final != 1) { - print ''; + print '' . $langs->trans('CreateNextSituationInvoice') . ''; } elseif (!$object->is_last_in_cycle()) { - print ''; + print '' . $langs->trans('CreateNextSituationInvoice') . ''; } else { - print ''; + print '' . $langs->trans('CreateNextSituationInvoice') . ''; } } @@ -5088,31 +5088,31 @@ elseif ($id > 0 || ! empty($ref)) { //var_dump($isErasable); if ($isErasable == -4) { - print ''; + print '' . $langs->trans('Delete') . ''; } elseif ($isErasable == -3) { - print ''; + print '' . $langs->trans('Delete') . ''; } elseif ($isErasable == -2) { - print ''; + print '' . $langs->trans('Delete') . ''; } elseif ($isErasable == -1) { - print ''; + print '' . $langs->trans('Delete') . ''; } elseif ($isErasable <= 0) // Any other cases { - print ''; + print '' . $langs->trans('Delete') . ''; } elseif ($objectidnext) { - print ''; + print '' . $langs->trans('Delete') . ''; } else { - print ''; + print '' . $langs->trans('Delete') . ''; } } else { - print ''; + print '' . $langs->trans('Delete') . ''; } } print '
'; diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 9b990d78922..d73d99f7078 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -413,11 +413,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase $result=dol_compress_file($filein, $fileout, $format, $errorstring); print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_file on ".$filein." : ".$errorstring); + $this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_file on ".$filein." into ".$fileout." : ".$errorstring); $result=dol_uncompress($fileout, $dirout); print __METHOD__." result=".join(',', $result)."\n"; - $this->assertEquals(0, count($result), "Pb with dol_uncompress_file"); + $this->assertEquals(0, count($result), "Pb with dol_uncompress_file of file ".$fileout); } /** From 86e4ca55dfd9ec41ff43296c622231079037e302 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 13:55:29 +0200 Subject: [PATCH 200/409] Merge --- htdocs/theme/eldy/btn.inc.php | 3 ++- htdocs/theme/md/style.css.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 2e42d42acaa..3ee6a164f75 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -11,7 +11,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> div.divButAction { margin-bottom: 1.4em; } -div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused { +div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete, +div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete { margin-bottom: 1.4em !important; } div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8e0cf75047b..65436182755 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2571,7 +2571,9 @@ div.divButAction { margin-bottom: 1.4em; vertical-align: top; } -div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused { + +div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete, +div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete { margin-bottom: 1.4em !important; } From dd97a2e6663484391397796b9e516cbf454dcbff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 14:11:11 +0200 Subject: [PATCH 201/409] CSS --- htdocs/theme/md/style.css.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9aec13e5fc7..05249c99b03 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -504,6 +504,9 @@ input[name=weight], input[name=volume], input[name=surface], input[name=sizeheig input[name=surface] { margin-right: 4px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } +input#onlinepaymenturl, input#directdownloadlink { + opacity: 0.7; +} div#moretabsListaction { z-index: 5; From f88733f46a9539c4756546645cc62da430f93e0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 14:14:32 +0200 Subject: [PATCH 202/409] Html code simplest --- htdocs/comm/propal/card.php | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 92267d97033..8891c2280f0 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2471,39 +2471,39 @@ if ($action == 'create') { if ($usercanvalidate) { - print ''; + print '' . $langs->trans('Validate') . ''; } else - print ''; + print '' . $langs->trans('Validate') . ''; } // Create event /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { - print ''; + print '' . $langs->trans("AddAction") . '
'; }*/ // Edit if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { - print ''; + print '' . $langs->trans('Modify') . ''; } // ReOpen if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) { - print ''; + print 'global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"'; + print '>' . $langs->trans('ReOpen') . ''; } // Send if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($usercansend) { - print ''; + print '' . $langs->trans('SendMail') . ''; } else - print ''; + print '' . $langs->trans('SendMail') . ''; } // Create an order if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateorder) { - print ''; + print '' . $langs->trans("AddOrder") . ''; } } @@ -2511,7 +2511,7 @@ if ($action == 'create') if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); - print ''; + print '' . $langs->trans("AddIntervention") . ''; } } @@ -2520,7 +2520,7 @@ if ($action == 'create') $langs->load("contracts"); if ($usercancreatecontract) { - print ''; + print '' . $langs->trans('AddContract') . ''; } } @@ -2529,7 +2529,7 @@ if ($action == 'create') { if (! empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''; + print '' . $langs->trans("AddBill") . ''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); @@ -2537,30 +2537,30 @@ if ($action == 'create') { if ($usercanclose) { - print ''; + print 'socid . '">' . $langs->trans("ClassifyBilled") . ''; } else { - print ''; + print '' . $langs->trans("ClassifyBilled") . ''; } } } // Set accepted/refused if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) { - print ''; + print 'global->MAIN_JUMP_TAG) ? '' : '#close') . '"'; + print '>' . $langs->trans('SetAcceptedRefused') . ''; } // Clone if ($usercancreate) { - print ''; + print '' . $langs->trans("ToClone") . ''; } // Delete if ($usercandelete) { - print ''; + print '' . $langs->trans('Delete') . ''; } } } From b60ddc255c744a17a304a786eb27c68d287ada92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 14:17:53 +0200 Subject: [PATCH 203/409] Removed useless html tags --- htdocs/product/card.php | 22 +++++++++---------- htdocs/projet/card.php | 48 ++++++++++++++++++++--------------------- htdocs/societe/card.php | 12 +++++------ 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 22a8af0d270..df195d0c932 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1058,7 +1058,7 @@ else $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1); print ''; - + // Net Measure print ''.$langs->trans("NetMeasure").''; print ''; @@ -1070,7 +1070,7 @@ else print ''; print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units')?GETPOST('weight_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); print ''; - + // Brut Length if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { @@ -1438,7 +1438,7 @@ else $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); print $form->selectarray('finished', $statutarray, $object->finished); print ''; - + // Net Measure print ''.$langs->trans("NetMeasure").''; print ' '; @@ -1852,7 +1852,7 @@ else print ''.$langs->trans("Nature").''; print $object->getLibFinished(); print ''; - + // Net Measure print ''.$langs->trans("NetMeasure").''; if ($object->net_measure != '') @@ -2035,17 +2035,17 @@ if ($action != 'create' && $action != 'edit') { if ($usercancreate) { - if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print ''; + if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print 'id.'">'.$langs->trans("Modify").''; if (! isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - print '
'.$langs->trans('ToClone').'
'."\n"; + print ''.$langs->trans('ToClone').''."\n"; } else { - print ''; + print 'id.'">'.$langs->trans("ToClone").''; } } } @@ -2057,21 +2057,21 @@ if ($action != 'create' && $action != 'edit') { if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - print '
'.$langs->trans('Delete').'
'."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { - print ''; + print 'id.'">'.$langs->trans("Delete").''; } } else { - print ''; + print ''.$langs->trans("Delete").''; } } else { - print ''; + print ''.$langs->trans("Delete").''; } } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 4c04ee6ee23..7469c99c3dd 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1172,13 +1172,13 @@ elseif ($object->id > 0) // "workflow" action so should appears somewhere else on // page. { - print ''; + print '' . $langs->trans("AddAction") . ''; }*/ // Send if ($object->statut != 2) { - print ''; + print '' . $langs->trans('SendMail').''; } // Modify @@ -1186,11 +1186,11 @@ elseif ($object->id > 0) { if ($userWrite > 0) { - print ''; + print ''.$langs->trans("Modify").''; } else { - print ''; + print ''.$langs->trans('Modify').''; } } @@ -1199,11 +1199,11 @@ elseif ($object->id > 0) { if ($userWrite > 0) { - print ''; + print ''.$langs->trans("Validate").''; } else { - print ''; + print ''.$langs->trans('Validate').''; } } @@ -1212,11 +1212,11 @@ elseif ($object->id > 0) { if ($userWrite > 0) { - print ''; + print ''.$langs->trans("Close").''; } else { - print ''; + print ''.$langs->trans('Close').''; } } @@ -1225,11 +1225,11 @@ elseif ($object->id > 0) { if ($userWrite > 0) { - print ''; + print ''.$langs->trans("ReOpen").''; } else { - print ''; + print ''.$langs->trans('ReOpen').''; } } @@ -1239,52 +1239,52 @@ elseif ($object->id > 0) if (! empty($conf->propal->enabled) && $user->rights->propal->creer) { $langs->load("propal"); - print ''; + print ''.$langs->trans("AddProp").''; } if (! empty($conf->commande->enabled) && $user->rights->commande->creer) { $langs->load("orders"); - print ''; + print ''.$langs->trans("CreateOrder").''; } if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { $langs->load("bills"); - print ''; + print ''.$langs->trans("CreateBill").''; } if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) { $langs->load("supplier_proposal"); - print ''; + print ''.$langs->trans("AddSupplierProposal").''; } if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer) { $langs->load("suppliers"); - print ''; + print ''.$langs->trans("AddSupplierOrder").''; } if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer) { $langs->load("suppliers"); - print ''; + print ''.$langs->trans("AddSupplierInvoice").''; } if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) { $langs->load("interventions"); - print ''; + print ''.$langs->trans("AddIntervention").''; } if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer) { $langs->load("contracts"); - print ''; + print ''.$langs->trans("AddContract").''; } if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) { $langs->load("trips"); - print ''; + print ''.$langs->trans("AddTrip").''; } if (! empty($conf->don->enabled) && $user->rights->don->creer) { $langs->load("donations"); - print ''; + print ''.$langs->trans("AddDonation").''; } } @@ -1293,11 +1293,11 @@ elseif ($object->id > 0) { if ($userWrite > 0) { - print ''; + print ''.$langs->trans('ToClone').''; } else { - print ''; + print ''.$langs->trans('ToClone').''; } } @@ -1306,11 +1306,11 @@ elseif ($object->id > 0) { if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer)) { - print ''; + print ''.$langs->trans("Delete").''; } else { - print ''; + print ''.$langs->trans('Delete').''; } } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e855cb71b8c..cb11324eb68 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2654,17 +2654,17 @@ else if (! empty($object->email) || $at_least_one_email_contact) { $langs->load("mails"); - print ''; + print ''.$langs->trans('SendMail').''; } else { $langs->load("mails"); - print ''; + print ''.$langs->trans('SendMail').''; } if ($user->rights->societe->creer) { - print ''."\n"; + print ''.$langs->trans("Modify").'
'."\n"; } if (! empty($conf->adherent->enabled)) @@ -2679,18 +2679,18 @@ else if ($user->rights->societe->supprimer) { - print ''; + print ''.$langs->trans('Merge').''; } if ($user->rights->societe->supprimer) { if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile { - print '
'.$langs->trans('Delete').'
'."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { - print ''."\n"; + print ''.$langs->trans('Delete').''."\n"; } } } From 4ca9fddfcc93ecc829f2ffc5e3710ae87824ba38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 14:26:49 +0200 Subject: [PATCH 204/409] Update product.class.php --- htdocs/product/class/product.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index aa0c575d8d7..2b3fc3ece65 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -787,12 +787,12 @@ class Product extends CommonObject * Update a record into database. * If batch flag is set to on, we create records into llx_product_batch * - * @param int $id Id of product - * @param User $user Object user making update - * @param int $notrigger Disable triggers - * @param string $action Current action for hookmanager ('add' or 'update') - * @param int $updatetype Update product type - * @return int 1 if OK, -1 if ref already exists, -2 if other error + * @param int $id Id of product + * @param User $user Object user making update + * @param int $notrigger Disable triggers + * @param string $action Current action for hookmanager ('add' or 'update') + * @param boolean $updatetype Update product type + * @return int 1 if OK, -1 if ref already exists, -2 if other error */ public function update($id, $user, $notrigger = false, $action = 'update', $updatetype = false) { From 8d75e83e5506219068af85161ac150e06e3eacf1 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Wed, 16 Oct 2019 14:32:17 +0200 Subject: [PATCH 205/409] use current local time on Now button use current local time for feed the date according to locale settings --- htdocs/core/class/html.form.class.php | 51 ++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2130a7d7e38..51e93557417 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5323,7 +5323,7 @@ class Form * @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only * @param string $form_name Not used * @param int $d 1=Show days, month, years - * @param int $addnowlink Add a link "Now" + * @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time * @param int $disabled Disable input fields * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. @@ -5605,12 +5605,32 @@ class Form { // Script which will be inserted in the onClick of the "Now" link $reset_scripts = ""; - + if ($addnowlink==2) // local computer time + { + // pad add leading 0 on numbers + $reset_scripts.="Number.prototype.pad = function(size) { + var s = String(this); + while (s.length < (size || 2)) {s = '0' + s;} + return s; + }; + var d = new Date();"; + } + // Generate the date part, depending on the use or not of the javascript calendar - $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; + if($addnowlink==1) // server time expressed in user time setup + { + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y','tzuser').'\');'; + } + elseif($addnowlink==2) + { + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(d.getMonth().pad());'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; + } /*if ($usecalendar == "eldy") { $base=DOL_URL_ROOT.'/core/'; @@ -5627,7 +5647,15 @@ class Form { if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; - $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; + if($addnowlink==1) + { + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H','tzuser').'\');'; + } + elseif($addnowlink==2) + { + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; + } + if ($fullday) $reset_scripts .= ' } '; } // Update the minute part @@ -5635,7 +5663,14 @@ class Form { if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; - $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; + if($addnowlink==1) + { + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M','tzuser').'\');'; + } + elseif($addnowlink==2) + { + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; + } if ($fullday) $reset_scripts .= ' } '; } // If reset_scripts is not empty, print the link with the reset_scripts in the onClick From fce1f1991c9b275dd3fae6c9b64ed3da029207ff Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 16 Oct 2019 12:34:42 +0000 Subject: [PATCH 206/409] Fixing style errors. --- htdocs/core/class/html.form.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51e93557417..0a069bb2ced 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5619,10 +5619,10 @@ class Form // Generate the date part, depending on the use or not of the javascript calendar if($addnowlink==1) // server time expressed in user time setup { - $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day','tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d','tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m','tzuser').'\');'; - $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; } elseif($addnowlink==2) { @@ -5649,7 +5649,7 @@ class Form //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; if($addnowlink==1) { - $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; } elseif($addnowlink==2) { @@ -5665,7 +5665,7 @@ class Form //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; if($addnowlink==1) { - $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M','tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; } elseif($addnowlink==2) { From cd825ba4be226536bcedef860f5b0a51717c4684 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 16 Oct 2019 15:46:46 +0200 Subject: [PATCH 207/409] internationalization --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index ddc07db0380..21658ed32d0 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -146,7 +146,7 @@ class pdf_espadon extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Object $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -370,7 +370,7 @@ class pdf_espadon extends ModelePdfExpedition // Notes if (! empty($object->note_public)) { - $pdf->SetFont('', '', $default_font_size - 1); // Dans boucle pour gerer multi-page + $pdf->SetFont('', '', $default_font_size - 1); // In loop to manage multi-page $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1); } @@ -502,7 +502,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // weight From 10fd472392195997bb3326ec34bc7fe7b1caaa67 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 16 Oct 2019 15:59:08 +0200 Subject: [PATCH 208/409] internationalization --- .../expedition/doc/pdf_merou.modules.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index ad676dba22e..53f46ccc861 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -174,20 +174,20 @@ class pdf_merou extends ModelePdfExpedition $origin = $object->origin; - //Creation de l expediteur + //Create sender $this->expediteur = $mysoc; - //Creation du destinataire + //Create recipient $idcontact = $object->$origin->getIdContact('external', 'SHIPPING'); $this->destinataire = new Contact($this->db); if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]); - //Creation du livreur + //Create deliverer $idcontact = $object->$origin->getIdContact('internal', 'LIVREUR'); $this->livreur = new User($this->db); if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]); - // Definition de $dir et $file + // Definition of $dir and $file if ($object->specimen) { $dir = $conf->expedition->dir_output."/sending"; @@ -273,7 +273,7 @@ class pdf_merou extends ModelePdfExpedition $tab_height = $this->page_hauteur - $tab_top - $heightforfooter; $tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter; - // Affiche notes + // Display notes if (! empty($object->note_public)) { $pdf->SetFont('', '', $default_font_size - 1); @@ -314,7 +314,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); - // Description de la ligne produit + // Description of product line $libelleproduitservice = pdf_writelinedesc($pdf, $object, $i, $outputlangs, 90, 3, 50, $curY, 0, 1); $nexY = $pdf->GetY(); @@ -335,7 +335,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->Rect(10+3, $curY, 3, 3); $pdf->Rect(20+3, $curY, 3, 3); - //Insertion de la reference du produit + //Inserting the product reference $pdf->SetXY(30, $curY); $pdf->SetFont('', 'B', $default_font_size - 3); $pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0); @@ -404,7 +404,7 @@ class pdf_merou extends ModelePdfExpedition $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - // Pied de page + // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -579,11 +579,11 @@ class pdf_merou extends ModelePdfExpedition } //*********************Entete**************************** - //Nom du Document + //Document name $pdf->SetXY($Xoff, 7); $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetTextColor(0, 0, 0); - $pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Bordereau expedition + $pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Sending sheet //Num Expedition $Yoff = $Yoff+7; $Xoff = 142; @@ -601,7 +601,7 @@ class pdf_merou extends ModelePdfExpedition $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1, $hookmanager); //$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true); - //Definition Emplacement du bloc Societe + //Definition Location of the Company block $Xoff = 110; $blSocX=90; $blSocY=24; @@ -632,7 +632,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } - // Date Expedition + // Date delivery $Yoff = $Yoff+7; $pdf->SetXY($blSocX-80, $blSocY+17); @@ -698,7 +698,7 @@ class pdf_merou extends ModelePdfExpedition } // Recipient name - // On peut utiliser le nom de la societe du contact + // You can use the name of the contact company if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { From 75a47eebe043e7a5a48fb49222fe8ea604910b75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 16:17:51 +0200 Subject: [PATCH 209/409] Fix Method fetchAll must NEVER be used for table with more than 1000 record --- htdocs/accountancy/bookkeeping/list.php | 534 +++++++++++------- .../class/accountancyexport.class.php | 11 +- 2 files changed, 341 insertions(+), 204 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 2958a229d24..b14a118a342 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -155,6 +155,12 @@ $arrayfields=array( if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); +$listofformat=AccountancyExport::getType(); +$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV; +if (empty($listofformat[$formatexportset])) $formatexportset = 1; + +$error = 0; + /* * Actions @@ -373,10 +379,97 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri exit; } } +if ($action == 'setreexport') { + $setreexport = GETPOST('value', 'int'); + if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++; + + if (! $error) { + if ($conf->global->ACCOUNTING_REEXPORT == 1) { + setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); + } + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +// Build and execute select (used by page and export action) +// must de set after the action that set $filter +// -------------------------------------------------------------------- + +$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.lettering_code,"; +$sql .= " t.montant,"; +$sql .= " t.sens,"; +$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.tms as date_modification,"; +$sql .= " t.date_export"; +$sql .= ' FROM ' . MAIN_DB_PREFIX . $object->table_element . ' as t'; +// Manage filter +$sqlwhere = array (); +if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key == 't.doc_date') { + $sqlwhere[] = $key . '=\'' . $db->idate($value) . '\''; + } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { + $sqlwhere[] = $key . '\'' . $db->idate($value) . '\''; + } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') { + $sqlwhere[] = $key . '\'' . $db->escape($value) . '\''; + } 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 \'' . $db->escape($value) . '%\''; + } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { + $sqlwhere[] = $key . '\'' . $db->idate($value) . '\''; + } elseif ($key == 't.tms>=' || $key == 't.tms<=') { + $sqlwhere[] = $key . '\'' . $db->idate($value) . '\''; + } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') { + $sqlwhere[] = $key . '\'' . $db->idate($value) . '\''; + } elseif ($key == 't.credit' || $key == 't.debit') { + $sqlwhere[] = natural_search($key, $value, 1, 1); + } else { + $sqlwhere[] = natural_search($key, $value, 0, 1); + } + } +} +$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')'; +if ($conf->global->ACCOUNTING_REEXPORT == 0) { + $sql .= " AND t.date_export IS NULL"; +} +if (count($sqlwhere) > 0) { + $sql .= ' AND ' . implode(' AND ', $sqlwhere); +} +if (! empty($sortfield)) { + $sql .= $db->order($sortfield, $sortorder); +} +//print $sql; + // Export into a file with format defined into setup (FEC, CSV, ...) +// Must be after definition of $sql if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { + // TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them. $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); if ($result < 0) @@ -387,55 +480,54 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { { // Export files $accountancyexport = new AccountancyExport($db); - $accountancyexport->export($object->lines); + $accountancyexport->export($object->lines, $formatexportset); if (! empty($accountancyexport->errors)) { setEventMessages('', $accountancyexport->errors, 'errors'); - } else { + } + else + { // Specify as export : update field date_export - // TODO Move in class bookKeeping $error=0; $db->begin(); - if (is_array($object->lines)) { - foreach ($object->lines as $movement) { + if (is_array($object->lines)) + { + foreach ($object->lines as $movement) + { $now = dol_now(); + $sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " SET date_export = '" . $db->idate($now) . "'"; $sql .= " WHERE rowid = " . $movement->id; dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); - if ($result) { - $db->commit(); - // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); - } else { - $db->rollback(); - // setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); + if (! $result) + { + $error++; + break; } } } + + if (! $error) + { + $db->commit(); + // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); + } + else + { + $error++; + $db->rollback(); + setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); + } } exit; } } -if ($action == 'setreexport') { - $export = 0; - $setreexport = GETPOST('value', 'int'); - if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++; - - if (! $error) { - if ($conf->global->ACCOUNTING_REEXPORT == 1) { - setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); - } - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} /* * View @@ -443,24 +535,43 @@ if ($action == 'setreexport') { $title_page = $langs->trans("Bookkeeping"); -llxHeader('', $title_page); - -// List +// Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); - if ($nbtotalofrecords < 0) { - setEventMessages($object->error, $object->errors, 'errors'); +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 + { + $page = 0; + $offset = 0; } } +// 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 +{ + $sql.= $db->plimit($limit+1, $offset); -// TODO Do not use this -$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); } -$num=count($object->lines); + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title_page); + if ($action == 'delmouv') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); @@ -510,9 +621,6 @@ print ''; print ''; print ''; -$button .= ''; - -$listofformat=AccountancyExport::getType(); if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList"); else $buttonLabel = $langs->trans("ExportList"); @@ -524,13 +632,13 @@ if (! empty($conf->global->ACCOUNTING_REEXPORT)) { } $newcardbutton.= ''.$langs->trans("IncludeDocsAlreadyExported").''; -$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export); +$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export); $newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); $newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer); -print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -650,7 +758,6 @@ if (! empty($arrayfields['t.code_journal']['checked'])) print ''; } - // Fields from hook $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook @@ -727,171 +834,200 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; -if ($num > 0) +$line = new BookKeepingLine(); + +// Loop on record +// -------------------------------------------------------------------- +$i=0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + $line->id = $obj->rowid; + $line->doc_date = $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->montant; + $line->sens = $obj->sens; + $line->lettering_code = $obj->lettering_code; + $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 = $db->jdate($obj->date_creation); + $line->date_modification = $db->jdate($obj->date_modification); + $line->date_export = $db->jdate($obj->date_export); + + $total_debit += $line->debit; + $total_credit += $line->credit; + + print ''; + + // Piece number + if (! empty($arrayfields['t.piece_num']['checked'])) + { + print ''; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1, '', 0, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Document date + if (! empty($arrayfields['t.doc_date']['checked'])) + { + print '' . dol_print_date($line->doc_date, 'day') . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Document ref + if (! empty($arrayfields['t.doc_ref']['checked'])) + { + print '' . $line->doc_ref . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Account number + if (! empty($arrayfields['t.numero_compte']['checked'])) + { + print '' . length_accountg($line->numero_compte) . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Subledger account + if (! empty($arrayfields['t.subledger_account']['checked'])) + { + print '' . length_accounta($line->subledger_account) . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Label operation + if (! empty($arrayfields['t.label_operation']['checked'])) + { + print '' . $line->label_operation . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Amount debit + if (! empty($arrayfields['t.debit']['checked'])) + { + print '' . ($line->debit ? price($line->debit) : ''). ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; + $totalarray['totaldebit'] += $line->debit; + } + + // Amount credit + if (! empty($arrayfields['t.credit']['checked'])) + { + print '' . ($line->credit ? price($line->credit) : '') . ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; + $totalarray['totalcredit'] += $line->credit; + } + + // Lettering code + if (! empty($arrayfields['t.lettering_code']['checked'])) + { + print '' . $line->lettering_code . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Journal code + if (! empty($arrayfields['t.code_journal']['checked'])) + { + $accountingjournal = new AccountingJournal($db); + $result = $accountingjournal->fetch('', $line->code_journal); + $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); + print '' . $journaltoshow . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Creation operation date + if (! empty($arrayfields['t.date_creation']['checked'])) + { + print '' . dol_print_date($line->date_creation, 'dayhour') . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Modification operation date + if (! empty($arrayfields['t.tms']['checked'])) + { + print '' . dol_print_date($line->date_modification, 'dayhour') . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Exported operation date + if (! empty($arrayfields['t.date_export']['checked'])) + { + print '' . dol_print_date($line->date_export, 'dayhour') . ''; + if (! $i) $totalarray['nbfield']++; + } + + // Action column + print ''; + if (empty($line->date_export)) { + if ($user->rights->accounting->mouvements->creer) { + print '' . img_edit() . ''; + } + if ($user->rights->accounting->mouvements->supprimer) { + print ' ' . img_delete() . ''; + } + } + print ''; + + if (! $i) $totalarray['nbfield']++; + + print "\n"; + + $i++; +} + +// Show total line +if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield'])) { $i=0; - $totalarray=array(); - while ($i < min($num, $limit)) + print ''; + while ($i < $totalarray['nbfield']) { - $line = $object->lines[$i]; - - $total_debit += $line->debit; - $total_credit += $line->credit; - - print ''; - - // Piece number - if (! empty($arrayfields['t.piece_num']['checked'])) - { - print ''; - $object->id = $line->id; - $object->piece_num = $line->piece_num; - print $object->getNomUrl(1, '', 0, '', 1); - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Document date - if (! empty($arrayfields['t.doc_date']['checked'])) - { - print '' . dol_print_date($line->doc_date, 'day') . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Document ref - if (! empty($arrayfields['t.doc_ref']['checked'])) - { - print '' . $line->doc_ref . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Account number - if (! empty($arrayfields['t.numero_compte']['checked'])) - { - print '' . length_accountg($line->numero_compte) . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Subledger account - if (! empty($arrayfields['t.subledger_account']['checked'])) - { - print '' . length_accounta($line->subledger_account) . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Label operation - if (! empty($arrayfields['t.label_operation']['checked'])) - { - print '' . $line->label_operation . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Amount debit - if (! empty($arrayfields['t.debit']['checked'])) - { - print '' . ($line->debit ? price($line->debit) : ''). ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; - $totalarray['totaldebit'] += $line->debit; - } - - // Amount credit - if (! empty($arrayfields['t.credit']['checked'])) - { - print '' . ($line->credit ? price($line->credit) : '') . ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; - $totalarray['totalcredit'] += $line->credit; - } - - // Lettering code - if (! empty($arrayfields['t.lettering_code']['checked'])) - { - print '' . $line->lettering_code . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Journal code - if (! empty($arrayfields['t.code_journal']['checked'])) - { - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('', $line->code_journal); - $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); - print '' . $journaltoshow . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Creation operation date - if (! empty($arrayfields['t.date_creation']['checked'])) - { - print '' . dol_print_date($line->date_creation, 'dayhour') . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Modification operation date - if (! empty($arrayfields['t.tms']['checked'])) - { - print '' . dol_print_date($line->date_modification, 'dayhour') . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Exported operation date - if (! empty($arrayfields['t.date_export']['checked'])) - { - print '' . dol_print_date($line->date_export, 'dayhour') . ''; - if (! $i) $totalarray['nbfield']++; - } - - // Action column - print ''; - if (empty($line->date_export)) { - if ($user->rights->accounting->mouvements->creer) { - print '' . img_edit() . ''; - } - if ($user->rights->accounting->mouvements->supprimer) { - print ' ' . img_delete() . ''; - } - } - print ''; - - if (! $i) $totalarray['nbfield']++; - - print "\n"; - $i++; - } - - // Show total line - if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield'])) - { - $i=0; - print ''; - while ($i < $totalarray['nbfield']) + if ($i == 1) { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - elseif ($totalarray['totaldebitfield'] == $i) print ''.price($totalarray['totaldebit']).''; - elseif ($totalarray['totalcreditfield'] == $i) print ''.price($totalarray['totalcredit']).''; - else print ''; + if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; } - $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 ''; + elseif ($totalarray['totaldebitfield'] == $i) print ''.price($totalarray['totaldebit']).''; + elseif ($totalarray['totalcreditfield'] == $i) print ''.price($totalarray['totalcredit']).''; + else print ''; } + $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 ''; } + print ""; print ''; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f90d5797d09..84a851eea50 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -224,22 +224,23 @@ class AccountancyExport /** * Function who chose which export to use with the default config, and make the export into a file * - * @param array $TData data - * @return void + * @param array $TData Array with data + * @param int $formatexportset Id of export format + * @return void */ - public function export(&$TData) + public function export(&$TData, $formatexportset) { global $conf, $langs; global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php // Define name of file to save - $filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV); + $filename = 'general_ledger-'.$this->getFormatCode($formatexportset); $type_export = 'general_ledger'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) { + switch ($formatexportset) { case self::$EXPORT_TYPE_CONFIGURABLE : $this->exportConfigurable($TData); break; From 8f03813aa9eda51aa29f1ef88f51e0a761808531 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 16 Oct 2019 16:26:00 +0200 Subject: [PATCH 210/409] Phone layout and functional improvements --- htdocs/takepos/css/phone.css | 81 +++++++++++++++ htdocs/takepos/invoice.php | 48 ++++----- htdocs/takepos/phone.php | 190 +++++++++++++++++++++++++++++++++++ htdocs/takepos/takepos.php | 2 +- 4 files changed, 291 insertions(+), 30 deletions(-) create mode 100644 htdocs/takepos/css/phone.css create mode 100644 htdocs/takepos/phone.php diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css new file mode 100644 index 00000000000..49d833ade17 --- /dev/null +++ b/htdocs/takepos/css/phone.css @@ -0,0 +1,81 @@ +html,body { + box-sizing: border-box; + padding:3px; + margin:0; + height:100%; + width:100%; +} + +.container{ + width: 100%; + height: 100%; + margin: 0 auto; + overflow: visible; + box-sizing: border-box; +} + +.phonerow1{ + margin: 0 auto; + width: 100%; + height: 40%; + min-height: 40%; +} + +.phonerow2{ + margin: 0 auto; + width: 100%; + height: 40%; +} + +.phonebuttonsrow{ + margin: 0 auto; + width: 100%; + height: 5%; +} + +.phonediv1{ + height:100%; + min-height: 100%; + width: 100%; + text-align: center; + box-sizing: border-box; + overflow: auto; + padding-top: 0; + padding-bottom: 10px; + padding-right: 5px; + padding-left: 5px; +} + +.phonediv2{ + height: 100%; + width: 100%; + box-sizing: border-box; + padding-top: 0; + padding-bottom: 10px; + padding-right: 5px; + padding-left: 5px; +} + +.phonediv3{ + height: 100%; + width: 100%; + box-sizing: border-box; + padding-top: 0; + padding-bottom: 10px; + padding-right: 5px; + padding-left: 5px; +} + +button.phonebutton { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ + width:24%; + height:90%; + font-weight: bold; +} diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 1511d3520a1..a2c92aa13e4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -570,13 +570,19 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) $label = $obj->label; $floor = $obj->floor; } - print $langs->trans('Place')." ".$label." - "; - print $langs->trans('Floor')." ".$floor." - "; + // In phone version only show when is invoice page + if ($mobilepage=="invoice" || $mobilepage=="") { + print $langs->trans('Place') . " " . $label . " - "; + print $langs->trans('Floor') . " " . $floor . " - "; + } +} +// In phone version only show when is invoice page +if ($mobilepage=="invoice" || $mobilepage=="") { + print $langs->trans('TotalTTC'); + print ' : ' . price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency) . ''; + print '
' . $sectionwithinvoicelink; + print ''; } -print $langs->trans('TotalTTC'); -print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; -print '
'.$sectionwithinvoicelink; -print ''; if ($_SESSION["basiclayout"]!=1) { print '' . $langs->trans('ReductionShort') . ''; @@ -595,16 +601,14 @@ if ($_SESSION["basiclayout"]==1) $htmlforlines = ''; foreach ($categories as $row){ $htmlforlines.= ''; + $htmlforlines.= '" onclick="LoadProducts(' . $row['id'] . ');">'; $htmlforlines.= ''; $htmlforlines.= $row['label']; $htmlforlines.= ''; $htmlforlines.= ''."\n"; } $htmlforlines.= ''; - $htmlforlines.= '
'; - $htmlforlines.= ''.$langs->trans("Floors").''; - $htmlforlines.= '
'; + $htmlforlines.= ''; print $htmlforlines; } @@ -618,17 +622,13 @@ if ($_SESSION["basiclayout"]==1) $htmlforlines = ''; foreach ($prods as $row) { $htmlforlines.= ''; + $htmlforlines.= '" onclick="AddProduct(\'' . $place . '\', ' . $row->id . ')">'; $htmlforlines.= ''; $htmlforlines.= $row->label; $htmlforlines.= ''; $htmlforlines.= ''."\n"; } $htmlforlines.= ''; - $htmlforlines.= '
'; - $htmlforlines.= ''.$langs->trans("Categories").''; - $htmlforlines.= ''.$langs->trans("Floors").''; - $htmlforlines.= '
'; print $htmlforlines; } @@ -641,24 +641,22 @@ if ($_SESSION["basiclayout"]==1) while($row = $db->fetch_array($resql)){ $rows[] = $row; $htmlforlines.= ''; + $htmlforlines.= '" onclick="LoadPlace(\'' . $row['label'] . '\')">'; $htmlforlines.= ''; $htmlforlines.= $row['label']; $htmlforlines.= ''; $htmlforlines.= ''."\n"; } $htmlforlines.= ''; - $htmlforlines.= '
'; - $htmlforlines.= ''.$langs->trans("Categories").''; - $htmlforlines.= ''.$langs->trans("Floors").''; - $htmlforlines.= '
'; print $htmlforlines; } } if ($placeid > 0) { - if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice") return; + //In Phone basic layout hide some content depends situation + if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice" && $action!="order") return; + if (is_array($invoice->lines) && count($invoice->lines)) { $tmplines = array_reverse($invoice->lines); @@ -716,14 +714,6 @@ else { // No invoice generated yet print ''; -if ($_SESSION["basiclayout"]==1 && $mobilepage=="invoice") -{ - print ''; -} - if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) { $soc = new Societe($db); diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php new file mode 100644 index 00000000000..2bd21626f34 --- /dev/null +++ b/htdocs/takepos/phone.php @@ -0,0 +1,190 @@ + + * + * 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/takepos/phone.php + * \ingroup takepos + * \brief TakePOS Phone screen + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$action = GETPOST('action', 'alpha'); +$setterminal = GETPOST('setterminal', 'int'); + +if ($setterminal>0) +{ + $_SESSION["takeposterminal"]=$setterminal; +} + +$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter")); + +/* + * View + */ + +// Title +$title='TakePOS - Dolibarr '.DOL_VERSION; +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; +$head=' + + +'; +top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); + +?> + + + + +global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="") print '
'.$langs->trans('TerminalSelect').'
'; +?> +
+
+ + + + +
+
+
+
+
+
+
+
+ +close(); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index c49479c7ce1..7ff588b12c0 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -63,7 +63,7 @@ if ($conf->browser->layout == 'phone') if ($_SESSION["takeposterminal"]!="" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1) { $_SESSION["basiclayout"]=1; - header("Location: invoice.php?mobilepage=invoice"); + header("Location: phone.php?mobilepage=invoice"); exit; } } From 43ce1543d8f482d9cf4125e9bbbe915b201eade8 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Wed, 16 Oct 2019 17:37:20 +0200 Subject: [PATCH 211/409] Fix width unit label in product import --- htdocs/core/modules/modProduct.class.php | 2 +- htdocs/core/modules/modService.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 2b41a76ea45..f3b3cde38e5 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -383,7 +383,7 @@ class modProduct extends DolibarrModules 'p.length' => "Length", 'p.length_units' => "LengthUnit", 'p.width' => "Width", - 'p.width_units' => "VolumeUnits", + 'p.width_units' => "WidthUnits", 'p.height' => "Height", 'p.height_units' => "HeightUnit", 'p.surface' => "Surface", diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 2f3e62903a4..20db49d5e69 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -360,7 +360,7 @@ class modService extends DolibarrModules 'p.length' => "Length", 'p.length_units' => "LengthUnit", 'p.width' => "Width", - 'p.width_units' => "VolumeUnits", + 'p.width_units' => "WidthUnits", 'p.height' => "Height", 'p.height_units' => "HeightUnit", 'p.surface' => "Surface", From 205967976cbc53ec91506ff8b73974c127f59f17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 18:35:15 +0200 Subject: [PATCH 212/409] Can set a BOM to draft --- htdocs/bom/bom_card.php | 23 ++++++++----------- htdocs/core/actions_addupdatedelete.inc.php | 14 +++++++++++ htdocs/core/boxes/box_task.php | 1 - .../modulebuilder/template/myobject_card.php | 8 +++++-- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 8e6551e92ea..0949fa1a334 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -405,20 +405,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Confirmation of action xxxx - if ($action == 'xxx') + if ($action == 'setdraft') { + $text = $langs->trans('ConfirmSetToDraft', $object->ref); + $formquestion=array(); - /* - $forcecombo=0; - if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) - ); - */ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220); } // Call Hook formConfirm @@ -568,6 +560,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Send //print '' . $langs->trans('SendMail') . ''."\n"; + if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED) + { + print '' . $langs->trans("SetToDraft") . ''; + } + // Modify if ($user->rights->bom->write) { @@ -594,7 +591,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Close / Cancel if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED) { - print '' . $langs->trans("Disable") . ''; + print '' . $langs->trans("Disable") . ''; } // Re-open diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 7082bc5e882..e87333e4c01 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -289,6 +289,20 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissionedit) } } +// Action setdraft object +if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissionedit) +{ + $result = $object->setDraft($user); + if ($result >= 0) + { + // Nothing else done + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + // Action reopen object if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissionedit) { diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index dbe1757d55d..67ed84c0797 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -201,7 +201,6 @@ class box_task extends ModeleBoxes dol_print_error($this->db); } } - } /** diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index c443641ffd6..5727d596a6d 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -114,8 +114,6 @@ $permissiontoadd=$user->rights->mymodule->write; // Used by the include of actio /* * Actions - * - * Put here all code to do according to value of "action" parameter */ $parameters=array(); @@ -437,6 +435,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Send print '' . $langs->trans('SendMail') . ''."\n"; + // Back to draft + if (! empty($user->rights->mymodule->write) && $object->status == BOM::STATUS_VALIDATED) + { + print '' . $langs->trans("SetToDraft") . ''; + } + // Modify if (! empty($user->rights->mymodule->write)) { From 012ddd1cdcff471134e3cee971850c475ee8b71e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 18:37:26 +0200 Subject: [PATCH 213/409] Fix bom --- htdocs/bom/class/bom.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d8e5387f075..9b2646b3e9d 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -95,8 +95,8 @@ class BOM extends CommonObject 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), From 41dd53170e8d9c6744098ed8d57f5b901444845a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 19:07:17 +0200 Subject: [PATCH 214/409] Code comment --- htdocs/core/class/conf.class.php | 2 +- htdocs/main.inc.php | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 287d8121213..72aa4bc4265 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -227,7 +227,7 @@ class Conf $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); foreach ($filesList as $file) { $file=dol_sanitizeFileName($file); - include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file must set $this->global->XXX vars. + include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file can run code like setting $this->global->XXX vars. } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b7bef1aa46a..4fc94feb1f4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1926,8 +1926,6 @@ function top_menu_bookmark(User $user, Translate $langs) global $menumanager; $html = ''; - - // Define $bookmarks if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) { @@ -2015,7 +2013,6 @@ function top_menu_search(User $user, Translate $langs) $buttonList.=''; - $searchInput = ''; @@ -2105,7 +2102,6 @@ function top_menu_search(User $user, Translate $langs) '; - return $html; } From 8a7a0b80e2728d910fcf8cdffce1742cf89af5e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2019 19:08:31 +0200 Subject: [PATCH 215/409] Fix remove warnings --- htdocs/core/class/conf.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e3b6ac4e524..c595dd17938 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -226,10 +226,7 @@ class Conf $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); foreach ($filesList as $file) { $file=dol_sanitizeFileName($file); - include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; - foreach ($file2bddconsts as $key=>$value) { - $this->global->$key=$value; - } + include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file can run code like setting $this->global->XXX vars. } } From e75f7d448c13d789e2c9156d10d65b531d42767b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 16 Oct 2019 20:00:01 +0200 Subject: [PATCH 216/409] Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen --- dev/initdata/generate-thirdparty.php | 1 - dev/setup/codesniffer/ruleset.xml | 12 ++++--- htdocs/accountancy/admin/accountmodel.php | 1 - htdocs/accountancy/admin/card.php | 1 - htdocs/accountancy/admin/categories.php | 2 -- htdocs/accountancy/admin/categories_list.php | 7 ++-- htdocs/accountancy/admin/closure.php | 1 - htdocs/accountancy/admin/defaultaccounts.php | 3 -- htdocs/accountancy/admin/export.php | 3 +- htdocs/accountancy/admin/journals_list.php | 1 - htdocs/accountancy/admin/productaccount.php | 2 -- .../bookkeeping/balancebymonth.php | 1 - htdocs/accountancy/bookkeeping/card.php | 3 -- htdocs/accountancy/bookkeeping/list.php | 5 --- .../accountancy/bookkeeping/listbyaccount.php | 3 -- .../thirdparty_lettering_customer.php | 2 -- .../thirdparty_lettering_supplier.php | 2 -- .../class/accountancyexport.class.php | 5 --- .../class/accountingaccount.class.php | 1 - .../accountancy/class/bookkeeping.class.php | 2 -- htdocs/accountancy/class/lettering.class.php | 1 - htdocs/accountancy/customer/card.php | 1 - htdocs/accountancy/customer/index.php | 4 --- htdocs/accountancy/expensereport/index.php | 3 -- htdocs/accountancy/journal/bankjournal.php | 3 -- .../journal/expensereportsjournal.php | 2 -- .../accountancy/journal/purchasesjournal.php | 2 -- htdocs/accountancy/journal/sellsjournal.php | 2 -- htdocs/accountancy/supplier/index.php | 3 -- htdocs/adherents/class/adherent.class.php | 1 - .../adherents/class/adherent_type.class.php | 1 - htdocs/adherents/document.php | 1 - .../adherents/tpl/linkedobjectblock.tpl.php | 1 - htdocs/adherents/type.php | 1 - htdocs/admin/agenda_other.php | 2 -- htdocs/admin/bank.php | 2 -- htdocs/admin/barcode.php | 3 -- htdocs/admin/bom.php | 2 -- htdocs/admin/boxes.php | 1 - htdocs/admin/commande.php | 3 -- htdocs/admin/company.php | 7 ---- htdocs/admin/compta.php | 1 - htdocs/admin/const.php | 1 - htdocs/admin/contract.php | 3 -- htdocs/admin/delais.php | 8 ----- htdocs/admin/dict.php | 1 - .../admin/dolistore/class/dolistore.class.php | 1 - htdocs/admin/expedition.php | 1 - htdocs/admin/expensereport.php | 3 -- htdocs/admin/external_rss.php | 1 - htdocs/admin/facture.php | 1 - htdocs/admin/fichinter.php | 3 -- htdocs/admin/holiday.php | 3 -- htdocs/admin/limits.php | 1 - htdocs/admin/livraison.php | 2 -- htdocs/admin/mails.php | 2 -- htdocs/admin/mails_emailing.php | 1 - htdocs/admin/menus/edit.php | 1 - htdocs/admin/modules.php | 1 - htdocs/admin/notification.php | 2 -- htdocs/admin/oauthlogintokens.php | 2 -- htdocs/admin/propal.php | 2 -- htdocs/admin/reception_setup.php | 1 - htdocs/admin/security.php | 2 -- htdocs/admin/sms.php | 1 - htdocs/admin/supplier_invoice.php | 2 -- htdocs/admin/supplier_order.php | 1 - htdocs/admin/supplier_payment.php | 2 -- htdocs/admin/supplier_proposal.php | 4 --- htdocs/admin/syslog.php | 1 - htdocs/admin/system/database-tables.php | 1 - htdocs/admin/ticket.php | 1 - htdocs/admin/translation.php | 2 -- htdocs/admin/user.php | 1 - htdocs/admin/usergroup.php | 1 - htdocs/admin/website.php | 1 - htdocs/asset/type.php | 1 - htdocs/barcode/printsheet.php | 1 - htdocs/blockedlog/admin/blockedlog_list.php | 1 - htdocs/blockedlog/ajax/authority.php | 2 -- htdocs/blockedlog/class/authority.class.php | 3 -- htdocs/blockedlog/class/blockedlog.class.php | 3 -- htdocs/bom/class/bom.class.php | 1 - htdocs/bookmarks/bookmarks.lib.php | 1 - htdocs/bookmarks/card.php | 1 - htdocs/cashdesk/admin/cashdesk.php | 2 -- htdocs/cashdesk/class/Facturation.class.php | 33 ------------------- htdocs/cashdesk/facturation.php | 2 -- htdocs/cashdesk/tpl/liste_articles.tpl.php | 2 -- htdocs/cashdesk/tpl/validation1.tpl.php | 5 --- htdocs/categories/class/categorie.class.php | 1 - htdocs/categories/photos.php | 1 - htdocs/categories/viewcat.php | 2 -- htdocs/comm/action/card.php | 1 - htdocs/comm/action/peruser.php | 2 -- htdocs/comm/action/rapport/index.php | 1 - htdocs/comm/index.php | 4 --- htdocs/comm/mailing/advtargetemailing.php | 8 ----- .../mailing/class/advtargetemailing.class.php | 8 ----- .../html.formadvtargetemailing.class.php | 8 ----- htdocs/comm/mailing/class/mailing.class.php | 2 -- htdocs/comm/propal/card.php | 1 - htdocs/comm/propal/class/propal.class.php | 3 -- htdocs/comm/propal/index.php | 1 - htdocs/comm/prospect/index.php | 1 - htdocs/commande/card.php | 1 - htdocs/commande/class/commande.class.php | 3 -- htdocs/commande/index.php | 5 --- htdocs/compta/accounting-files.php | 1 - htdocs/compta/bank/annuel.php | 1 - htdocs/compta/bank/bankentries_list.php | 4 --- htdocs/compta/bank/card.php | 1 - htdocs/compta/bank/categ.php | 3 -- htdocs/compta/bank/class/account.class.php | 2 -- htdocs/compta/bank/document.php | 1 - htdocs/compta/facture/card.php | 5 --- .../facture/class/facture-rec.class.php | 1 - htdocs/compta/facture/class/facture.class.php | 4 --- htdocs/compta/facture/list.php | 1 - htdocs/compta/localtax/card.php | 1 - htdocs/compta/localtax/clients.php | 2 -- htdocs/compta/paiement/cheque/card.php | 1 - .../cheque/class/remisecheque.class.php | 2 -- .../compta/paiement/class/paiement.class.php | 4 --- htdocs/compta/paiement/rapport.php | 1 - htdocs/compta/paiement_charge.php | 1 - .../class/bonprelevement.class.php | 2 -- htdocs/compta/recap-compta.php | 2 -- htdocs/compta/resultat/result.php | 1 - htdocs/compta/sociales/card.php | 1 - .../class/paymentsocialcontribution.class.php | 1 - htdocs/compta/stats/byratecountry.php | 5 --- htdocs/compta/stats/cabyprodserv.php | 5 --- htdocs/compta/stats/cabyuser.php | 5 --- htdocs/compta/stats/casoc.php | 5 --- htdocs/compta/tva/clients.php | 1 - htdocs/contact/class/contact.class.php | 1 - htdocs/contact/consumption.php | 2 -- htdocs/contrat/card.php | 1 - htdocs/contrat/class/contrat.class.php | 4 --- htdocs/contrat/index.php | 1 - htdocs/core/actions_builddoc.inc.php | 1 - htdocs/core/actions_massactions.inc.php | 2 -- htdocs/core/ajax/ajaxdirtree.php | 1 - htdocs/core/ajax/check_notifications.php | 1 - htdocs/core/ajax/price.php | 2 -- htdocs/core/ajax/ziptown.php | 1 - htdocs/core/boxes/box_activity.php | 1 - htdocs/core/boxes/box_goodcustomers.php | 1 - htdocs/core/boxes/box_project.php | 1 - htdocs/core/boxes/box_task.php | 1 - htdocs/core/class/CMailFile.class.php | 1 - htdocs/core/class/CSMSFile.class.php | 1 - .../core/class/commondocgenerator.class.php | 1 - htdocs/core/class/commonobject.class.php | 4 --- htdocs/core/class/discount.class.php | 1 - htdocs/core/class/extrafields.class.php | 2 -- htdocs/core/class/html.form.class.php | 1 - htdocs/core/class/html.formcron.class.php | 1 - htdocs/core/class/html.formother.class.php | 1 - htdocs/core/class/infobox.class.php | 1 - htdocs/core/class/link.class.php | 1 - htdocs/core/class/utils.class.php | 1 - htdocs/core/lib/bank.lib.php | 1 - htdocs/core/lib/functions.lib.php | 1 - htdocs/core/lib/functions2.lib.php | 1 - htdocs/core/lib/json.lib.php | 1 - htdocs/core/lib/ldap.lib.php | 1 - htdocs/core/lib/modulebuilder.lib.php | 1 - htdocs/core/lib/pdf.lib.php | 1 - htdocs/core/lib/product.lib.php | 1 - htdocs/core/lib/ticket.lib.php | 1 - htdocs/core/lib/usergroups.lib.php | 9 ----- .../expedition/doc/pdf_rouget.modules.php | 1 - .../facture/doc/pdf_sponge.modules.php | 4 --- .../modules/printing/printgcp.modules.php | 1 - .../modules/propale/doc/pdf_azur.modules.php | 2 -- .../modules/propale/doc/pdf_cyan.modules.php | 2 -- .../reception/doc/pdf_squille.modules.php | 3 -- .../modGeneratePassStandard.class.php | 1 - .../stock/doc/pdf_stdmovement.modules.php | 1 - htdocs/core/tpl/advtarget.tpl.php | 4 --- htdocs/core/tpl/contacts.tpl.php | 3 -- htdocs/core/tpl/object_discounts.tpl.php | 2 -- htdocs/core/tpl/objectline_create.tpl.php | 1 - htdocs/core/tpl/objectline_edit.tpl.php | 1 - htdocs/core/tpl/resource_view.tpl.php | 1 - .../interface_80_modStripe_Stripe.class.php | 1 - ...rface_90_modSociete_ContactRoles.class.php | 1 - ...face_99_modZapier_ZapierTriggers.class.php | 1 - .../class/actions_datapolicy.class.php | 5 --- .../datapolicy/class/datapolicycron.class.php | 1 - htdocs/datapolicy/mailing.php | 1 - htdocs/don/card.php | 4 --- htdocs/don/class/don.class.php | 1 - htdocs/don/class/paymentdonation.class.php | 1 - htdocs/don/index.php | 1 - htdocs/don/list.php | 1 - htdocs/don/payment/payment.php | 1 - htdocs/expedition/card.php | 1 - htdocs/expedition/class/expedition.class.php | 2 -- htdocs/expedition/note.php | 1 - .../class/expensereport.class.php | 4 --- htdocs/expensereport/export_csv.php | 2 -- .../tpl/linkedobjectblock.tpl.php | 1 - htdocs/fichinter/card-rec.php | 1 - htdocs/fichinter/class/fichinter.class.php | 4 --- .../class/fournisseur.commande.class.php | 4 --- .../fournisseur.commande.dispatch.class.php | 1 - .../fourn/class/fournisseur.facture.class.php | 2 -- .../fourn/class/fournisseur.product.class.php | 2 -- htdocs/fourn/class/paiementfourn.class.php | 1 - htdocs/fourn/commande/card.php | 2 -- htdocs/fourn/commande/dispatch.php | 2 -- htdocs/fourn/commande/index.php | 1 - htdocs/fourn/commande/list.php | 3 -- htdocs/fourn/commande/orderstoinvoice.php | 3 -- htdocs/fourn/facture/card.php | 1 - htdocs/fourn/facture/list.php | 1 - htdocs/fourn/index.php | 1 - htdocs/ftp/admin/ftpclient.php | 1 - htdocs/ftp/index.php | 1 - htdocs/holiday/card.php | 3 -- htdocs/holiday/class/holiday.class.php | 12 ------- htdocs/hrm/establishment/card.php | 1 - htdocs/imports/import.php | 2 -- htdocs/install/check.php | 2 -- htdocs/install/step1.php | 1 - htdocs/install/upgrade2.php | 2 -- htdocs/livraison/card.php | 2 -- htdocs/livraison/class/livraison.class.php | 1 - htdocs/loan/calcmens.php | 1 - htdocs/loan/createschedule.php | 4 --- htdocs/loan/schedule.php | 4 --- htdocs/margin/checkMargins.php | 1 - htdocs/margin/customerMargins.php | 1 - htdocs/margin/productMargins.php | 1 - htdocs/modulebuilder/index.php | 3 -- .../template/class/actions_mymodule.class.php | 2 -- .../template/class/myobject.class.php | 1 - ..._99_modMyModule_MyModuleTriggers.class.php | 1 - htdocs/mrp/class/mo.class.php | 1 - htdocs/opensurvey/card.php | 2 -- .../class/opensurveysondage.class.php | 1 - htdocs/opensurvey/results.php | 3 -- htdocs/opensurvey/wizard/choix_autre.php | 1 - htdocs/opensurvey/wizard/choix_date.php | 5 ++- htdocs/printing/admin/printing.php | 1 - htdocs/product/admin/price_rules.php | 4 --- htdocs/product/admin/product.php | 1 - htdocs/product/admin/product_tools.php | 1 - htdocs/product/ajax/products.php | 3 +- .../canvas/product/tpl/card_create.tpl.php | 1 - .../canvas/service/tpl/card_create.tpl.php | 1 - htdocs/product/card.php | 1 - htdocs/product/class/product.class.php | 3 -- htdocs/product/class/productbatch.class.php | 2 -- .../class/productcustomerprice.class.php | 9 ----- .../class/propalmergepdfproduct.class.php | 2 -- htdocs/product/document.php | 3 -- htdocs/product/price.php | 3 -- htdocs/product/reassort.php | 1 - htdocs/product/stock/card.php | 1 - htdocs/product/stock/class/entrepot.class.php | 1 - .../stock/class/mouvementstock.class.php | 1 - .../class/productstockentrepot.class.php | 1 - htdocs/product/stock/massstockmove.php | 2 -- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/product.php | 6 ---- htdocs/product/stock/productlot_document.php | 2 -- htdocs/product/stock/productlot_list.php | 1 - htdocs/projet/card.php | 1 - htdocs/projet/class/project.class.php | 1 - htdocs/projet/class/task.class.php | 2 -- htdocs/projet/element.php | 2 -- htdocs/projet/ganttview.php | 1 - htdocs/projet/graph_opportunities.inc.php | 1 - htdocs/projet/index.php | 1 - htdocs/public/donations/donateurs_code.php | 1 - htdocs/public/onlinesign/newonlinesign.php | 2 -- htdocs/public/opensurvey/studs.php | 1 - htdocs/public/payment/newpayment.php | 1 - htdocs/public/stripe/ipn.php | 4 --- htdocs/public/test/test_arrays.php | 1 - htdocs/public/ticket/create_ticket.php | 1 - htdocs/public/ticket/list.php | 1 - htdocs/reception/card.php | 2 -- htdocs/reception/class/reception.class.php | 1 - htdocs/reception/list.php | 2 -- htdocs/reception/note.php | 1 - .../class/html.formresource.class.php | 2 -- htdocs/resource/element_resource.php | 3 -- htdocs/salaries/card.php | 1 - htdocs/salaries/class/paymentsalary.class.php | 1 - htdocs/societe/card.php | 2 -- .../societe/class/api_thirdparties.class.php | 2 -- .../class/companybankaccount.class.php | 3 -- htdocs/societe/consumption.php | 2 -- htdocs/societe/paymentmodes.php | 4 --- htdocs/societe/price.php | 8 ----- htdocs/stripe/charge.php | 1 - htdocs/stripe/payment.php | 3 -- htdocs/stripe/payout.php | 1 - htdocs/stripe/transaction.php | 1 - htdocs/supplier_proposal/card.php | 2 -- .../class/supplier_proposal.class.php | 3 -- htdocs/support/inc.php | 1 - htdocs/takepos/admin/terminal.php | 1 - htdocs/theme/eldy/main_menu_fa_icons.inc.php | 1 - htdocs/theme/md/badges.inc.php | 1 - htdocs/ticket/index.php | 1 - htdocs/ticket/list.php | 1 - htdocs/user/card.php | 1 - htdocs/user/class/user.class.php | 1 - htdocs/user/class/userbankaccount.class.php | 1 - htdocs/user/clicktodial.php | 1 - htdocs/user/group/card.php | 1 - htdocs/user/notify/card.php | 1 - htdocs/user/passwordforgotten.php | 2 -- htdocs/variants/admin/admin.php | 1 - htdocs/variants/card.php | 9 ----- .../variants/class/ProductAttribute.class.php | 1 - .../class/ProductAttributeValue.class.php | 1 - .../class/ProductCombination.class.php | 6 ---- htdocs/variants/combinations.php | 12 ------- htdocs/variants/create.php | 1 - htdocs/variants/create_val.php | 1 - htdocs/variants/generator.php | 2 -- htdocs/webservices/server_actioncomm.php | 1 - htdocs/webservices/server_contact.php | 3 -- htdocs/webservices/server_invoice.php | 2 -- htdocs/webservices/server_order.php | 4 --- .../webservices/server_productorservice.php | 1 - htdocs/webservices/server_thirdparty.php | 2 -- htdocs/website/class/website.class.php | 1 - htdocs/website/index.php | 1 - .../accountancy/export-thirdpartyaccount.php | 1 - 337 files changed, 15 insertions(+), 710 deletions(-) diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 54e17c7f8d7..f1e0f4f360b 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -116,7 +116,6 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++) $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)]; if ( $contact->create($user) ) { - } } diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 6773e1d2c03..32c44ce91e4 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -122,14 +122,14 @@ - + 0 0 - + @@ -195,7 +195,7 @@ --> - + @@ -213,6 +213,8 @@ 0 + + @@ -337,7 +339,7 @@ - @@ -375,7 +377,7 @@ 0 - + 0 diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 06a2fb60d67..2f23cd3eae8 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -677,7 +677,6 @@ if ($id) { foreach ($fieldlist as $field => $value) { - $showfield=1; $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index c49ed42741b..f54c477ff52 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -273,7 +273,6 @@ if ($action == 'create') { print ''; } elseif ($id > 0 || $ref) { - $result = $object->fetch($id, $ref, 1); if ($result > 0) { diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index a7fe40acefc..5fdd43eb020 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -130,7 +130,6 @@ if (! empty($cat_id)) } if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { - print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%"); print '
'; /*print ''; print ''; foreach ($list_account_main as $key) { - print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 13d3a267956..6b47578761c 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -83,7 +83,6 @@ if (GETPOST('change_chart', 'alpha')) $chartofaccounts = GETPOST('chartofaccounts', 'int'); if (! empty($chartofaccounts)) { - if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { $error ++; } @@ -144,7 +143,6 @@ print ''; print '
'; foreach ($list_account_main as $key) { - print ''; // Param $label = $langs->trans($key); @@ -172,7 +170,6 @@ print '
'; print '
'; foreach ($list_account as $key) { - print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index e13a66998b7..e506f5bf512 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -114,7 +114,7 @@ if ($action == 'update') { $error ++; } } - } + } if (! $error) { // reload @@ -203,7 +203,6 @@ print "\n"; $num = count($main_option); if ($num) { foreach ($main_option as $key) { - print ''; // Param diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index fcdf4de032c..44fe3e936cd 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -609,7 +609,6 @@ if ($id) $langs->load("accountancy"); foreach ($fieldlist as $field => $value) { - $showfield=1; $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 2922d3bdf23..091018dc909 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -117,7 +117,6 @@ if ($action == 'update') { ); if (in_array($accounting_product_mode, $accounting_product_modes)) { - if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) { $error ++; } @@ -129,7 +128,6 @@ if ($action == 'update') { if (! empty($btn_changeaccount)) { //$msg = '
' . $langs->trans("Processing") . '...
'; if (! empty($chk_prod)) { - $accounting = new AccountingAccount($db); //$msg .= '
' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '
'; diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index d0e9b940074..bdc78911513 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -105,7 +105,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $i < $num ) { - $row = $db->fetch_row($resql); print ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 5f9ba37d341..cc6307bae2c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -83,7 +83,6 @@ $object = new BookKeeping($db); */ if ($action == "confirm_update") { - $error = 0; if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { @@ -585,7 +584,6 @@ if ($action == 'create') if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print ''; @@ -601,7 +599,6 @@ if ($action == 'create') print "
' . length_accountg($row[0]) . '
"; if (count($object->linesmvt) > 0) { - $total_debit = 0; $total_credit = 0; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b14a118a342..5158e12ebb6 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -316,7 +316,6 @@ if (empty($reshook)) } if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { - $import_key = GETPOST('importkey', 'alpha'); if (! empty($import_key)) { @@ -331,7 +330,6 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri } } if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { - $delyear = GETPOST('delyear', 'int'); if ($delyear==-1) { $delyear=0; @@ -362,7 +360,6 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme } } if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) { - $mvt_num = GETPOST('mvt_num', 'int'); if (! empty($mvt_num)) { @@ -468,7 +465,6 @@ if (! empty($sortfield)) { // Export into a file with format defined into setup (FEC, CSV, ...) // Must be after definition of $sql if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { - // TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them. $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); @@ -578,7 +574,6 @@ if ($action == 'delmouv') { print $formconfirm; } if ($action == 'delbookkeepingyear') { - $form_question = array (); $delyear = GETPOST('delyear'); $deljournal = GETPOST('deljournal'); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d91772a6ab3..4f275e3e2b0 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -179,7 +179,6 @@ if (! empty($search_credit)) { if ($action == 'delmouvconfirm') { - $mvt_num = GETPOST('mvt_num', 'int'); if (! empty($mvt_num)) { @@ -229,7 +228,6 @@ if ($action == 'delmouv') { print $formconfirm; } if ($action == 'delbookkeepingyear') { - $form_question = array (); $delyear = GETPOST('delyear'); @@ -338,7 +336,6 @@ while ($i < min($num, $limit)) // Is it a break ? if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) { - // Affiche un Sous-Total par compte comptable if (isset($displayed_account_number)) { print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index b7a19101758..4bc60fc904f 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -100,7 +100,6 @@ if ($result < 0) */ if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); if ($result < 0) { @@ -251,7 +250,6 @@ if ($resql) { $tmp = ''; while ( $obj = $db->fetch_object($resql) ) { - if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index eaa741e1722..df513f8d074 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -99,7 +99,6 @@ if ($result<0) * Action */ if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); if ($result < 0) { @@ -248,7 +247,6 @@ if ($resql) { $solde = 0; $tmp = ''; while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 84a851eea50..7e8f14f2a53 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -549,7 +549,6 @@ class AccountancyExport $end_line = "\n"; foreach ($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->id . $separator; @@ -585,7 +584,6 @@ class AccountancyExport $end_line = "\n"; foreach ($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->piece_num . $separator; @@ -625,7 +623,6 @@ class AccountancyExport $end_line = "\n"; foreach ($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%d/%m/%Y'); print $date . $separator; @@ -934,7 +931,6 @@ class AccountancyExport $end_line = "\r\n"; foreach ($objectLines as $line) { - $date_document = dol_print_date($line->doc_date, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); @@ -1087,7 +1083,6 @@ class AccountancyExport print $end_line; foreach($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%Y%m%d'); print $date . $separator; //Date diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index f9c2e3391ba..21cbdeb9662 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -407,7 +407,6 @@ class AccountingAccount extends CommonObject $result = $this->checkUsage(); if ($result > 0) { - $this->db->begin(); // if (! $error) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 16dc458d833..24d2936680a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1584,9 +1584,7 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - while ($obj = $this->db->fetch_object($result)) { - $line = new BookKeepingLine(); $line->id = $obj->rowid; diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index e20b49dbd25..ef63fc8b15f 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -149,7 +149,6 @@ class Lettering extends BookKeeping } } } elseif ($obj->type == 'payment') { - $sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id'; $sql .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 52057485a30..00c4a945ff9 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -112,7 +112,6 @@ if (! empty($id)) { $i = 0; if ($num_lines) { - $objp = $db->fetch_object($result); print '' . "\n"; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 68649aa264d..f43ca801c25 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -97,7 +97,6 @@ if ($action == 'clean' || $action == 'validatehistory') } if ($action == 'validatehistory') { - $error = 0; $db->begin(); @@ -195,7 +194,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; for($i = 1; $i <= 12; $i ++) { print ''; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index d3fc63d3bf8..ea855921c5a 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -94,7 +94,6 @@ if ($action == 'clean' || $action == 'validatehistory') } if ($action == 'validatehistory') { - $error = 0; $db->begin(); @@ -187,7 +186,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ' diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index b24e3361d16..2848ed4119e 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -94,7 +94,6 @@ $hookmanager->initHooks(array('membertypecard','globalcard')); */ if ($cancel) { - $action=''; if (! empty($backtopage)) { diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index a13b7bd1580..3caa3418af5 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -268,7 +268,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Active if (in_array($name, $def)) { - print ''."\n"; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 689202c023d..70b273e2fcc 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -253,7 +253,6 @@ $i = 0; $nbofbank = count($bankorder); while ($i < $nbofbank) { - print ''; print ''; // Chemin du binaire genbarcode sous linux if (! isset($_SERVER['WINDIR'])) { - print ''; print ''; print ''; print ''; print ''; print ''; print ''; @@ -381,7 +380,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index ca90c836929..1e158bc7a7f 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -474,7 +474,6 @@ print ''; // Activate FileCache - Developement if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { - print ''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index cb07d741a06..5bb2dbe79ed 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -282,7 +282,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -299,7 +298,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''; @@ -423,7 +421,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index dde962fe9bc..e6ea9a2cb17 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -470,7 +470,6 @@ print ''."\n"; // Barcode if (! empty($conf->barcode->enabled)) { - print ''; print ''; @@ -555,7 +554,6 @@ print ''; // ProfID1 if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { - print ''; @@ -359,7 +357,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index d69a14deb2e..7e724c52280 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -265,7 +265,6 @@ print '
'; print ''.$langs->trans("DescWeather").' '; if($action == 'edit') { - $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; @@ -292,8 +291,6 @@ $text=''; $options='class="valignmiddle" height="60px"'; if ($action == 'edit') { - - print '
global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; print '
'; @@ -364,9 +361,7 @@ if ($action == 'edit') { global->MAIN_USE_METEO_WITH_PERCENTAGE)) { - print '
'; print '
'; print img_weather($text, 0, $options); @@ -386,7 +381,6 @@ if ($action == 'edit') { print '
'; print '
'; } else { - print '
'; print '
'; print img_weather($text, 0, $options); @@ -411,11 +405,9 @@ if ($action == 'edit') { print '
'; if($action == 'edit') { - print '
'; print '
'; } else { - print '
'; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 31ade656480..501a6d18113 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1728,7 +1728,6 @@ else { if ($showemptyline) { - print '
'; $showemptyline=0; } diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 4951f57c22f..e65eb2bbb0a 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -226,7 +226,6 @@ class Dolistore $html .= self::get_categories($cat->id); $html .= "\n"; } else { - } } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index e8dbfab9942..29ef6d40a1e 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -366,7 +366,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 8dde3449b6e..8a5cef82ceb 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -247,7 +247,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''; @@ -367,10 +366,8 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index d16f3e493f5..e3adeaca890 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -300,7 +300,6 @@ if ($resql) // Logo if ($result > 0 && empty($rss->error)) { - print ''; print ""; print ''; @@ -303,7 +302,6 @@ print '
'; if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - /* * Documents models for Holidays */ @@ -369,7 +367,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index ea19b7034a6..27f99ecb4f1 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -172,7 +172,6 @@ if (empty($mysoc->country_code)) } else { - // Show examples print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 1f8a74f6eb8..99cd481095b 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -356,8 +356,6 @@ foreach ($dirmodels as $reldir) { if (file_exists($dir.'/'.$file)) { - - $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index ff2b788a026..79d152fb7bf 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -364,7 +364,6 @@ if ($action == 'edit') // ID if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { - $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:''); print ''; print ''; print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 4c8f4188e4b..db9efb0e5c7 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -294,7 +294,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''; @@ -596,7 +595,6 @@ if (empty($conf->facture->enabled)) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).'
'; if ($row[0] == 'tobind') { @@ -271,7 +269,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print '
'; if ($row[0] == 'tobind') { @@ -398,7 +395,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. $num = $db->num_rows($resql); while ($row = $db->fetch_row($resql)) { - print '
' . $row[0] . '' . price(price2num($row[$i])) . '
'; if ($row[0] == 'tobind') { @@ -259,7 +257,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print '
'; if ($row[0] == 'tobind') { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 2dd4f845c39..6e709835f42 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -167,7 +167,6 @@ $journal_label = $accountingjournalstatic->label; dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); //print $sql; @@ -268,10 +267,8 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { - // Now loop on each link of record in bank. foreach ($links as $key => $val) { - if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 23d97360563..6cefc893b39 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -115,7 +115,6 @@ $sql .= " ORDER BY er.date_debut"; dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { - $taber = array (); $tabht = array (); $tabtva = array (); @@ -485,7 +484,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("ExpenseReportsJournal")); $nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c83c004c6b2..ddf456c85f0 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -242,7 +242,6 @@ if ($action == 'writebookkeeping') { $invoicestatic = new FactureFournisseur($db); foreach ($tabfac as $key => $val) { // Loop on each invoice - $errorforline = 0; $totalcredit = 0; @@ -716,7 +715,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("PurchasesJournal")); $nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 17b2657b5dc..ed56065df0a 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -255,7 +255,6 @@ if ($action == 'writebookkeeping') { $invoicestatic = new Facture($db); foreach ($tabfac as $key => $val) { // Loop on each invoice - $errorforline = 0; $totalcredit = 0; @@ -654,7 +653,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("SellsJournal")); $nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 88a599d1fc5..faa48ac9176 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -95,7 +95,6 @@ if ($action == 'clean' || $action == 'validatehistory') } if ($action == 'validatehistory') { - $error = 0; $db->begin(); @@ -187,7 +186,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print '
'; if ($row[0] == 'tobind') { @@ -258,7 +256,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print '
'; if ($row[0] == 'tobind') { diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2bcbc21c3a0..e9bd50de0ff 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2370,7 +2370,6 @@ class Adherent extends CommonObject $langs->load("orders"); if (! dol_strlen($modele)) { - $modele = 'standard'; if ($this->modelpdf) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index a57a90a3aac..94df4b10ba0 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -383,7 +383,6 @@ class AdherentType extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->description = $this->db->escape($this->note); // Multilangs diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 092827ef731..a6343596632 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -90,7 +90,6 @@ if ($id > 0) $result=$membert->fetch($object->typeid); if ($result > 0) { - // Build file list $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); $totalsize=0; diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 4334a54605b..8e2ec3ba730 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -39,7 +39,6 @@ $langs->load("members"); $total=0; foreach($linkedObjectBlock as $key => $objectlink) { - ?>
trans("Subscription"); ?>'."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { @@ -363,7 +362,6 @@ print '
'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'
' . $bankorder[$i][0] . "\n"; print $bankorder[$i][1]; @@ -341,7 +340,6 @@ foreach ($dirmodels as $reldir) { foreach ($filelist as $file) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir . '/' . $file)) { $name = substr($file, 4, dol_strlen($file) - 16); $classname = substr($file, 0, dol_strlen($file) - 12); diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 0475cdfccf1..b6c9a5dec9a 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -319,7 +319,6 @@ print '
'.$langs->trans("GenbarcodeLocation").''; @@ -335,7 +334,6 @@ if (! isset($_SERVER['WINDIR'])) // Module products if (! empty($conf->product->enabled)) { - print '
'.$langs->trans("SetDefaultBarcodeTypeProducts").''; @@ -346,7 +344,6 @@ if (! empty($conf->product->enabled)) // Module thirdparty if (! empty($conf->societe->enabled)) { - print '
'.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index e5e12d41808..5bf01de1053 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -255,7 +255,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print '
'.$module->name."\n"; print $module->info(); print '
'.$langs->trans("EnableFileCache").''; print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1); print '
'.$module->name."\n"; print $module->info(); print '
'; print '
'; if (! empty($mysoc->country_code)) { @@ -571,7 +569,6 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') // ProfId2 if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { - print '
'; if (! empty($mysoc->country_code)) { @@ -587,7 +584,6 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') // ProfId3 if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { - print '
'; if (! empty($mysoc->country_code)) { @@ -603,7 +599,6 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') // ProfId4 if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { - print '
'; if (! empty($mysoc->country_code)) { @@ -619,7 +614,6 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') // ProfId5 if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { - print '
'; if (! empty($mysoc->country_code)) { @@ -635,7 +629,6 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') // ProfId6 if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { - print '
'; if (! empty($mysoc->country_code)) { diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index bb2bfdde409..0955d7c6d17 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -68,7 +68,6 @@ if ($action == 'update') if (in_array($accounting_mode, $accounting_modes)) { - if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { $error++; } diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 53555a35586..37559c3d4ab 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -118,7 +118,6 @@ if (! empty($consts) && $action == 'update') // Mass delete if (! empty($consts) && $action == 'delete') { - $nbdeleted=0; foreach($consts as $const) { diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index e6c8c15c0d4..0aa97dd36e6 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -219,7 +219,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -236,7 +235,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print '
'.$module->nom."\n"; print $module->info(); print '
   
'.$module->nom."\n"; print $module->info(); print '
".$langs->trans("Logo")."'; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 759038930ef..dccfcdfdda1 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -720,7 +720,6 @@ if ($resql) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); print '
'.$module->nom."\n"; print $module->info(); print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only @@ -384,7 +383,6 @@ if ($action == 'edit') // PW if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { - $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); print '
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 3d6cfc2d228..94f3820c5b9 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -316,7 +316,6 @@ if ($action == 'edit') // ID if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { - $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING:''); print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 43888d3e061..5a54a9e5c9f 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -323,7 +323,6 @@ if ($action == 'create') $res = $db->query($sql); if ($res) { - while ($menu = $db->fetch_array($res)) { $parent_rowid = $menu['rowid']; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index f26e657679a..687c3750c89 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -729,7 +729,6 @@ if ($mode == 'common') print ''; } else { - print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index cc1d53d14f8..6d1a5c57cf6 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -164,7 +164,6 @@ print ''; $i=0; foreach($listofnotifiedevents as $notifiedevent) { - $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); @@ -209,7 +208,6 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); foreach($listofnotifiedevents as $notifiedevent) { - $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 20c0ae222eb..bb3c83c2ee2 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -122,7 +122,6 @@ dol_fiche_head($head, 'tokengeneration', '', -1, 'technic'); if ($mode == 'setup' && $user->admin) { - print $langs->trans("OAuthSetupForLogin")."

\n"; foreach($list as $key) @@ -381,7 +380,6 @@ if ($mode == 'userconf' && $user->admin) $sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid'; $resql = $db->query($sql); while ($row=$db->fetch_array($resql)) { - print '
'.$row['login'].''.$row['module'].'
'.$module->nom."\n"; print $module->info(); print '
'; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 73cad8f69ad..833d6c25d22 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -207,7 +207,6 @@ if ($action == 'edit') } else { - if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine", 'DoliStore').'
'; print '
'; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 27a126c7ef6..9cb387aedc9 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -237,7 +237,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { if (substr($file, 0, 24) == 'mod_facture_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -365,7 +364,6 @@ foreach ($dirmodels as $reldir) if (is_dir($dir)) { - $handle=opendir($dir); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index ac7d5e98539..6369efb1361 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -267,7 +267,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php') diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 65bb18fcc5f..8da430a9fa1 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -213,7 +213,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) @@ -337,7 +336,6 @@ foreach ($dirmodels as $reldir) if (is_dir($dir)) { - $handle=opendir($dir); diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 55fb4329d39..bd2cb10a3ad 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -246,7 +246,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -263,7 +262,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''; @@ -537,7 +535,6 @@ print ''; if ($conf->banque->enabled) { - print ''; } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 92823045a62..bd93d7a9fc5 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -50,7 +50,6 @@ foreach ($dirsyslogs as $reldir) { $handle = opendir($newdir); if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { if (substr($file, 0, 11) == 'mod_syslog_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 195b5c83143..01836dd4a72 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -202,7 +202,6 @@ else if ($resql) { while ($row = $db->fetch_row($resql)) { - $rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]); if ($rescount) { $row_count = $db->fetch_row($rescount); diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index d97252dc53b..8bb39f0056b 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -214,7 +214,6 @@ foreach ($dirmodels as $reldir) { if (is_dir($dir)) { $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) { $file = $reg[1]; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index ba2dde77bec..4d234e266e8 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -108,7 +108,6 @@ if ($action == 'update') } else { - $db->rollback(); if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { @@ -158,7 +157,6 @@ if ($action == 'add') } else { - $db->rollback(); if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 2ead8e03210..ba6c3660bcd 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -239,7 +239,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index c0c4e3c57d8..190391b462b 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -186,7 +186,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 1c7fe75f0de..0343fecf69d 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -572,7 +572,6 @@ if ($id) // Lines with values while ($i < $num) { - $obj = $db->fetch_object($resql); //print_r($obj); print ''; diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 6803f9d65e7..459bd2d8edc 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -83,7 +83,6 @@ $hookmanager->initHooks(array('assettypecard','globalcard')); */ if ($cancel) { - $action=''; if (! empty($backtopage)) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index a0bb66f2b81..1ed7c449868 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -197,7 +197,6 @@ if ($action == 'builddoc') // For labels if ($mode == 'label') { - $txtforsticker="%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator $textleft=make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT)?$txtforsticker:$conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray); $textheader=make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT)?'':$conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray); diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index b44f27f7fe8..1f0c82e780b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -92,7 +92,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' } if ($action === 'downloadblockchain') { - $auth = new BlockedLogAuthority($db); $bc = $auth->getLocalBlockChain(); diff --git a/htdocs/blockedlog/ajax/authority.php b/htdocs/blockedlog/ajax/authority.php index bcbb4a66f91..45479c1e4db 100644 --- a/htdocs/blockedlog/ajax/authority.php +++ b/htdocs/blockedlog/ajax/authority.php @@ -51,7 +51,6 @@ if($auth->fetch(0, $signature)<=0) { if(!empty($hash)) { - echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk'; } elseif(!empty($newblock)){ @@ -62,7 +61,6 @@ elseif(!empty($newblock)){ echo 'blockadded'; } else{ - echo 'blockalreadyadded'; } } diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 7325f9ae50c..cec6410b7b6 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -310,17 +310,14 @@ class BlockedLogAuthority $signature=$block_static->getSignature(); foreach($blocks as &$block) { - $url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature; $res = file_get_contents($url); echo $block->signature.' '.$url. ' '.$res.'
'; if($res === 'blockalreadyadded' || $res === 'blockadded') { - $block->setCertified(); } else { - $this->error = $langs->trans('ImpossibleToContactAuthority ', $url); return -1; } diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 14366f46de7..24548f736f2 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -977,7 +977,6 @@ class BlockedLog if (empty($cachedlogs)) $cachedlogs=array(); if ($element=='all') { - $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity; } @@ -1006,7 +1005,6 @@ class BlockedLog $res = $this->db->query($sql); if($res) { - $results=array(); $i = 0; @@ -1046,7 +1044,6 @@ class BlockedLog global $db,$conf,$mysoc; if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint - require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 9b2646b3e9d..84560d5a533 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -943,7 +943,6 @@ class BOM extends CommonObject $langs->load("mrp"); if (! dol_strlen($modele)) { - $modele = 'standard'; if ($this->modelpdf) { diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 1e54cc816fd..8128815ef3b 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -38,7 +38,6 @@ function printBookmarksList($aDb, $aLangs) $ret = ''."\n"; if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off. - require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 0ba6d7569b5..7feb0aac37a 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -54,7 +54,6 @@ $object=new Bookmark($db); if ($action == 'add' || $action == 'addproduct' || $action == 'update') { - if ($action == 'update') { $invertedaction = 'edit'; } else { diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 22b8fea0a05..f9c438149e7 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -125,7 +125,6 @@ print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s. print ''; if (! empty($conf->banque->enabled)) { - print ''; print ''; // Force warehouse (this is not a default value) print ''); } else { - echo (''); } ?> @@ -87,16 +85,13 @@ $langs->loadLangs(array("main","bills","banks")); getsetPaymentMode() == 'DIF' ) { - echo (''); } else { - echo (''); } // Affichage du montant rendu (reglement en especes) if ( $obj_facturation->montantRendu() ) { - echo (''); } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 48bb4179afc..cd3885b77b1 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1637,7 +1637,6 @@ class Categorie extends CommonObject { $nbfile = count($file['name']); for ($i = 0; $i <= $nbfile; $i ++) { - $originImage = $dir . $file['name'][$i]; // Cree fichier en taille origine diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 70cf6e3e8f7..6def65666a0 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -69,7 +69,6 @@ if ($id > 0) if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) { - $file = $_FILES['userfile']; if (is_array($file['name']) && count($file['name']) > 0) { diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 737b488c090..fb246b5358b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -125,7 +125,6 @@ if ($id > 0 && $removeelem > 0) $elementtype = 'member'; } elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); @@ -644,7 +643,6 @@ if ($type == Categorie::TYPE_CONTACT) } else { - print ''; print ''; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cc3accde763..6e8c5535f03 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -278,7 +278,6 @@ if (empty($reshook) && $action == 'add') $taskid = GETPOST('taskid', 'int'); if(!empty($taskid)){ - $taskProject = new Task($db); if($taskProject->fetch($taskid)>0){ $object->fk_project = $taskProject->fk_project; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index e6ee5e9d1d0..fc343f443a2 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -631,7 +631,6 @@ $currentdaytoshow = $firstdaytoshow; echo '
'; while($currentdaytoshow<$lastdaytoshow) { - echo '
'.$module->nom."\n"; print $module->info(); print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) @@ -559,7 +556,6 @@ if ($conf->banque->enabled) } else { - print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '.$langs->trans('NotAvailable').'
'.$langs->trans("CashDeskBankAccountForSell").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1); @@ -146,7 +145,6 @@ if (! empty($conf->banque->enabled)) if (! empty($conf->stock->enabled)) { - print '
'.$langs->trans("CashDeskDoNotDecreaseStock").''; if (empty($conf->productbatch->enabled)) { diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 40b338ccca6..2f8a993829e 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -296,12 +296,10 @@ class Facturation } elseif ( $aId == 'RESET' ) { - $this->id = null; } else { - $this->id = $aId; } } @@ -343,7 +341,6 @@ class Facturation } elseif ( $aQte == 'RESET' ) { - $this->qte = null; } else @@ -408,13 +405,10 @@ class Facturation { if (is_null($aMontantRemise)) { - return $this->montant_remise; } elseif ( $aMontantRemise == 'RESET' ) { - $this->montant_remise = null; } else { - $this->montant_remise = $aMontantRemise; } } @@ -429,13 +423,10 @@ class Facturation { if (is_null($aPrix)) { - return $this->prix; } elseif ( $aPrix == 'RESET' ) { - $this->prix = null; } else { - $this->prix = $aPrix; } } @@ -449,13 +440,10 @@ class Facturation public function tva($aTva = null) { if (is_null($aTva)) { - return $this->tva; } elseif ( $aTva == 'RESET' ) { - $this->tva = null; } else { - $this->tva = $aTva; } } @@ -469,13 +457,10 @@ class Facturation public function numInvoice($aNumFacture = null) { if (is_null($aNumFacture)) { - return $this->num_facture; } elseif ( $aNumFacture == 'RESET' ) { - $this->num_facture = null; } else { - $this->num_facture = $aNumFacture; } } @@ -490,13 +475,10 @@ class Facturation { if (is_null($aModeReglement)) { - return $this->mode_reglement; } elseif ( $aModeReglement == 'RESET' ) { - $this->mode_reglement = null; } else { - $this->mode_reglement = $aModeReglement; } } @@ -511,13 +493,10 @@ class Facturation { if (is_null($aMontantEncaisse)) { - return $this->montant_encaisse; } elseif ( $aMontantEncaisse == 'RESET' ) { - $this->montant_encaisse = null; } else { - $this->montant_encaisse = $aMontantEncaisse; } } @@ -532,13 +511,10 @@ class Facturation { if (is_null($aMontantRendu)) { - return $this->montant_rendu; } elseif ( $aMontantRendu == 'RESET' ) { - $this->montant_rendu = null; } else { - $this->montant_rendu = $aMontantRendu; } } @@ -552,13 +528,10 @@ class Facturation public function paiementLe($aPaiementLe = null) { if (is_null($aPaiementLe)) { - return $this->paiement_le; } elseif ( $aPaiementLe == 'RESET' ) { - $this->paiement_le = null; } else { - $this->paiement_le = $aPaiementLe; } } @@ -572,13 +545,10 @@ class Facturation public function prixTotalHt($aTotalHt = null) { if (is_null($aTotalHt)) { - return $this->prix_total_ht; } elseif ( $aTotalHt == 'RESET' ) { - $this->prix_total_ht = null; } else { - $this->prix_total_ht = $aTotalHt; } } @@ -592,13 +562,10 @@ class Facturation public function montantTva($aMontantTva = null) { if (is_null($aMontantTva)) { - return $this->montant_tva; } elseif ( $aMontantTva == 'RESET' ) { - $this->montant_tva = null; } else { - $this->montant_tva = $aMontantTva; } } diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index f7e7c3af501..c52ecccef77 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -36,7 +36,6 @@ $form=new Form($db); // Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled) if ( GETPOST('filtre', 'alpha') ) { - // Avec filtre $ret=array(); $i=0; @@ -88,7 +87,6 @@ if ( GETPOST('filtre', 'alpha') ) { } $tab_designations=$ret; } else { - // Sans filtre $ret=array(); $i=0; diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index a35abb46789..d892c1df0e6 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -57,10 +57,8 @@ else echo ('

'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'

'."\n"); if ( $tab[$i]['remise_percent'] > 0 ) { - $remise_percent = ' -'.$tab[$i]['remise_percent'].'%'; } else { - $remise_percent = ''; } diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index 64f340983ff..e8c16712b74 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -39,12 +39,10 @@ $langs->loadLangs(array("main","bills","banks")); montantTva() ) { - echo ('
'.$langs->trans("VAT").''.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("VAT").''.$langs->trans("NoVAT").'
'.$langs->trans("DateDue").''.$obj_facturation->paiementLe().'
'.$langs->trans("Received").''.price(price2num($obj_facturation->montantEncaisse(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("Change").''.price(price2num($obj_facturation->montantRendu(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'; echo ''; @@ -779,7 +778,6 @@ while($currentdaytoshow<$lastdaytoshow) { $i = 0; for ($iter_day = 0; $iter_day < 8; $iter_day++) { - if (($i + 1) < $begin_d || ($i + 1) > $end_d) { $i++; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 5d1b7ba919e..8cc1774cba2 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -144,7 +144,6 @@ if ($resql) if ($obj) { - print ''; // Date diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index c0d2c4703ca..43af4f8f1c0 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -208,7 +208,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) } else { - print ''; } print "
'.$langs->trans("NoProposal").'

"; @@ -379,7 +378,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) } else { - print ''.$langs->trans("NoOrder").''; } print ""; @@ -430,7 +428,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) { - $obj = $db->fetch_object($resql); print ''; $supplierorderstatic->id=$obj->rowid; @@ -470,7 +467,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande } else { - print ''.$langs->trans("NoSupplierOrder").''; } print ""; diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 9544a394508..1049431b7f2 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -114,7 +114,6 @@ if ($action == 'loadfilter') { } if ($action == 'add') { - $user_contact_query = false; $array_query = array (); @@ -168,7 +167,6 @@ if ($action == 'add') { } if (preg_match("/^contact_/", $key)) { - $array_query[$key] = GETPOST($key); $specials_date_key = array ( @@ -262,7 +260,6 @@ if ($action == 'clear') { } if ($action == 'savefilter' || $action == 'createfilter') { - $template_name = GETPOST('template_name'); $error = 0; @@ -272,7 +269,6 @@ if ($action == 'savefilter' || $action == 'createfilter') { } if (empty($error)) { - $array_query = array (); // Get extra fields @@ -325,7 +321,6 @@ if ($action == 'savefilter' || $action == 'createfilter') { } if (preg_match("/^contact_/", $key)) { - $array_query[$key] = GETPOST($key); $specials_date_key = array ( @@ -359,7 +354,6 @@ if ($action == 'savefilter' || $action == 'createfilter') { setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } } elseif ($action == 'savefilter') { - $result = $advTarget->update($user); if ($result < 0) { setEventMessages($advTarget->error, $advTarget->errors, 'errors'); @@ -421,7 +415,6 @@ $formcompany = new FormCompany($db); $formother = new FormOther($db); if ($object->fetch($id) >= 0) { - $head = emailing_prepare_head($object); dol_fiche_head($head, 'advtargets', $langs->trans("Mailing"), 0, 'email'); @@ -465,7 +458,6 @@ if ($object->fetch($id) >= 0) { // Show email selectors if ($object->statut == 0 && $user->rights->mailing->creer) { - include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php'; } } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 7346bf87543..465bf7dcc50 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -556,7 +556,6 @@ class AdvanceTargetingMailing extends CommonObject $sqlwhere[]= 't.entity IN ('.getEntity('societe').')'; if (count($arrayquery)>0) { - if (array_key_exists('cust_saleman', $arrayquery)) { $sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid "; } @@ -565,7 +564,6 @@ class AdvanceTargetingMailing extends CommonObject } if (!empty($arrayquery['cust_name'])) { - $sqlwhere[]= $this->transformToSQL('t.nom', $arrayquery['cust_name']); } if (!empty($arrayquery['cust_code'])) { @@ -617,13 +615,11 @@ class AdvanceTargetingMailing extends CommonObject //Standard Extrafield feature if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - $elementtype = Societe::$table_element; $extrafields->fetch_name_optionals_label($elementtype); foreach($extrafields->attributes[$elementtype]['label'] as $key=>$val) { - if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { if (!empty($arrayquery['options_'.$key])) { @@ -713,7 +709,6 @@ class AdvanceTargetingMailing extends CommonObject $sqlwhere[]= 't.entity IN ('.getEntity('socpeople').')'; if (count($arrayquery)>0) { - if (array_key_exists('contact_categ', $arrayquery)) { $sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_contact as contactcateg ON contactcateg.fk_socpeople=t.rowid "; } @@ -767,7 +762,6 @@ class AdvanceTargetingMailing extends CommonObject $extrafields->fetch_name_optionals_label($elementtype); foreach($extrafields->attributes[$elementtype]['label'] as $key=>$val) { - if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { if (!empty($arrayquery['options_'.$key.'_cnct'])) { @@ -809,7 +803,6 @@ class AdvanceTargetingMailing extends CommonObject } if (!empty($arrayquery['cust_name'])) { - $sqlwhere[]= $this->transformToSQL('ts.nom', $arrayquery['cust_name']); } if (!empty($arrayquery['cust_code'])) { @@ -870,7 +863,6 @@ class AdvanceTargetingMailing extends CommonObject $extrafields->fetch_name_optionals_label($elementtype); foreach($extrafields->attributes[$elementtype]['label'] as $key=>$val) { - if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { if (!empty($arrayquery['options_'.$key])) { diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 55b7177eb73..67ec7414e7c 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -114,7 +114,6 @@ class FormAdvTargetEmailing extends Form dol_syslog(get_class($this) . "::select_country sql=" . $sql); $resql = $this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); $i = 0; if ($num) { @@ -175,7 +174,6 @@ class FormAdvTargetEmailing extends Form $resql_usr = $this->db->query($sql_usr); if ($resql_usr) { while ( $obj_usr = $this->db->fetch_object($resql_usr) ) { - $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; $options_array [$obj_usr->rowid] = $label; @@ -249,7 +247,6 @@ class FormAdvTargetEmailing extends Form $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; if (! empty($InfoFieldList [3])) { - // We have to join on extrafield table if (strpos($InfoFieldList [3], 'extra') !== false) { $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; @@ -266,7 +263,6 @@ class FormAdvTargetEmailing extends Form dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); $i = 0; if ($num) { @@ -306,7 +302,6 @@ class FormAdvTargetEmailing extends Form $resql=$this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -396,7 +391,6 @@ class FormAdvTargetEmailing extends Form $resql=$this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -442,8 +436,6 @@ class FormAdvTargetEmailing extends Form dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - - $out .= ''; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4e72c6312e6..5cd3902b7d1 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -265,7 +265,6 @@ class Account extends CommonObject $string = ''; foreach ($this->getFieldsToShow() as $val) { - if ($val == 'BankCode') { $string .= $this->code_banque.' '; } elseif ($val == 'BankAccountNumber') { @@ -493,7 +492,6 @@ class Account extends CommonObject } if ($accline->insert() > 0) { - if ($categorie>0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class ("; $sql .= "lineid, fk_categ"; diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 0d517a43fec..32bfe66f7d1 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -97,7 +97,6 @@ $form = new Form($db); if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref)) { - $upload_dir = $conf->bank->dir_output . '/' . $object->ref; // Onglets diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2a08c55eeba..f7ec617ee1d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1822,7 +1822,6 @@ if (empty($reshook)) } if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { - $ret = $object->fetch($id); if ($ret < 0) { dol_print_error($db, $object->error); @@ -2327,7 +2326,6 @@ if (empty($reshook)) // Change each progression persent on each lines foreach($object->lines as $line) { - // no traitement for special product if ($line->product_type == 9 ) continue; @@ -3185,7 +3183,6 @@ if ($action == 'create') if (! empty($conf->global->INVOICE_USE_SITUATION)) { if($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY){ - $rwStyle = 'display:none;'; if(GETPOST('type', 'int') == Facture::TYPE_SITUATION){ $rwStyle = ''; @@ -4347,7 +4344,6 @@ elseif ($id > 0 || ! empty($ref)) // List of previous situation invoices if (($object->situation_cycle_ref > 0) && ! empty($conf->global->INVOICE_USE_SITUATION)) { - print ''; @@ -4660,7 +4656,6 @@ elseif ($id > 0 || ! empty($ref)) // Retained warranty : usualy use on construction industry if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){ - // Billed - retained warranty if($object->type == Facture::TYPE_SITUATION) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 18d153dc597..9ff90b7b025 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1839,7 +1839,6 @@ class FactureLigneRec extends CommonInvoiceLine $result = $this->db->query($sql); if ($result) { - $objp = $this->db->fetch_object($result); $this->id = $objp->rowid; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6149a161694..84835fa9608 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -848,7 +848,6 @@ class Facture extends CommonInvoice if (! $error) { - $result=$this->update_price(1); if ($result > 0) { @@ -1933,7 +1932,6 @@ class Facture extends CommonInvoice if (! $error) { - $this->ref_client = $ref_client; $this->db->commit(); @@ -3465,7 +3463,6 @@ class Facture extends CommonInvoice $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/facture/"); // Load file with numbering class (if found) @@ -5216,7 +5213,6 @@ class FactureLigne extends CommonInvoiceLine $returnPercent = floatval($res['situation_percent']); if($include_credit_note) { - $sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; $sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; $sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 77abac6e4d1..1fed45f09cd 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -356,7 +356,6 @@ if ($massaction == 'withdrawrequest') } else { - $db->rollback(); setEventMessages($aBill->error, $aBill->errors, 'errors'); } diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 86388fd7e87..e7762b834e4 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -61,7 +61,6 @@ if ($_POST["cancel"] == $langs->trans("Cancel") && ! $id) if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $db->begin(); $datev=dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 1e6ab5b4da1..97f97bbc735 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -195,7 +195,6 @@ if($calc ==0 || $calc == 2) { if(($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0) { - $intra = str_replace($find, $replace, $coll->tva_intra); if(empty($intra)) { @@ -269,7 +268,6 @@ if($calc ==0 || $calc == 1){ { if(($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0) { - $intra = str_replace($find, $replace, $coll->tva_intra); if(empty($intra)) { diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 9ab469376e5..3afce69e94b 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -444,7 +444,6 @@ if ($action == 'new') foreach ($accounts as $bid => $account_label) { - print ' '; } elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) { - // La suppression n'a pas été possible require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); // On vérifie si il est utilisé if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; $form = new Form($this->db); echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); @@ -428,7 +424,6 @@ class ActionsDatapolicy $societe->fetch(GETPOST('socid')); if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; $jsscript .= ' -trans("OtherSetup"), '', 'title_setup'); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 0aa97dd36e6..7f123c0f367 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -406,7 +406,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 501a6d18113..af61dd1c09f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -551,27 +551,27 @@ $elementList = array(); $sourceList=array(); if ($id == 11) { - $elementList = array( - '' => '', - 'societe' => $langs->trans('ThirdParty'), -// 'proposal' => $langs->trans('Proposal'), -// 'order' => $langs->trans('Order'), -// 'invoice' => $langs->trans('Bill'), - 'supplier_proposal' => $langs->trans('SupplierProposal'), - 'order_supplier' => $langs->trans('SupplierOrder'), - 'invoice_supplier' => $langs->trans('SupplierBill'), -// 'intervention' => $langs->trans('InterventionCard'), -// 'contract' => $langs->trans('Contract'), - 'project' => $langs->trans('Project'), - 'project_task' => $langs->trans('Task'), - 'agenda' => $langs->trans('Agenda'), - 'dolresource' => $langs->trans('Resource'), - // old deprecated - 'propal' => $langs->trans('Proposal'), - 'commande' => $langs->trans('Order'), - 'facture' => $langs->trans('Bill'), - 'fichinter' => $langs->trans('InterventionCard'), - 'contrat' => $langs->trans('Contract') + $elementList = array( + '' => '', + 'societe' => $langs->trans('ThirdParty'), + // 'proposal' => $langs->trans('Proposal'), + // 'order' => $langs->trans('Order'), + // 'invoice' => $langs->trans('Bill'), + 'supplier_proposal' => $langs->trans('SupplierProposal'), + 'order_supplier' => $langs->trans('SupplierOrder'), + 'invoice_supplier' => $langs->trans('SupplierBill'), + // 'intervention' => $langs->trans('InterventionCard'), + // 'contract' => $langs->trans('Contract'), + 'project' => $langs->trans('Project'), + 'project_task' => $langs->trans('Task'), + 'agenda' => $langs->trans('Agenda'), + 'dolresource' => $langs->trans('Resource'), + // old deprecated + 'propal' => $langs->trans('Proposal'), + 'commande' => $langs->trans('Order'), + 'facture' => $langs->trans('Bill'), + 'fichinter' => $langs->trans('InterventionCard'), + 'contrat' => $langs->trans('Contract'), ); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); @@ -589,13 +589,13 @@ $localtax_typeList = array(); if ($id == 10) { $localtax_typeList = array( - "0" => $langs->trans("No"), - "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), - "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), - "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), - "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), - "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), - "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), + "0" => $langs->trans("No"), + "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), + "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), + "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), + "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), + "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), + "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), ); } @@ -636,8 +636,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 ) - ) - { + ) { $ok=0; $fieldnamekey=$listfield[$f]; // We take translate key of field @@ -1562,18 +1561,18 @@ if ($id) $class="center"; } elseif ($fieldlist[$field]=='localtax1_type') { - if ($obj->localtax1 != 0) - $valuetoshow=$localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; - $align="center"; + if ($obj->localtax1 != 0) + $valuetoshow=$localtax_typeList[$valuetoshow]; + else + $valuetoshow = ''; + $align="center"; } elseif ($fieldlist[$field]=='localtax2_type') { - if ($obj->localtax2 != 0) - $valuetoshow=$localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; - $align="center"; + if ($obj->localtax2 != 0) + $valuetoshow=$localtax_typeList[$valuetoshow]; + else + $valuetoshow = ''; + $align="center"; } elseif ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index c6262e84a79..4f1fad15343 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -423,17 +423,20 @@ class PrestaShopWebservice */ public function delete($options) { - if (isset($options['url'])) + if (isset($options['url'])) { $url = $options['url']; - elseif (isset($options['resource']) && isset($options['id'])) + } elseif (isset($options['resource']) && isset($options['id'])) { if (is_array($options['id'])) $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; else - $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; - if (isset($options['id_shop'])) - $url .= '&id_shop='.$options['id_shop']; - if (isset($options['id_group_shop'])) - $url .= '&id_group_shop='.$options['id_group_shop']; + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + } + if (isset($options['id_shop'])) { + $url .= '&id_shop='.$options['id_shop']; + } + if (isset($options['id_group_shop'])) { + $url .= '&id_group_shop='.$options['id_group_shop']; + } $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); self::checkStatusCode($request['status_code']);// check the response validity return true; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index e65eb2bbb0a..22029b2c691 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -32,8 +32,8 @@ class Dolistore * beginning of pagination * @var int */ + public $start; - public $start; /** * end of pagination * @var int diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 255fdb68a0d..daa0c896809 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -513,7 +513,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $noparam=array(); foreach($arrayoftypes as $key => $value) { - if ($value['noparam']) $noparam[]=$key; + if ($value['noparam']) $noparam[]=$key; } print '})'; print ''."\n"; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 29ef6d40a1e..7cc2e7dff44 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index e3adeaca890..4bb2bf1c964 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -79,7 +79,7 @@ if ($action == 'add' || GETPOST("modify")) if ($_POST["modify"]) { // Supprime boite box_external_rss de definition des boites -/* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; + /* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; $sql.= " SET name = '".$boxlabel."'"; $sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'"; @@ -89,7 +89,7 @@ if ($action == 'add' || GETPOST("modify")) dol_print_error($db,"sql=$sql"); exit; } -*/ + */ } else { diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index f9f051dc272..876f4b90abb 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -207,8 +207,7 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') } } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); -$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', - $conf->entity); + $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); if (!$res > 0) { $error++; @@ -220,33 +219,31 @@ $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') { - $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); - $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', - $conf->entity); + $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + if (!$res > 0) { + $error++; + } - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') { - $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); - $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', - $conf->entity); + $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + if (!$res > 0) { + $error++; + } - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 58ea3dcdbaa..2d3f986e6a1 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -300,8 +300,14 @@ print ''; print '
'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) -{ +if ($conf->global->MAIN_FEATURES_LEVEL < 2) { + dol_fiche_end(); + // End of page + llxFooter(); + $db->close(); + exit; +} + /* * Documents models for Holidays */ @@ -317,8 +323,8 @@ $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { - $i = 0; - $num_rows=$db->num_rows($resql); + $i = 0; + $num_rows=$db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); @@ -416,7 +422,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') @@ -518,7 +524,7 @@ print ''; print ''; print ''; -} + dol_fiche_end(); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index cba9481849d..8d1f7d3279e 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -478,7 +478,7 @@ if (function_exists("ldap_connect")) } } else - { + { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 99cd481095b..794020cfc95 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -139,7 +139,7 @@ if ($action == 'set') if ($action == 'del') { - $ret = delDocumentModel($value, $type); + $ret = delDocumentModel($value, $type); if ($ret > 0) { if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF', $conf->entity); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0dbdf90b53b..7ac91d51c8d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -45,11 +45,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array("errors","admin","mails","languages")); -$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$id = GETPOST('id', 'int'); -$rowid = GETPOST('rowid', 'alpha'); +$id = GETPOST('id', 'int'); +$rowid = GETPOST('rowid', 'alpha'); $search_label=GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)' $search_type_template=GETPOST('search_type_template', 'alpha'); $search_lang=GETPOST('search_lang', 'alpha'); @@ -327,7 +327,7 @@ if (empty($reshook)) $i++; } $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; -//print $sql;exit; + //print $sql;exit; dol_syslog("actionmodify", LOG_DEBUG); //print $sql; $resql = $db->query($sql); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 88ad0acf097..8bdfb978219 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -923,19 +923,17 @@ if ($mode == 'marketplace')  
- -
- + '; + print ''; - '; - print '
'; + print ''; + print '
'; - ?> + ?>
    diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index db9efb0e5c7..a0f817a40c1 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -467,7 +467,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = $langs->trans("Name").': '.$module->name; $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 07d448c5d11..27564d6b4e0 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 833d6c25d22..1f37a36ec4f 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -262,11 +262,11 @@ else if (count($listofmethods) && ! empty($conf->global->MAIN_SMS_SENDMODE)) { - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; } else { - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; } print '
'; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 42daea12861..51bf959bb72 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -113,12 +113,12 @@ print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; - print '\n\n"; $found++; -print ''; + print ''; print ''; - print '\n\n"; $found++; } @@ -284,15 +284,15 @@ else { print ''; print ''; - print ''; print ''; - print '\n"; - print "\n"; + print '\n"; + print "\n"; } if($conf->order->enabled) { print ''; print ''; - print '\n"; print "\n"; } @@ -368,13 +368,13 @@ if($conf->expedition->enabled) { print ''; print ''; - print '\n"; print "\n"; } @@ -383,27 +383,30 @@ print '
'.$langs->trans("DeStockOnBill").''; if (! empty($conf->facture->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); + } } else { @@ -133,12 +133,12 @@ print ''.$langs->trans("DeStockOnValidateOrder").''; if (! empty($conf->commande->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); + } } else { @@ -155,12 +155,12 @@ print ''.$langs->trans("DeStockOnShipment").''; if (! empty($conf->expedition->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); + } } else { @@ -175,12 +175,12 @@ print ''.$langs->trans("DeStockOnShipmentOnClosing").''; if (! empty($conf->expedition->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); + } } else { @@ -215,12 +215,12 @@ print ''.$langs->trans("ReStockOnBill").''; if (! empty($conf->fournisseur->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); + } } else { @@ -236,12 +236,12 @@ print ''.$langs->trans("ReStockOnValidateOrder").''; if (! empty($conf->fournisseur->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); + } } else { @@ -254,29 +254,29 @@ if (!empty($conf->reception->enabled)) { print '
'.$langs->trans("StockOnReception").''; + print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); + } print "
'.$langs->trans("StockOnReceptionOnClosing").''; + print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); + } print "
'.$langs->trans("ReStockOnDispatchOrder").''; + print ''; if (! empty($conf->fournisseur->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); + } } else { @@ -338,28 +338,28 @@ if($conf->invoice->enabled) { print '
'.$langs->trans("StockMustBeEnoughForInvoice").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE); -} - print "
'; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE); + } + print "
'.$langs->trans("StockMustBeEnoughForOrder").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER); + } print "
'.$langs->trans("StockMustBeEnoughForShipment").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT); + } print "
'; print '
'; $virtualdiffersfromphysical=0; -if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) - || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) - ) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. +if ( + ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) + || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) +) { + $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. +} if ($virtualdiffersfromphysical) { -print ''; -print ''; + print '
'; + print ''; print "\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''; print ''; - print '\n"; print "\n"; print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UseVirtualStockByDefault").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); + } print "
'; @@ -504,7 +507,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT); } print ''; - print ''; } @@ -512,8 +514,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) If not used by a module, I still need to understand in which case user may need this now we can set rule on product page. if ($conf->global->PRODUIT_SOUSPRODUITS) { - - print ''; print ''.$langs->trans("IndependantSubProductStock").''; print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 6369efb1361..c2a7a5d4077 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -413,8 +413,8 @@ foreach ($dirmodels as $reldir) print "\n"; require_once $dir.$file; $module = new $classname($db, $specimenthirdparty); - if (method_exists($module, 'info')) print $module->info($langs); - else print $module->description; + if (method_exists($module, 'info')) print $module->info($langs); + else print $module->description; print "\n"; // Active diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index bd2cb10a3ad..30a85f2af3b 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 01836dd4a72..01fc5ff5fc1 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -189,8 +189,8 @@ else if ($base == 4) { // Sqlite by PDO or by Sqlite3 - print '
'; - print ''; + print '
'; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index d08eb564f17..928b193b1ee 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -94,10 +94,10 @@ if ($db->type == 'pgsql') { // Check option standard_conforming_strings is on $paramarray=$db->getServerParametersValues('standard_conforming_strings'); -// if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1) -// { -// $langs->load("errors"); -// } + // if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1) + // { + // $langs->load("errors"); + // } } print '
'; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 109b2a748fb..f1759ec6c06 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -111,13 +111,15 @@ jQuery(document).ready(function() { } }); - -}); -\n"; print load_fiche_titre($langs->trans("Backup"), '', 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); @@ -127,24 +129,17 @@ print $langs->trans("BackupDesc", DOL_DATA_ROOT); print ''; print '
'; -?> +print "\n"; +print ''; +print ''; +print ''; +print '
1'; - - - -
1 - -trans("BackupDesc3", $dolibarr_main_db_name).'
'; //print $langs->trans("BackupDescY").'
'; print '
'; -?> -
- -'; print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); @@ -155,275 +150,296 @@ print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; print ''; print '
'; print ''; print '
'.$langs->trans("TableName").''.$langs->trans("NbOfRecord").'
'; -?> - - - - -
+print ''; +print ''; +print ' - '; +print ''; +print ''; +print '
'; -
-
trans("ExportMethod"); ?> - -
- -
-
-
- -
- -
- -
- -
-
+print '
'; +print '
'.$langs->trans("ExportMethod").''; +if (in_array($type, array('mysql', 'mysqli'))) { + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + print ''; + print '
'; +} elseif (in_array($type, array('pgsql'))) { + print '
'; + print ''; + print '
'; +} else { + print 'No method available with database '.$label; +} +print '
'; +print '
'; -
+print ''; -
- -
trans("MySqlExportParameters"); ?> +print '
'; +if (in_array($type, array('mysql', 'mysqli'))) { + print "\n"; + print '
'.$langs->trans("MySqlExportParameters").''; -
trans("FullPathToMysqldumpCommand"); - if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) - { - $fullpathofmysqldump=$db->getPathOfDump(); - } - else - { - $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; - } - ?>
-
+ print '
'.$langs->trans("FullPathToMysqldumpCommand"); + if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) + { + $fullpathofmysqldump=$db->getPathOfDump(); + } + else + { + $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; + } + print '
'; + print '
'; -
-
trans("ExportOptions"); ?> -
+ print '
'; + print '
'.$langs->trans("ExportOptions").''; + print '
'; + print ''; + print ''; -
+ print '
'; - global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> -
-
- + if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { + print '
'; + print ''; + print ''; + print '
'; + } - + print ''; -
- -
+ print ''; + print '
'; + print ''; + print '
'; -
-
id="checkbox_dump_drop" />
-
+ print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; -
-

+ print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
-
+ print '
'; + print ''; + print "\n"; + print '
'; + print ''.$langs->trans("MySqlExportParameters").''; + print '
'; + print ''.$langs->trans("ExportOptions").''; + print '
'; + print ''; + print ''; - -
trans("MySqlExportParameters"); ?> -
- trans("ExportOptions"); ?> -
+ print '
'; + if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { + print '
'; + print ''; + print ''; + print '
'; + } + print '
'; -
- global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> -
-
- -
+ print '
'; + print '
'.$langs->trans('ExportStructure').''; + print ''; + print ''; + print '
'; + print '
'; -
-
trans('ExportStructure') ?> id="checkbox_dump_drop" />
-
+ print '
'; + print '
'; + print ''.$langs->trans("Datas").''; -
-
- trans("Datas"); ?> + print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print '
'; + print '
'; +} -
- +if (in_array($type, array('pgsql'))) { + print "\n"; + print '
'.$langs->trans("PostgreSqlExportParameters").''; - '.$langs->trans("FullPathToPostgreSQLdumpCommand"); + if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) { + $fullpathofpgdump=$db->getPathOfDump(); + } + else + { + $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; + } + print '
'; + print '
'; - if (in_array($type, array('pgsql'))) - { - ?> -
trans("PostgreSqlExportParameters"); ?> + print '
'; + print '
'; + print ''.$langs->trans("ExportOptions").''; + print ''; + print ''; + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; + print '
'; +} +print ''; -
trans("FullPathToPostgreSQLdumpCommand"); - if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) - { - $fullpathofpgdump=$db->getPathOfDump(); - } - else - { - $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; - } - ?>
-
+print '
'; -
-
trans("ExportOptions"); ?> - -
- -
- -
-
- -
-

- -
- - - - -
- - - -
-
- -->'; +print '
'; +print ''; +print '
'; $prefix='dump'; $ext='.sql'; -if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; } -//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } -if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; } +if (in_array($type, array('mysql', 'mysqli'))) { + $prefix='mysqldump'; + $ext='sql'; +} +//if ($label == 'PostgreSQL') { +// $prefix='pg_dump'; +// $ext='dump'; +//} +if (in_array($type, array('pgsql'))) { + $prefix='pg_dump'; + $ext='sql'; +} $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; -echo $file; -?>" />
-
- -'; +print '
'; +print '
'; // Define compressions array $compression=array(); -if (in_array($type, array('mysql', 'mysqli'))) -{ - $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); - $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); - // $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function - $compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); +if (in_array($type, array('mysql', 'mysqli'))) { + $compression['none'] = array( + 'function' => '', + 'id' => 'radio_compression_none', + 'label' => $langs->trans("None") + ); + $compression['gz'] = array( + 'function' => 'gzopen', + 'id' => 'radio_compression_gzip', + 'label' => $langs->trans("Gzip") + ); + // Not open source format. Must implement dol_compress function + // $compression['zip']= array( + // 'function' => 'dol_compress', + // 'id' => 'radio_compression_zip', + // 'label' => $langs->trans("FormatZip") + // ); + $compression['bz'] = array( + 'function' => 'bzopen', + 'id' => 'radio_compression_bzip', + 'label' => $langs->trans("Bzip2") + ); } else { - $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); - $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); + $compression['none'] = array( + 'function' => '', + 'id' => 'radio_compression_none', + 'label' => $langs->trans("Default") + ); + $compression['gz'] = array( + 'function' => 'gzopen', + 'id' => 'radio_compression_gzip', + 'label' => $langs->trans("Gzip") + ); } // Show compression choices @@ -434,13 +450,14 @@ print $langs->trans("Compression").':   '; foreach($compression as $key => $val) { - if (! $val['function'] || function_exists($val['function'])) // Enabled export format - { + if (! $val['function'] || function_exists($val['function'])) { + // Enabled export format print ''; print ' '; } - else // Disabled export format + else { + // Disabled export format print ''; print ' '; print ' ('.$langs->trans("NotAvailable").')'; @@ -451,20 +468,18 @@ foreach($compression as $key => $val) print ''; print "\n"; -?> +print " \n"; +print '
'; +print '
'; +print ''; +print ''; +print '
'; +print '
'; -
-
- " id="buttonGo"> - -
-
- -'.$langs->trans("RunCommandSummary").':
'."\n"; + print '
'.$langs->trans("RunCommandSummary").':
'."\n"; print '
'."\n"; print '
'; @@ -491,71 +506,51 @@ if (! empty($_SESSION["commandbackuptorun"])) $_SESSION["commandbackuptorun"]=''; $_SESSION["commandbackupresult"]=''; } -?> -
+print "
\n"; -
'; - -?> - -
+print " \n"; -
-
+print '
'; +print '
'; -admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); print '
'; -?> +print '
'; +print '
'; +print ''; +print ''; -
-
- - +print "
\n"; +print "\n"; -
- +print '
'; +print ''; +print ''; - - - +print '
2'; -
2 - -trans("BackupDesc2", DOL_DATA_ROOT).'
'; print $langs->trans("BackupDescX").'

'; -?> - -
- -'; print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); -?> -
-'.$langs->trans("FileNameToGenerate").'
'; $prefix='documents'; $ext='zip'; - $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; -echo $file; -?>" />
-
+print '
'; +print '
'; -'; print "\n"; @@ -584,32 +579,26 @@ foreach($filecompression as $key => $val) print '
'; print "\n"; -?> -
-
" id="buttonGo" />
-
-
+print '
'; +print '
'; +print '
'; +print '
'; +print '
'; - +print ''; -
-
+print '
'; +print '
'; -admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); print '
'; -?> +print '
'; +print '
'; -
-
- -
- - -'; +print ''; // End of page llxFooter(); diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index a5d52eb2929..c6c31fe7f45 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -99,21 +99,21 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'

'; + ?>
/>
- + ?>
/>
- trans("RestoreDesc3", $dolibarr_main_db_name).'

'; -
- trans('RestoreMySQL') ?> -
- '; + print ''.$langs->trans('RestoreMySQL').''; + print '
'; // Parameteres execution $command=$db->getPathOfRestore(); if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command @@ -157,20 +155,18 @@ if (in_array($type, array('mysql', 'mysqli'))) print '
'; print ajax_autoselect('restorecommand'); - if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '
'.$langs->trans("UnHidePassword").''; - //else print '
'.$langs->trans("HidePassword").''; - ?> -
-
-'.$langs->trans("UnHidePassword").''; + } + //else print '
'.$langs->trans("HidePassword").''; + print ''; + print '
'; } elseif (in_array($type, array('pgsql'))) { -?> -
- Restore PostgreSQL -
- '; + print 'Restore PostgreSQL'; + print '
'; // Parameteres execution $command=$db->getPathOfRestore(); if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command @@ -198,20 +194,16 @@ elseif (in_array($type, array('pgsql'))) print ajax_autoselect('restorecommand'); //if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '
'.$langs->trans("UnHidePassword").''; //else print '
'.$langs->trans("HidePassword").''; - ?> -
-
-'; + print ''; } -?> - +print ''; - - +print ''; +print ''; -close(); diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 7db64a8a3ed..1fedf9e40de 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -37,8 +37,8 @@ $confirm=GETPOST('confirm', 'alpha'); // Security check if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 3c99e3e10b8..f991bb5752e 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -97,9 +97,9 @@ if (! empty($conf->syslog->enabled)) $filelogparam=$filelog; if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) { - $filelogparam =''.$filelog.''; + $filelogparam =''.$filelog.''; } print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam); print '

'; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index ba6c3660bcd..1b4c59505db 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -288,9 +288,9 @@ foreach ($dirmodels as $reldir) } print ''; - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.= '
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') { $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 190391b462b..bd8ae3d5e92 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 42fec36ef6a..0277630ae78 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -77,23 +77,23 @@ class FormCron extends Form $out.=''; } } else { - $out=''; - if ($selected=='command') { - $selected_attr=' selected '; - } else { - $selected_attr=''; - } - $out.= ''; + if ($selected=='command') { + $selected_attr=' selected '; + } else { + $selected_attr=''; + } + $out.= ''; - if ($selected=='method') { - $selected_attr=' selected '; - } else { - $selected_attr=''; - } - $out.= ''; + if ($selected=='method') { + $selected_attr=' selected '; + } else { + $selected_attr=''; + } + $out.= ''; - $out.=''; + $out.=''; } return $out; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4ac7fb6e716..970d4841fbf 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -660,20 +660,20 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { // Copy some files $filetogenerate = array( - 'myobject_card.php'=>strtolower($objectname).'_card.php', - 'myobject_note.php'=>strtolower($objectname).'_note.php', - 'myobject_document.php'=>strtolower($objectname).'_document.php', - 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', - 'myobject_list.php'=>strtolower($objectname).'_list.php', - 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', - //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', - 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', - 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', - 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', - //'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php', - 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', - 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', - //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php' + 'myobject_card.php'=>strtolower($objectname).'_card.php', + 'myobject_note.php'=>strtolower($objectname).'_note.php', + 'myobject_document.php'=>strtolower($objectname).'_document.php', + 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', + 'myobject_list.php'=>strtolower($objectname).'_list.php', + 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', + //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', + 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', + 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', + 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', + //'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php', + 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', + 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', + //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php', ); foreach($filetogenerate as $srcfile => $destfile) @@ -696,68 +696,81 @@ if ($dirins && $action == 'initobject' && $module && $objectname) //if (! $error) // If there is error copying 1 file, we still have to make the replacement //{ - // Scan for object class files - $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); + // Scan for object class files + $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); - $firstobjectname=''; - foreach($listofobject as $fileobj) + $firstobjectname=''; + foreach($listofobject as $fileobj) + { + if (preg_match('/^api_/', $fileobj['name'])) continue; + if (preg_match('/^actions_/', $fileobj['name'])) continue; + + $tmpcontent=file_get_contents($fileobj['fullname']); + $reg=array(); + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) { - if (preg_match('/^api_/', $fileobj['name'])) continue; - if (preg_match('/^actions_/', $fileobj['name'])) continue; - - $tmpcontent=file_get_contents($fileobj['fullname']); - $reg=array(); - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) - { - $objectnameloop = $reg[1]; - if (empty($firstobjectname)) $firstobjectname = $objectnameloop; - } - - // Regenerate left menu entry in descriptor for $objectname - $stringtoadd=" -\t\t\$this->menu[\$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule', // '' 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 - 'type'=>'left', // This is a Left menu entry - 'titre'=>'List MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject', - 'url'=>'/mymodule/myobject_list.php', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1100+\$r, - 'enabled'=>'\$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both -\t\t\$this->menu[\$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject', // '' 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 - 'type'=>'left', // This is a Left menu entry - 'titre'=>'New MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject', - 'url'=>'/mymodule/myobject_card.php?action=create', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1100+\$r, - 'enabled'=>'\$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - "; - $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); - $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); - $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $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 - - dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); - - // Add module descriptor to list of files to replace "MyObject' string with real name of object. - $filetogenerate[]='core/modules/mod'.$module.'.class.php'; - - // TODO + $objectnameloop = $reg[1]; + if (empty($firstobjectname)) $firstobjectname = $objectnameloop; } + + // Regenerate left menu entry in descriptor for $objectname + $stringtoadd = " + \$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=mymodule', + // This is a Left menu entry + 'type'=>'left', + 'titre'=>'List MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'mymodule_myobject', + 'url'=>'/mymodule/myobject_list.php', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'mymodule@mymodule', + 'position'=>1100+\$r, + // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'\$conf->mymodule->enabled', + // Use 'perms'=>'\$user->rights->mymodule->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=mymodule,fk_leftmenu=mymodule_myobject', + // This is a Left menu entry + 'type'=>'left', + 'titre'=>'New MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'mymodule_myobject', + 'url'=>'/mymodule/myobject_card.php?action=create', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'mymodule@mymodule', + 'position'=>1100+\$r, + // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'\$conf->mymodule->enabled', + // Use 'perms'=>'\$user->rights->mymodule->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 + );\n"; + $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); + $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); + $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $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 + + dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); + + // Add module descriptor to list of files to replace "MyObject' string with real name of object. + $filetogenerate[]='core/modules/mod'.$module.'.class.php'; + + // TODO + } //} } @@ -888,11 +901,12 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) if (! $error) { $addfieldentry = array( - 'name'=>GETPOST('propname', 'aZ09'),'label'=>GETPOST('proplabel', 'alpha'),'type'=>GETPOST('proptype', 'alpha'), - 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' - 'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'), - 'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'), - 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha')); + 'name'=>GETPOST('propname', 'aZ09'),'label'=>GETPOST('proplabel', 'alpha'),'type'=>GETPOST('proptype', 'alpha'), + 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' + 'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'), + 'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'), + 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha') + ); if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) { diff --git a/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php index b4057cf178e..d7077d750b5 100644 --- a/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php +++ b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php @@ -69,14 +69,14 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase ), // Geckodriver does not keep the session at the moment?! // XPath selectors also don't seem to work -// array( -// 'browser' => 'Mozilla Firefox on Linux', -// 'browserName' => 'firefox', -// 'sessionStrategy' => 'shared', -// 'desiredCapabilities' => array( -// 'marionette' => true -// ) -// ) + //array( + // 'browser' => 'Mozilla Firefox on Linux', + // 'browserName' => 'firefox', + // 'sessionStrategy' => 'shared', + // 'desiredCapabilities' => array( + // 'marionette' => true, + // ), + //) ); /** @@ -224,7 +224,7 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase { $this->url('/custom/mymodule/admin/about.php'); $this->authenticate(); -return $this->assertEquals( + return $this->assertEquals( 'Dolibarr Module Template (aka My Module)', $this->byTag('h1')->text(), "Readme title" @@ -254,7 +254,7 @@ return $this->assertEquals( { $this->url('/admin/triggers.php'); $this->authenticate(); -return $this->assertContains( + return $this->assertContains( 'interface_99_modMyModule_MyModuleTriggers.class.php', $this->byTag('body')->text(), "Trigger declared" @@ -271,7 +271,7 @@ return $this->assertContains( { $this->url('/admin/triggers.php'); $this->authenticate(); -return $this->assertContains( + return $this->assertContains( 'tick.png', $this->byXPath('//td[text()="interface_99_modMyModule_MyTrigger.class.php"]/following::img')->attribute('src'), "Trigger enabled" From 4d7a18e1e018b72ea7dd98533ed37616e7855455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 01:13:45 +0200 Subject: [PATCH 290/409] restablish original rules --- dev/setup/codesniffer/ruleset.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 0b4be95e692..32c44ce91e4 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -185,15 +185,16 @@ - - + From 66b0c27645d0936100e4a42c433e74ab17f2dc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 09:58:31 +0200 Subject: [PATCH 291/409] clean indent in commande dir --- .travis.yml | 7 +- dev/setup/codesniffer/ruleset.xml | 3 +- htdocs/commande/card.php | 7 +- htdocs/commande/class/api_orders.class.php | 2 +- htdocs/commande/class/commande.class.php | 6 +- htdocs/commande/contact.php | 27 +++--- htdocs/commande/document.php | 27 +++--- htdocs/commande/info.php | 27 +++--- htdocs/commande/note.php | 29 ++++--- htdocs/commande/tpl/linkedobjectblock.tpl.php | 87 ++++++++----------- 10 files changed, 108 insertions(+), 114 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5583ef6ff2..e487822ad24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -295,7 +295,8 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi + #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . set +e echo @@ -347,7 +348,7 @@ script: mysql -e 'DROP DATABASE IF EXISTS travis;' mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' + mysql -e 'FLUSH PRIVILEGES;' mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql fi if [ "$DB" = 'postgresql' ]; then @@ -362,7 +363,7 @@ script: #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis fi echo - + - | echo "Upgrading Dolibarr" # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 32c44ce91e4..82582d2d18c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6fdd1e36feb..3854c51e29d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -44,8 +44,9 @@ require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; -if (! empty($conf->propal->enabled)) +if (! empty($conf->propal->enabled)) { require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +} if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; @@ -757,8 +758,8 @@ if (empty($reshook)) $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } } // If price per customer diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index fb044b1fafa..2559510dea8 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -437,7 +437,7 @@ class Orders extends DolibarrApi return $this->commande; } - /** + /** * Delete a contact type of given order * * @param int $id Id of order to update diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6fe2104556b..4cc922a8cbf 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1995,9 +1995,9 @@ class Commande extends CommonOrder // multilangs if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { - $line = new Product($this->db); - $line->fetch($objp->fk_product); - $line->getMultiLangs(); + $line = new Product($this->db); + $line->fetch($objp->fk_product); + $line->getMultiLangs(); } $this->lines[$i] = $line; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 82d24ad3646..57e37f9f903 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -164,20 +164,21 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') + if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 515e14095bd..fa825086c4a 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -127,20 +127,21 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') + if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index f42a9fc5b60..7d8e319c5ae 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -84,20 +84,21 @@ if (! empty($conf->projet->enabled)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 0931067f155..2cb69bd698b 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -97,20 +97,21 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 86f98f4f0e9..459940dcc64 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -18,17 +18,12 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ +if (empty($conf) || ! is_object($conf)) { print "Error, template page can't be called as URL"; exit; } -?> - - - -\n"; global $user; global $noMoreLinkedObjectBlockAfter; @@ -41,54 +36,48 @@ $langs->load("orders"); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); -$total=0; $ilink=0; +$total=0; +$ilink=0; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; -?> - - trans("CustomerOrder"); ?> - global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print ' - - getNomUrl(1); ?> - ref_client; ?> - date, 'day'); ?> - rights->commande->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - - element != 'shipping') { - ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> - - - -'; + echo ''.$langs->trans("CustomerOrder"); + if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + print ' '; + echo ''.$objectlink->getNomUrl(1).''; + echo ''.$objectlink->ref_client.''; + echo ''.dol_print_date($objectlink->date, 'day').''; + echo ''; + if ($user->rights->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } + echo ''; + echo ''.$objectlink->getLibStatut(3).''; + echo ''; + // For now, shipments must stay linked to order, so link is not deletable + if($object->element != 'shipping') { + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + } + echo ''; + echo "\n"; } -if (count($linkedObjectBlock) > 1) -{ - ?> - - trans("Total"); ?> - - - - - - - - 1) { + echo ''; + echo ''.$langs->trans("Total").''; + echo ''; + echo ''; + echo ''; + echo ''.price($total).''; + echo ''; + echo ''; + echo "\n"; } -?> - +echo "\n"; From 33c35780e01a143fb5856cdf9bc56b7154dfd933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 11:17:54 +0200 Subject: [PATCH 292/409] wip --- htdocs/api/admin/explorer.php | 2 +- htdocs/api/class/api.class.php | 6 +- htdocs/api/class/api_setup.class.php | 14 +- htdocs/blockedlog/admin/blockedlog_list.php | 4 +- htdocs/blockedlog/class/blockedlog.class.php | 4 +- htdocs/bom/tpl/objectline_create.tpl.php | 136 ++++---- htdocs/bom/tpl/objectline_edit.tpl.php | 143 ++++---- htdocs/bom/tpl/objectline_title.tpl.php | 7 +- htdocs/bom/tpl/objectline_view.tpl.php | 161 +++++---- htdocs/core/ajax/ajaxdirpreview.php | 4 +- htdocs/core/ajax/box.php | 2 +- .../connectors/php/commands.php | 2 +- .../core/filemanagerdol/connectors/php/io.php | 8 +- htdocs/core/js/lib_head.js.php | 20 +- htdocs/core/js/lib_notification.js.php | 2 +- htdocs/core/lib/agenda.lib.php | 10 +- htdocs/core/lib/bank.lib.php | 6 +- htdocs/core/lib/files.lib.php | 6 +- htdocs/core/lib/functions.lib.php | 78 ++--- htdocs/core/lib/json.lib.php | 12 +- htdocs/core/lib/project.lib.php | 322 +++++++++--------- htdocs/core/lib/reception.lib.php | 16 +- htdocs/core/lib/xcal.lib.php | 4 +- .../interface_20_all_Logevents.class.php | 4 +- ...terface_50_modAgenda_ActionsAuto.class.php | 8 +- ...face_99_modZapier_ZapierTriggers.class.php | 4 +- 26 files changed, 479 insertions(+), 506 deletions(-) diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index 0f541b93708..0fd34788adf 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -148,7 +148,7 @@ foreach ($modulesdir as $dir) }*/ //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched); - /* } + /* } }*/ } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index c0e81bc77cb..7660144f7ca 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -262,9 +262,9 @@ class DolibarrApi if ($tmp[$i]==')') $counter--; if ($counter < 0) { - $error="Bad sqlfilters=".$sqlfilters; - dol_syslog($error, LOG_WARNING); - return false; + $error="Bad sqlfilters=".$sqlfilters; + dol_syslog($error, LOG_WARNING); + return false; } $i++; } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 1d4bb6a8cb7..60f5a54eeba 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -383,7 +383,7 @@ class Setup extends DolibarrApi return $list; } - + /** * Get the list of contacts types. * @@ -533,13 +533,15 @@ class Setup extends DolibarrApi if (!empty($multicurrency)) $sql.= " , cr.date_sync, cr.rate "; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t"; if (!empty($multicurrency)) { - $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso"; - $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)"; + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso"; + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)"; } $sql.= " WHERE t.active = ".$active; if (!empty($multicurrency)) { - $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; - if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; + if (!empty($multicurrency) && $multicurrency != 2) { + $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + } } // Add sql filters @@ -924,7 +926,7 @@ class Setup extends DolibarrApi $sql = "SELECT rowid, code, pos, label, use_default, description"; $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_category as t"; - $sql.= " WHERE t.active = ".$active; + $sql.= " WHERE t.active = ".$active; // Add sql filters if ($sqlfilters) { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 1f0c82e780b..6ce788a5790 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -574,7 +574,7 @@ jQuery(document).ready(function () { if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { -?> + ?> -thirdparty as $key=>$value) { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties - if (! in_array($key, array( + if (! in_array($key, array( 'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode', 'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur' ))) continue; // Discard if not into a dedicated list @@ -592,7 +592,7 @@ class BlockedLog foreach($tmpobject as $key=>$value) { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties - if (! in_array($key, array( + if (! in_array($key, array( 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public' ))) continue; // Discard if not into a dedicated list if (!is_object($value)) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index b7eb1608e9e..cd654c7a596 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -47,22 +47,20 @@ $colspan = 3; // Columns: total ht + col edit + col delete // Lines for extrafield $objectline = new BOMLine($this->db); -?> - -\n"; + $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { -?> - - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - - -
trans('AddNewLine'); ?>trans("FreeZone"); ?> - - trans('Qty'); ?> - '; + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''; + print '
'.$langs->trans('AddNewLine').''; + // echo $langs->trans("FreeZone"); + print ''; + print ''.$langs->trans('Qty').''; if ($conf->global->PRODUCT_USE_UNITS) { print ''; @@ -70,76 +68,68 @@ if ($nolinesbefore) { print $langs->trans('Unit'); print ''; } - ?> - textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?> -   - -'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).''; + print ' '; + print ''; } -?> - -global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay++; - echo ''; - } +print ''; +$coldisplay=0; +// Adds a line numbering column +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay++; - ?> - + echo ''; +} - product->enabled) || ! empty($conf->service->enabled)) +$coldisplay++; +print ''; + +// Predefined product/service +if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) +{ + if ($forceall >= 0 && $freelines) echo '
'; + echo ''; + $filtertype=''; + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + + $statustoshow = -1; + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) { - if ($forceall >= 0 && $freelines) echo '
'; - echo ''; - $filtertype=''; - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; - - $statustoshow = -1; - if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) - { - // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); - } - else - { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); - } - - echo ''; + // hide products in closed warehouse, but show products for internal transfer + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + } + else + { + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } - $coldisplay++; - ?> - "> - - global->PRODUCT_USE_UNITS) - { - $coldisplay++; - print ''; - print $form->selectUnits($line->fk_unit, "units"); - print ''; - } + echo '
'; +} - $coldisplay++; - ?> - "> - '; +print ''; +if($conf->global->PRODUCT_USE_UNITS) +{ + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; +} - $coldisplay+=$colspan; - ?> - - - - +$coldisplay++; + +print ''; +print ''; +print ''; + + +$coldisplay += $colspan; +print ''; +print ''; +print ''; +print ''; -showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 05b9094d10e..d887b9ab68d 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -49,22 +49,19 @@ $colspan = 3; // Columns: total ht + col edit + col delete // Lines for extrafield $objectline = new BOMLine($this->db); -?> - +print "\n"; - - - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - '; +// Adds a line numbering column +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''.($i+1).''; $coldisplay++; - ?> +} + +$coldisplay++; +?>
@@ -74,72 +71,66 @@ $coldisplay=0; - fk_product > 0) { - $tmpproduct = new Product($object->db); - $tmpproduct->fetch($line->fk_product); - print $tmpproduct->getNomUrl(1); - } - - if (is_object($hookmanager)) - { - $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); - $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); - $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); - } - - ?> - - - element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines - { - $coldisplay++; - ?> - - - - info_bits & 2) != 2) { - // I comment this because it shows info even when not required - // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated - // must also not be output for most entities (proposal, intervention, ...) - //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; - print ''; - } - ?> - - - global->PRODUCT_USE_UNITS) - { - $coldisplay++; - print ''; - print $form->selectUnits($line->fk_unit, "units"); - print ''; - } - - $coldisplay++; - ?> - - - - ">
- "> - - - fk_product > 0) { + $tmpproduct = new Product($object->db); + $tmpproduct->fetch($line->fk_product); + print $tmpproduct->getNomUrl(1); +} + +if (is_object($hookmanager)) +{ + $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); + $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); + $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); +} + +print ''; + +/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines +{ + $coldisplay++; +?> + +'; +if (($line->info_bits & 2) != 2) { + // I comment this because it shows info even when not required + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated + // must also not be output for most entities (proposal, intervention, ...) + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; + print ''; +} +print ''; + +if ($conf->global->PRODUCT_USE_UNITS) +{ + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; +} + +$coldisplay++; +print ''; +print ''; + +$coldisplay+=$colspan; +print ''; +$coldisplay+=$colspan; +print ''; +print '
'; +print ''; +print ''; +print ''; + if (is_object($objectline)) { print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } -?> - +print "\n"; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index 26010a70eb8..721cc5b501f 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -39,9 +39,7 @@ if (empty($object) || ! is_object($object)) print "Error, template page can't be called as URL"; exit; } -?> - -\n"; // Title line print "\n"; @@ -79,6 +77,5 @@ if ($action == 'selectlines') print "\n"; print "\n"; -?> - +print "\n"; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 9582e69f967..f569516e535 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -59,100 +59,93 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; // Lines for extrafield $objectline = new BOMLine($object->db); -?> - - - > - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - -
- db); - $tmpproduct->fetch($line->fk_product); - print $tmpproduct->getNomUrl(1); - ?> - - - qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price - ?> - +$coldisplay=0; +print "\n"; +print ''; +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''.($i+1).''; + $coldisplay++; +} +print ''; +print '
'; +$coldisplay++; +$tmpproduct = new Product($object->db); +$tmpproduct->fetch($line->fk_product); +print $tmpproduct->getNomUrl(1); +print ''; +print ''; +$coldisplay++; +echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price +print ''; - global->PRODUCT_USE_UNITS) - { - print ''; - $label = $line->getLabelOfUnit('short'); - if ($label !== '') { - print $langs->trans($label); +if($conf->global->PRODUCT_USE_UNITS) +{ + print ''; + $label = $line->getLabelOfUnit('short'); + if ($label !== '') { + print $langs->trans($label); + } + print ''; +} +print ''; +$coldisplay++; +echo $line->efficiency; +print ''; + +if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { + print ''; + $coldisplay++; + if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { + } else { + print 'id.'#line_'.$line->id.'">'.img_edit().''; + } + print ''; + + print ''; + $coldisplay++; + if (($line->fk_prev_id == null ) && empty($disableremove)) { + //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + print 'id . '">'; + print img_delete(); + print ''; + } + print ''; + + if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { + print ''; + $coldisplay++; + if ($i > 0) { + print 'id.'">'; + echo img_up('default', 0, 'imgupforline'); + print ''; + } + if ($i < $num-1) { + print 'id.'">'; + echo img_down('default', 0, 'imgdownforline'); + print ''; } print ''; + } else { + print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"').'>'; + $coldisplay++; } - ?> - - efficiency; - ?> - - '; + $coldisplay=$coldisplay+3; +} - if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { ?> - - info_bits & 2) == 2 || ! empty($disableedit)) { ?> - - id.'#line_'.$line->id; ?>"> - - - - +if ($action == 'selectlines') { + print ''; + print ''; + print ''; +} - - fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation - print 'id . '">'; - print img_delete(); - print ''; - } - ?> - +print ''; - 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> - - 0) { ?> - id; ?>"> - - - - - id; ?>"> - - - - - - browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>> - - - - - - - - - -showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } -?> - +print "\n"; diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index f1f42266735..d6a2ba77f05 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -155,8 +155,8 @@ $type='directory'; // This test if file exists should be useless. We keep it to find bug more easily if (! dol_is_dir($upload_dir)) { -// dol_mkdir($upload_dir); -/* $langs->load("install"); + //dol_mkdir($upload_dir); + /*$langs->load("install"); dol_print_error(0,$langs->trans("ErrorDirDoesNotExists",$upload_dir)); exit;*/ } diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index d37374e45a5..200c6208896 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -73,7 +73,7 @@ if ($boxorder && $zone != '' && $userid > 0) $langs->load("boxes"); if (! GETPOST('closing')) { - setEventMessages($langs->trans("BoxAdded"), null); + setEventMessages($langs->trans("BoxAdded"), null); } } } diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 9e26e1583a6..2f6dbf16943 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -318,7 +318,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') else { //issue the CKEditor Callback -SendCKEditorResults( + SendCKEditorResults( $CKEcallback, $sFileUrl, ($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful') diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 17f847b9a37..b66f2abcd8b 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -401,11 +401,11 @@ EOF; */ function SendCKEditorResults($callback, $sFileUrl, $customMsg = '') { - echo ''; + echo ''; } diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index c35318dc7ae..54c0f02abde 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1039,16 +1039,16 @@ function price2numjs(amount) { if (amount == '') return ''; transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { - $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); - } - if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { - $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); - } - if ($thousand == 'Space') $thousand=' '; - print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript + $dec = ','; + $thousand = ' '; + if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { + $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); + } + if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { + $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); + } + if ($thousand == 'Space') $thousand=' '; + print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript ?> var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN); ?>; diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 6c7f3e2c35c..cb8a80bbd78 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -140,5 +140,5 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H time_js_next_test += time_auto_update; console.log('Updated time_js_next_test. New value is '+time_js_next_test); } -id=$obj->id; print ''.$staticaction->getNomUrl(1, 34).''; - // print ''.dol_trunc($obj->label,22).''; + // print ''.dol_trunc($obj->label,22).''; print ''; if ($obj->rowid > 0) @@ -414,10 +414,10 @@ function agenda_prepare_head() if ($conf->global->MAIN_FEATURES_LEVEL > 0) { - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; - $head[$h][1] = $langs->trans("Reminders"); - $head[$h][2] = 'reminders'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; + $head[$h][1] = $langs->trans("Reminders"); + $head[$h][2] = 'reminders'; + $h++; } $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 2230bfac5a1..91e0b719734 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -47,13 +47,13 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'journal'; $h++; -// if ($conf->global->MAIN_FEATURES_LEVEL >= 1) -// { + // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) + // { $head[$h][0] = DOL_URL_ROOT . "/compta/bank/treso.php?account=" . $object->id; $head[$h][1] = $langs->trans("PlannedTransactions"); $head[$h][2] = 'cash'; $h++; -// } + // } $head[$h][0] = DOL_URL_ROOT . "/compta/bank/annuel.php?account=" . $object->id; $head[$h][1] = $langs->trans("IOMonthlyReporting"); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 1730d51383d..f1fd6ed220f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -624,7 +624,7 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask if (empty($arrayreplacementisregex)) { - $content = make_substitutions($content, $arrayreplacement, null); + $content = make_substitutions($content, $arrayreplacement, null); } else { @@ -1044,8 +1044,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $checkvirusarray=dolCheckVirus($src_file); if (count($checkvirusarray)) { - dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING); - return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray); + dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING); + return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8a17b961adb..ecdebb1c27a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -464,36 +464,36 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti $maxloop=20; $loopnb=0; // Protection against infinite loop while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. { - $loopnb++; $newout = ''; + $loopnb++; $newout = ''; - if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; } - elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; } - elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; } - elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } - elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } - elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); } - elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } - elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } - elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); } - elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID') - { - $newout = $mysoc->country_id; - } - elseif ($reg[1] == 'USER_ID' || $reg[1] == 'USERID') - { - $newout = $user->id; - } - elseif ($reg[1] == 'USER_SUPERVISOR_ID' || $reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID') - { - $newout = $user->fk_user; - } - elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') - { - $newout = $conf->entity; - } - else $newout = ''; // Key not found, we replace with empty string - //var_dump('__'.$reg[1].'__ -> '.$newout); - $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); + if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; } + elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; } + elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; } + elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } + elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } + elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); } + elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } + elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } + elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); } + elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID') + { + $newout = $mysoc->country_id; + } + elseif ($reg[1] == 'USER_ID' || $reg[1] == 'USERID') + { + $newout = $user->id; + } + elseif ($reg[1] == 'USER_SUPERVISOR_ID' || $reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID') + { + $newout = $user->fk_user; + } + elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') + { + $newout = $conf->entity; + } + else $newout = ''; // Key not found, we replace with empty string + //var_dump('__'.$reg[1].'__ -> '.$newout); + $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); } } @@ -876,7 +876,7 @@ function dol_string_unaccent($str) else { // See http://www.ascii-code.com/ -$string = strtr( + $string = strtr( $str, "\xC0\xC1\xC2\xC3\xC4\xC5\xC7 \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 @@ -3829,7 +3829,7 @@ function dol_print_error($db = '', $error = '', $errors = null) if (! empty($conf->modules)) { - $out.="".$langs->trans("Modules").": ".join(', ', $conf->modules)."
\n"; + $out.="".$langs->trans("Modules").": ".join(', ', $conf->modules)."
\n"; } if (is_object($db)) @@ -5867,7 +5867,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, // Add SIGNATURE into substitutionarray first, so, when we will make the substitution, // this will include signature content first and then replace var found into content of signature $signature = $user->signature; -$substitutionarray=array_merge($substitutionarray, array( + $substitutionarray=array_merge($substitutionarray, array( '__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '') ) ); @@ -5877,7 +5877,7 @@ $substitutionarray=array_merge($substitutionarray, array( $substitutionarray['__SIGNATURE__'] = (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : ''); } -$substitutionarray=array_merge($substitutionarray, array( + $substitutionarray=array_merge($substitutionarray, array( '__USER_ID__' => (string) $user->id, '__USER_LOGIN__' => (string) $user->login, '__USER_LASTNAME__' => (string) $user->lastname, @@ -5890,7 +5890,7 @@ $substitutionarray=array_merge($substitutionarray, array( } if ((empty($exclude) || ! in_array('mycompany', $exclude)) && is_object($mysoc)) { -$substitutionarray=array_merge($substitutionarray, array( + $substitutionarray=array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, @@ -6388,11 +6388,11 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1) } elseif ($nameorder == 2 || $nameorder == 3) { - $ret.=$firstname; - if (empty($ret) && $nameorder == 3) - { - $ret.=$lastname; - } + $ret.=$firstname; + if (empty($ret) && $nameorder == 3) + { + $ret.=$lastname; + } } else { diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 5eb45b261a0..2ec1532a9a9 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -317,19 +317,19 @@ function utf162utf8($utf16) switch(true) { case ((0x7F & $bytes) == $bytes): - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr($bytes); case (0x07FF & $bytes) == $bytes: - // return a 2-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xC0 | (($bytes >> 6) & 0x1F)) . chr(0x80 | ($bytes & 0x3F)); case (0xFFFF & $bytes) == $bytes: - // return a 3-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F)); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d6dc59d1dcc..106ce8336a8 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -780,171 +780,171 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec //if ($lines[$i]->fk_task_parent == $parent) //{ - // If we want all or we have a role on task, we show it - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) + // If we want all or we have a role on task, we show it + if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) + { + //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); + + // Break on a new project + if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { - //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); - - // Break on a new project - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) + $lastprojectid=$lines[$i]->fk_project; + if ($preselectedday) { - $lastprojectid=$lines[$i]->fk_project; - if ($preselectedday) - { - $projectstatic->id = $lines[$i]->fk_project; - } + $projectstatic->id = $lines[$i]->fk_project; } - - if (empty($workloadforid[$projectstatic->id])) - { - if ($preselectedday) - { - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week - $workloadforid[$projectstatic->id]=1; - } - } - - $projectstatic->id=$lines[$i]->fk_project; - $projectstatic->ref=$lines[$i]->project_ref; - $projectstatic->title=$lines[$i]->project_label; - $projectstatic->public=$lines[$i]->public; - - $taskstatic->id=$lines[$i]->task_id; - $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); - $taskstatic->label=$lines[$i]->task_label; - $taskstatic->date_start=$lines[$i]->date_start; - $taskstatic->date_end=$lines[$i]->date_end; - - $thirdpartystatic->id=$lines[$i]->socid; - $thirdpartystatic->name=$lines[$i]->thirdparty_name; - $thirdpartystatic->email=$lines[$i]->thirdparty_email; - - if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) - { - print ''."\n"; - print ''; - print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); - if ($projectstatic->title) - { - print ' - '; - print $projectstatic->title; - } - print ''; - print ''; - } - - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; - - print ''."\n"; - - // User - /* - print ''; - print $fuser->getNomUrl(1, 'withproject', 'time'); - print ''; - */ - - // Project - print ""; - if ($oldprojectforbreak == -1) - { - print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); - print '
'.$projectstatic->title; - } - print ""; - - // Thirdparty - print ''; - if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); - print ''; - - // Ref - print ''; - print ''; - for ($k = 0 ; $k < $level ; $k++) print "   "; - print $taskstatic->getNomUrl(1, 'withproject', 'time'); - // Label task - print '
'; - for ($k = 0 ; $k < $level ; $k++) print "   "; - print $taskstatic->label; - //print "
"; - //for ($k = 0 ; $k < $level ; $k++) print "   "; - //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); - print "\n"; - - // Date - print ''; - print dol_print_date($lines[$i]->timespent_datehour, 'day'); - print ''; - - $disabledproject=1;$disabledtask=1; - //print "x".$lines[$i]->fk_project; - //var_dump($lines[$i]); - //var_dump($projectsrole[$lines[$i]->fk_project]); - // If at least one role for project - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) - { - $disabledproject=0; - $disabledtask=0; - } - // If $restricteditformytask is on and I have no role on task, i disable edit - if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) - { - $disabledtask=1; - } - - // Hour - print ''; - print dol_print_date($lines[$i]->timespent_datehour, 'hour'); - print ''; - - $cssonholiday=''; - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; - - // Duration - print ''; - - $dayWorkLoad = $lines[$i]->timespent_duration; - $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; - - $alreadyspent=''; - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); - - print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); - - $modeinput='hours'; - - print ''; - - print ''; - - // Note - print ''; - print ''; - print ''; - - // Warning - print ''; - /*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); - else if ($disabledtask) - { - $titleassigntask = $langs->trans("AssignTaskToMe"); - if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); - - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); - }*/ - print ''; - - print "\n"; } + + if (empty($workloadforid[$projectstatic->id])) + { + if ($preselectedday) + { + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $workloadforid[$projectstatic->id]=1; + } + } + + $projectstatic->id=$lines[$i]->fk_project; + $projectstatic->ref=$lines[$i]->project_ref; + $projectstatic->title=$lines[$i]->project_label; + $projectstatic->public=$lines[$i]->public; + + $taskstatic->id=$lines[$i]->task_id; + $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); + $taskstatic->label=$lines[$i]->task_label; + $taskstatic->date_start=$lines[$i]->date_start; + $taskstatic->date_end=$lines[$i]->date_end; + + $thirdpartystatic->id=$lines[$i]->socid; + $thirdpartystatic->name=$lines[$i]->thirdparty_name; + $thirdpartystatic->email=$lines[$i]->thirdparty_email; + + if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) + { + print ''."\n"; + print ''; + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); + if ($projectstatic->title) + { + print ' - '; + print $projectstatic->title; + } + print ''; + print ''; + } + + if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; + + print ''."\n"; + + // User + /* + print ''; + print $fuser->getNomUrl(1, 'withproject', 'time'); + print ''; + */ + + // Project + print ""; + if ($oldprojectforbreak == -1) + { + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); + print '
'.$projectstatic->title; + } + print ""; + + // Thirdparty + print ''; + if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); + print ''; + + // Ref + print ''; + print ''; + for ($k = 0 ; $k < $level ; $k++) print "   "; + print $taskstatic->getNomUrl(1, 'withproject', 'time'); + // Label task + print '
'; + for ($k = 0 ; $k < $level ; $k++) print "   "; + print $taskstatic->label; + //print "
"; + //for ($k = 0 ; $k < $level ; $k++) print "   "; + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); + print "\n"; + + // Date + print ''; + print dol_print_date($lines[$i]->timespent_datehour, 'day'); + print ''; + + $disabledproject=1;$disabledtask=1; + //print "x".$lines[$i]->fk_project; + //var_dump($lines[$i]); + //var_dump($projectsrole[$lines[$i]->fk_project]); + // If at least one role for project + if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) + { + $disabledproject=0; + $disabledtask=0; + } + // If $restricteditformytask is on and I have no role on task, i disable edit + if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) + { + $disabledtask=1; + } + + // Hour + print ''; + print dol_print_date($lines[$i]->timespent_datehour, 'hour'); + print ''; + + $cssonholiday=''; + if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; + elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; + elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; + + // Duration + print ''; + + $dayWorkLoad = $lines[$i]->timespent_duration; + $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; + + $alreadyspent=''; + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); + + print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); + + $modeinput='hours'; + + print ''; + + print ''; + + // Note + print ''; + print ''; + print ''; + + // Warning + print ''; + /*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); + else if ($disabledtask) + { + $titleassigntask = $langs->trans("AssignTaskToMe"); + if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); + + print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); + }*/ + print ''; + + print "\n"; + } //} //else //{ diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index af27cea4292..15ca4de37e0 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -105,18 +105,18 @@ function reception_admin_prepare_head() if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFields"); - $head[$h][2] = 'attributes_reception'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes_reception'; + $h++; } if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFieldsLines"); - $head[$h][2] = 'attributeslines_reception'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $head[$h][2] = 'attributeslines_reception'; + $h++; } diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index a4ddb68dbd3..b45eaa4b7a9 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -180,7 +180,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) if (! empty($location)) fwrite($calfileh, "LOCATION:".$encoding.$location."\n"); if ($fulldayevent) fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n"); - + // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2 if ($fulldayevent) fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n"); @@ -320,7 +320,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt fwrite($fichier, $form); $form=''."\n". -// 'fr'."\n". + // 'fr'."\n". 'Dolibarr'."\n". ''.$date.''."\n". 'Dolibarr'."\n"; diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 6be5e3904ab..93d1b37c690 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -177,13 +177,13 @@ class InterfaceLogevents extends DolibarrTriggers } // If not found -/* + /* else { dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); return 0; } -*/ + */ // Add more information into desc from the context property if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit']; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 5676bb82cfb..e72da40d6b0 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -251,7 +251,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_UNVALIDATE') { - // Load translation files required by the page + // Load translation files required by the page $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); @@ -808,9 +808,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg=$langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref); if ($object->oldcopy->fk_user_assign > 0) { - $tmpuser=new User($this->db); - $tmpuser->fetch($object->oldcopy->fk_user_assign); - $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs); + $tmpuser=new User($this->db); + $tmpuser->fetch($object->oldcopy->fk_user_assign); + $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs); } else { diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 301d565c2ba..b9dbd340d88 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -181,7 +181,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers case 'CONTACT_MODIFY': case 'CONTACT_DELETE': case 'CONTACT_ENABLEDISABLE': - + break; // Products // case 'PRODUCT_CREATE': // case 'PRODUCT_MODIFY': @@ -221,7 +221,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers case 'LINEORDER_INSERT': case 'LINEORDER_UPDATE': case 'LINEORDER_DELETE': - + break; // Supplier orders // case 'ORDER_SUPPLIER_CREATE': // case 'ORDER_SUPPLIER_CLONE': From 66a2dc4994244c0325665b92189ce83aac0d3553 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 20 Oct 2019 09:18:55 +0000 Subject: [PATCH 293/409] Fixing style errors. --- htdocs/core/lib/json.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 2ec1532a9a9..8c97bbb348f 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -317,19 +317,19 @@ function utf162utf8($utf16) switch(true) { case ((0x7F & $bytes) == $bytes): - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr($bytes); case (0x07FF & $bytes) == $bytes: - // return a 2-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xC0 | (($bytes >> 6) & 0x1F)) . chr(0x80 | ($bytes & 0x3F)); case (0xFFFF & $bytes) == $bytes: - // return a 3-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F)); From 4d13c724d921416f48212b3d9a87bfd039b69355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 11:20:25 +0200 Subject: [PATCH 294/409] restablish original rules --- dev/setup/codesniffer/ruleset.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 82582d2d18c..32c44ce91e4 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - + From 7581275316bae01e53ce32325965bdc6dce5dbda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 11:59:21 +0200 Subject: [PATCH 295/409] wip --- dev/setup/codesniffer/ruleset.xml | 3 +- htdocs/categories/class/categorie.class.php | 14 +- .../class/opensurveysondage.class.php | 2 +- htdocs/product/admin/price_rules.php | 8 +- htdocs/product/admin/product.php | 2 +- .../canvas/product/tpl/card_create.tpl.php | 4 +- .../canvas/product/tpl/card_view.tpl.php | 2 +- .../canvas/service/tpl/card_create.tpl.php | 4 +- .../canvas/service/tpl/card_view.tpl.php | 2 +- htdocs/product/card.php | 16 +-- htdocs/product/class/product.class.php | 134 +++++++++--------- .../product/inventory/ajax/ajax.inventory.php | 66 ++++----- htdocs/product/price.php | 34 ++--- htdocs/product/stock/card.php | 4 +- .../stock/class/mouvementstock.class.php | 4 +- htdocs/product/stock/massstockmove.php | 8 +- htdocs/product/stock/movement_list.php | 4 +- htdocs/product/stock/product.php | 4 +- htdocs/product/stock/productlot_card.php | 6 +- htdocs/product/stock/productlot_list.php | 6 +- htdocs/product/stock/replenish.php | 4 +- .../product/stock/tpl/stockcorrection.tpl.php | 94 ++++++------ .../product/stock/tpl/stocktransfer.tpl.php | 110 +++++++------- htdocs/projet/activity/perweek.php | 26 ++-- htdocs/projet/class/project.class.php | 36 ++--- htdocs/projet/class/task.class.php | 18 +-- htdocs/projet/element.php | 16 +-- htdocs/projet/graph_opportunities.inc.php | 8 +- htdocs/projet/list.php | 6 +- htdocs/projet/stats/index.php | 8 +- htdocs/projet/tasks.php | 6 +- htdocs/projet/tasks/contact.php | 4 +- htdocs/projet/tasks/task.php | 2 +- test/phpunit/BankAccountTest.php | 2 +- test/phpunit/BonPrelevementTest.php | 4 +- test/phpunit/ContratTest.php | 2 +- test/phpunit/ExportTest.php | 4 +- test/phpunit/FactureFournisseurTest.php | 2 +- test/phpunit/FactureTest.php | 2 +- test/phpunit/FichinterTest.php | 2 +- test/phpunit/FilesLibTest.php | 20 +-- test/phpunit/ImagesLibTest.php | 10 +- test/phpunit/PropalTest.php | 2 +- test/phpunit/RestAPIUserTest.php | 126 ++++++++-------- test/phpunit/SupplierProposalTest.php | 2 +- .../functional/TakePosFunctionalTest.php | 16 +-- 46 files changed, 429 insertions(+), 430 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 32c44ce91e4..82582d2d18c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index cd3885b77b1..d60b3251f0d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1835,13 +1835,13 @@ class Categorie extends CommonObject } } - // Call trigger - $result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user); - if ($result < 0) { - $this->error = $this->db->lasterror(); - return -1; - } - // End call triggers + // Call trigger + $result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -1; + } + // End call triggers return 1; } diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 48c633126ce..786ed7220b5 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -267,7 +267,7 @@ class Opensurveysondage extends CommonObject $this->db->free($resql); } else - { + { $this->error="Error ".$this->db->lasterror(); $ret=-1; } diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 299f78c1a7d..885af18d63d 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -168,10 +168,10 @@ $genPriceOptions = function ($level) use ($price_options) { echo $langs->trans('SellingPrice').' '.$i; // Label of price $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; - if (! empty($conf->global->$keyforlabel)) { - print ' - '.$langs->trans($conf->global->$keyforlabel); - } - ?> + if (! empty($conf->global->$keyforlabel)) { + print ' - '.$langs->trans($conf->global->$keyforlabel); + } + ?> diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 5fd289c5514..d6f636bf4c9 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -483,7 +483,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index 03e57a0c859..b12a0d41370 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -113,7 +113,7 @@ dol_fiche_head(''); trans("SellingPrice"); ?> -price_base_type; ?> + price_base_type; ?> trans("MinPrice"); ?> @@ -121,7 +121,7 @@ dol_fiche_head(''); trans("VATRate"); ?> -tva_tx; ?> + tva_tx; ?> diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 473b717c916..594fd6c1b9b 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> -photos; ?> + photos; ?> diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 0b33d722837..d51e1541278 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -85,7 +85,7 @@ dol_fiche_head(''); trans("SellingPrice"); ?> -price_base_type; ?> + price_base_type; ?> trans("MinPrice"); ?> @@ -93,7 +93,7 @@ dol_fiche_head(''); trans("VATRate"); ?> -tva_tx; ?> + tva_tx; ?> diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index c789853868a..a0fc691d75d 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> -photos; ?> + photos; ?> diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0af901b5abf..86a5cbe07c1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1453,13 +1453,13 @@ else print ''; if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Brut Length - print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print 'x'; - print 'x'; - print ' '; - print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); - print ''; + // Brut Length + print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print 'x'; + print 'x'; + print ' '; + print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); + print ''; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -2104,7 +2104,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = $html .= ''; } else - { + { $html .= ''; $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d7ab4e99c78..c55e888e405 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1603,85 +1603,85 @@ class Product extends CommonObject $price_base_type = $this->price_base_type; // If price per segment - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level)) + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level)) { - $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; - $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; - $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; - $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level]; - if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } - } + $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; + $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; + $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; + $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility + { + if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level]; + if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; + if (empty($tva_tx)) $tva_npr=0; + } + } // If price per customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - $prodcustprice = new Productcustomerprice($db); + $prodcustprice = new Productcustomerprice($db); - $filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id); + $filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines[0]->price); - $pu_ttc = price($prodcustprice->lines[0]->price_ttc); - $price_base_type = $prodcustprice->lines[0]->price_base_type; - $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; - } - } + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result) { + if (count($prodcustprice->lines) > 0) { + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $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; } + } + } // If price per quantity - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { - if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity + if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity + { + // Search price into product_price_by_qty from $this->id + foreach($this->prices_by_qty_list[0] as $priceforthequantityarray) + { + if ($priceforthequantityarray['rowid'] != $pqp) continue; + // We found the price + if ($priceforthequantityarray['price_base_type'] == 'HT') { - // Search price into product_price_by_qty from $this->id - foreach($this->prices_by_qty_list[0] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - break; - } + $pu_ht = $priceforthequantityarray['unitprice']; } + else + { + $pu_ttc = $priceforthequantityarray['unitprice']; + } + break; } + } + } // If price per quantity and customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity + if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity + { + // Search price into product_price_by_qty from $this->id + foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray) + { + if ($priceforthequantityarray['rowid'] != $pqp) continue; + // We found the price + if ($priceforthequantityarray['price_base_type'] == 'HT') { - // Search price into product_price_by_qty from $this->id - foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - break; - } + $pu_ht = $priceforthequantityarray['unitprice']; } + else + { + $pu_ttc = $priceforthequantityarray['unitprice']; + } + break; } + } + } return array('pu_ht'=>$pu_ht, 'pu_ttc'=>$pu_ttc, 'price_min'=>$price_min, 'price_base_type'=>$price_base_type, 'tva_tx'=>$tva_tx, 'tva_npr'=>$tva_npr); } @@ -4293,14 +4293,14 @@ class Product extends CommonObject { switch ($type) { - case 0: + case 0: return $this->LibStatut($this->status, $mode, $type); - case 1: + case 1: return $this->LibStatut($this->status_buy, $mode, $type); - case 2: + case 2: return $this->LibStatut($this->status_batch, $mode, $type); - default: - //Simulate previous behavior but should return an error string + default: + //Simulate previous behavior but should return an error string return $this->LibStatut($this->status_buy, $mode, $type); } } diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index f94a383f666..ced76050e31 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -6,45 +6,45 @@ require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; $get = GETPOST('get', 'alpha'); $put = GETPOST('put', 'alpha'); - switch ($put) - { - case 'qty': - if (empty($user->rights->stock->creer)) { echo -1; exit; } +switch ($put) +{ + case 'qty': + if (empty($user->rights->stock->creer)) { echo -1; exit; } - $fk_det_inventory = GETPOST('fk_det_inventory'); + $fk_det_inventory = GETPOST('fk_det_inventory'); - $det = new InventoryLine($db); - if( $det->fetch($fk_det_inventory)) - { - $det->qty_view+=GETPOST('qty'); - $res = $det->update($user); + $det = new InventoryLine($db); + if( $det->fetch($fk_det_inventory)) + { + $det->qty_view+=GETPOST('qty'); + $res = $det->update($user); - echo $det->qty_view; - } - else - { - echo -2; - } + echo $det->qty_view; + } + else + { + echo -2; + } - break; + break; - case 'pmp': - if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } + case 'pmp': + if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } - $fk_det_inventory = GETPOST('fk_det_inventory'); + $fk_det_inventory = GETPOST('fk_det_inventory'); - $det = new InventoryLine($db); - if( $det->fetch($fk_det_inventory)) - { - $det->new_pmp=price2num(GETPOST('pmp')); - $det->update($user); + $det = new InventoryLine($db); + if( $det->fetch($fk_det_inventory)) + { + $det->new_pmp=price2num(GETPOST('pmp')); + $det->update($user); - echo $det->new_pmp; - } - else - { - echo -2; - } + echo $det->new_pmp; + } + else + { + echo -2; + } - break; - } + break; +} diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 139fd681ee0..e8e332d95b5 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -475,10 +475,10 @@ if (empty($reshook)) { $priceid = GETPOST('priceid', 'int'); if (!empty($rowid)) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; - $sql .= " WHERE fk_product_price = " . $priceid; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; + $sql .= " WHERE fk_product_price = " . $priceid; - $result = $db->query($sql); + $result = $db->query($sql); } else { setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors'); } @@ -755,17 +755,17 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - // TVA - print '' . $langs->trans("DefaultTaxRate") . ''; + // TVA + print '' . $langs->trans("DefaultTaxRate") . ''; - $positiverates=''; - if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); - if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]); - if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]); - if (empty($positiverates)) $positiverates='0'; - echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr); - //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); - print ''; + $positiverates=''; + if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); + if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]); + if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr); + //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); + print ''; } else { @@ -791,10 +791,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI { if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - // We show only vat for level 1 - print '' . $langs->trans("DefaultTaxRate") . ''; - print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; - print ''; + // We show only vat for level 1 + print '' . $langs->trans("DefaultTaxRate") . ''; + print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; + print ''; } else { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 94a379c4e90..94012c1b9cf 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -68,8 +68,8 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || ! empty($ref)) { $ret = $object->fetch($id, $ref); -// if ($ret > 0) -// $ret = $object->fetch_thirdparty(); + // if ($ret > 0) + // $ret = $object->fetch_thirdparty(); if ($ret <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2b92a759ffa..24d8e89e03b 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -947,8 +947,8 @@ class MouvementStock extends CommonObject $result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php'); if ($result) { - $classname = ucfirst($origintype); - $origin = new $classname($this->db); + $classname = ucfirst($origintype); + $origin = new $classname($this->db); } } break; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 24d2af3a358..5324ef80243 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -195,7 +195,7 @@ if ($action == 'createmovements') if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) // If product does not need lot/serial { // Remove stock - $result1=$product->correct_stock( + $result1=$product->correct_stock( $user, $id_sw, $qty, @@ -211,7 +211,7 @@ if ($action == 'createmovements') } // Add stock - $result2=$product->correct_stock( + $result2=$product->correct_stock( $user, $id_tw, $qty, @@ -243,7 +243,7 @@ if ($action == 'createmovements') } // Remove stock - $result1=$product->correct_stock_batch( + $result1=$product->correct_stock_batch( $user, $id_sw, $qty, @@ -262,7 +262,7 @@ if ($action == 'createmovements') } // Add stock - $result2=$product->correct_stock_batch( + $result2=$product->correct_stock_batch( $user, $id_tw, $qty, diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ac00062cc6e..ef307842017 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -202,7 +202,7 @@ if ($action == "correct_stock") $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - $result=$product->correct_stock_batch( + $result=$product->correct_stock_batch( $user, $id, GETPOST("nbpiece", 'int'), @@ -217,7 +217,7 @@ if ($action == "correct_stock") } else { - $result=$product->correct_stock( + $result=$product->correct_stock( $user, $id, GETPOST("nbpiece", 'int'), diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index dbcd0a2cf61..060bcc57960 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -374,7 +374,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Remove stock - $result1=$object->correct_stock_batch( + $result1=$object->correct_stock_batch( $user, $srcwarehouseid, GETPOST("nbpiece", 'int'), @@ -389,7 +389,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Add stock - $result2=$object->correct_stock_batch( + $result2=$object->correct_stock_batch( $user, GETPOST("id_entrepot_destination", 'int'), GETPOST("nbpiece", 'int'), diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 76a4b0a46f7..00299c94459 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -180,7 +180,7 @@ if (empty($reshook)) { // Creation KO if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='create'; } } @@ -369,7 +369,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { -/*TODO if ($user->rights->stock->lire) + /*TODO if ($user->rights->stock->lire) { print ''."\n"; } @@ -378,7 +378,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''."\n"; } -*/ + */ } print ''."\n"; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index eedde6dcb31..9596c87c9d3 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -107,10 +107,10 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) - { + foreach($extrafields->attribute_label as $key => $val) + { if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + } } // Load object if id or ref is provided as parameter diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 6e7cdbc585b..b992be282d4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -492,7 +492,7 @@ if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alph $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; -print_barre_liste( + print_barre_liste( $texte, $page, 'replenish.php', @@ -511,7 +511,7 @@ print_barre_liste( $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; -print_barre_liste( + print_barre_liste( $texte, $page, 'replenish.php', diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index a17ce086e6c..63b80636d67 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -66,28 +66,28 @@ if (empty($conf) || ! is_object($conf)) { // Warehouse or product print ''; - if ($object->element == 'product') - { - print ''.$langs->trans("Warehouse").''; - print ''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); - print '   '; - print ''; - } - if ($object->element == 'stock') - { - print ''.$langs->trans("Product").''; - print ''; - print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print '   '; - print ''; - } +if ($object->element == 'product') +{ + print ''.$langs->trans("Warehouse").''; + print ''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print '   '; + print ''; +} +if ($object->element == 'stock') +{ + print ''.$langs->trans("Product").''; + print ''; + print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print '   '; + print ''; +} print ''.$langs->trans("NumberOfUnit").''; print ''; print ''; @@ -96,37 +96,37 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''.$langs->trans("UnitPurchaseValue").''; print ''; - if (! empty($conf->projet->enabled)) - { - print ''.$langs->trans('Project').''; - print ''; - $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); - print ''; - } +if (! empty($conf->projet->enabled)) +{ + print ''.$langs->trans('Project').''; + print ''; + $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); + print ''; +} print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && +if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) - { - print ''; - print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; - print ''; - print ''; - print ''; - print ''.$langs->trans("EatByDate").''; - $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); - print ''; - print ''.$langs->trans("SellByDate").''; - $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); - print ''; - print ''; - } +{ + print ''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("EatByDate").''; + $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); + print ''; + print ''.$langs->trans("SellByDate").''; + $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); + print ''; + print ''; +} // Label of mouvement of id of inventory $valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref)); diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 2f02df78eec..dc814e54790 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -40,18 +40,18 @@ if (empty($conf) || ! is_object($conf)) { $pdluo = new Productbatch($db); - if ($pdluoid > 0) - { - $result=$pdluo->fetch($pdluoid); - if ($result > 0) - { - $pdluoid=$pdluo->id; - } - else - { - dol_print_error($db, $pdluo->error, $pdluo->errors); - } - } +if ($pdluoid > 0) +{ + $result=$pdluo->fetch($pdluoid); + if ($result > 0) + { + $pdluoid=$pdluo->id; + } + else + { + dol_print_error($db, $pdluo->error, $pdluo->errors); + } +} print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic'); @@ -62,28 +62,28 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''; print ''; - if ($pdluoid) - { - print ''; - } +if ($pdluoid) +{ + print ''; +} print ''; // Source warehouse or product print ''; - if ($object->element == 'product') - { - print ''; - print ''; - } - if ($object->element == 'stock') - { - print ''; - print ''; - } +if ($object->element == 'product') +{ + print ''; + print ''; +} +if ($object->element == 'stock') +{ + print ''; + print ''; +} print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && +if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) - { - print ''; - print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; +{ + print ''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; - print ''; - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; + print ''; +} // Label $valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref)); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index f5db207a42e..e51b2e4b404 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -813,23 +813,23 @@ if (count($tasksarray) > 0) print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; print ''; - for ($idw = 0; $idw < 7; $idw++) + for ($idw = 0; $idw < 7; $idw++) { - $cssweekend=''; - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. - { - $cssweekend='weekend'; - } + $cssweekend=''; + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. + { + $cssweekend='weekend'; + } - $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); + $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); - $cssonholiday=''; - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; + $cssonholiday=''; + if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; + elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; + elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; - print ''; - } + print ''; + } print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index da2d41512e1..a873b53dbc0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -401,7 +401,7 @@ class Project extends CommonObject $result = 1; } else - { + { $this->db->rollback(); $result = -1; } @@ -1222,7 +1222,7 @@ class Project extends CommonObject // No filter. Use this if user has permission to see all project } - $sql.= $filter; + $sql.= $filter; //print $sql; $resql = $this->db->query($sql); @@ -1722,23 +1722,23 @@ class Project extends CommonObject $num = $this->db->num_rows($resql); $i = 0; // Loop on each record found, so each couple (project id, task id) - while ($i < $num) + while ($i < $num) { - $obj=$this->db->fetch_object($resql); - $day=$this->db->jdate($obj->task_date); // task_date is date without hours - if (empty($daylareadyfound[$day])) - { - $this->weekWorkLoad[$day] = $obj->task_duration; - $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; - } - else - { - $this->weekWorkLoad[$day] += $obj->task_duration; - $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; - } - $daylareadyfound[$day]=1; - $i++; - } + $obj=$this->db->fetch_object($resql); + $day=$this->db->jdate($obj->task_date); // task_date is date without hours + if (empty($daylareadyfound[$day])) + { + $this->weekWorkLoad[$day] = $obj->task_duration; + $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; + } + else + { + $this->weekWorkLoad[$day] += $obj->task_duration; + $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; + } + $daylareadyfound[$day]=1; + $i++; + } $this->db->free($resql); return 1; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e35b4b4bdad..1bd044bc985 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -852,15 +852,15 @@ class Task extends CommonObject $sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; $sql.=" t.dateo, t.datee, t.planned_workload, t.rang,"; $sql.=" s.rowid, s.nom, s.email,"; - $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; - if (!empty($extrafields->attributes['projet']['label'])) - { - foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); - } - if (!empty($extrafields->attributes['projet_task']['label'])) - { - foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); - } + $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; + if (!empty($extrafields->attributes['projet']['label'])) + { + foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); + } + if (!empty($extrafields->attributes['projet_task']['label'])) + { + foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); + } } $sql.= " ORDER BY p.ref, t.rang, t.dateo"; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 3a2886229a0..44b803571ba 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -863,8 +863,8 @@ foreach ($listofreferent as $key => $value) if (canApplySubtotalOn($tablename)) { - // Sort - $elementarray = sortElementsByClientName($elementarray); + // Sort + $elementarray = sortElementsByClientName($elementarray); } $num=count($elementarray); @@ -1077,9 +1077,9 @@ foreach ($listofreferent as $key => $value) if ($othermessage) print $othermessage; if (isset($total_ht_by_line)) { - if (! $qualifiedfortotal) print ''; - print price($total_ht_by_line); - if (! $qualifiedfortotal) print ''; + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; } if ($warning) print ' '.img_warning($warning); print ''; @@ -1124,9 +1124,9 @@ foreach ($listofreferent as $key => $value) if ($othermessage) print $othermessage; if (isset($total_ttc_by_line)) { - if (! $qualifiedfortotal) print ''; - print price($total_ttc_by_line); - if (! $qualifiedfortotal) print ''; + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; } if ($warning) print ' '.img_warning($warning); print ''; diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 5c5cd398354..7d75544ef93 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -35,11 +35,11 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $valsamount[$obj->opp_status]=$obj->opp_amount; $totalnb+=$obj->nb; if ($obj->opp_status) $totaloppnb+=$obj->nb; - if (! in_array($obj->code, array('WON', 'LOST'))) + if (! in_array($obj->code, array('WON', 'LOST'))) { - $totalamount+=$obj->opp_amount; - $ponderated_opp_amount+=$obj->ponderated_opp_amount; - } + $totalamount+=$obj->opp_amount; + $ponderated_opp_amount+=$obj->ponderated_opp_amount; + } } $total+=$row[0]; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9a5514ff1cc..8524e940f36 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -143,10 +143,10 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) - { + foreach($extrafields->attribute_label as $key => $val) + { if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + } } diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 9353f968116..f8480f8f322 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -108,7 +108,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) unset($data1); if ($nocolor) -$px->SetDataColor(array ( + $px->SetDataColor(array ( array ( 220, 220, @@ -130,9 +130,9 @@ $px->SetDataColor(array ( )); $px->SetTitle($langs->trans('OpportunitiesStatusForProjects')); $result=$px->draw($filenamenb, $fileurlnb); - if ($result<0) { - setEventMessages($px->error, null, 'errors'); - } + if ($result<0) { + setEventMessages($px->error, null, 'errors'); + } } else { setEventMessages(null, $mesgs, 'errors'); } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 3d4077790c7..2abfea6e64e 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -645,7 +645,7 @@ elseif ($id > 0 || ! empty($ref)) print '
'; -// Link to create task + // Link to create task $linktocreatetaskParam = array(); $linktocreatetaskUserRight = false; if ($user->rights->projet->all->creer || $user->rights->projet->creer) { @@ -787,8 +787,8 @@ elseif ($id > 0 || ! empty($ref)) print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); if ($object->usage_bill_time) { - print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); } if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 2448088c6b1..b09d8345177 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref)) /* * Lines of contacts */ -/* + /* // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); foreach($dirtpls as $reldir) @@ -364,7 +364,7 @@ if ($id > 0 || ! empty($ref)) $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } -*/ + */ /* * Add a new contact line diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index d9730946377..78431f983a4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -616,7 +616,7 @@ if ($id > 0 || ! empty($ref)) { if (! $object->hasChildren() && ! $object->hasTimeSpent()) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index 48e2a8ddb65..416a17f0c0f 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -169,7 +169,7 @@ class BankAccountTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testBankAccountOther * * @param Object $localobject Object contract diff --git a/test/phpunit/BonPrelevementTest.php b/test/phpunit/BonPrelevementTest.php index eb830e1f827..135c77dfa2d 100644 --- a/test/phpunit/BonPrelevementTest.php +++ b/test/phpunit/BonPrelevementTest.php @@ -173,7 +173,7 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase * @depends testBonPrelevementOther * The depends says test is run only if previous is ok */ -/* public function testBonPrelevementDelete($id) + /* public function testBonPrelevementDelete($id) { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -189,5 +189,5 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase $this->assertLessThan($result, 0); return $result; } -*/ + */ } diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index b64d3242edb..7c302105aa2 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -166,7 +166,7 @@ class ContratTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testContratOther * * @param Object $localobject Object contract diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 66ef42a9e15..7f440bf067d 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -265,7 +265,7 @@ class ExportTest extends PHPUnit\Framework\TestCase public function testExportPersonalizedWithFilter() { global $conf,$user,$langs,$db; -/* + /* $sql = "SELECT f.ref as f_ref, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f"; $objexport=new Export($db); @@ -303,7 +303,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $sql); $expectedresult=1; $this->assertEquals($expectedresult,$result); -*/ + */ return true; } diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index f346909e8b8..b277ba5c1b3 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -214,7 +214,7 @@ class FactureFournisseurTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFactureFournisseurOther * * @param Object $localobject Supplier invoice diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 34dd42b63f6..4e361895fcc 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -241,7 +241,7 @@ class FactureTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFactureOther * * @param Object $localobject Invoice diff --git a/test/phpunit/FichinterTest.php b/test/phpunit/FichinterTest.php index 60be4024e69..ba9408441a1 100644 --- a/test/phpunit/FichinterTest.php +++ b/test/phpunit/FichinterTest.php @@ -190,7 +190,7 @@ class FichinterTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFichinterValid * * @param Object $localobject Object intervention diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index d73d99f7078..776e783a6b0 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -150,11 +150,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase } - /** - * testDolCountNbOfLine - * - * @return int - */ + /** + * testDolCountNbOfLine + * + * @return int + */ public function testDolCountNbOfLine() { global $conf,$user,$langs,$db; @@ -171,11 +171,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase return $result; } - /** - * testDolIsFileDir - * - * @return int - */ + /** + * testDolIsFileDir + * + * @return int + */ public function testDolIsFileDir() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index a7fcaba25ce..71474ba1847 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -118,11 +118,11 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase print __METHOD__."\n"; } - /** - * testDolCountNbOfLine - * - * @return int - */ + /** + * testDolCountNbOfLine + * + * @return int + */ public function testgetImageSize() { $file=dirname(__FILE__).'/img250x50.jpg'; diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 955024baa91..709c5bbcfb7 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -239,7 +239,7 @@ class PropalTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testPropalOther * * @param Propal $localobject Proposal diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index b9658818d48..ea3970e5a4b 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -149,30 +149,30 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase */ public function testRestGetUser() { - global $conf,$user,$langs,$db; + global $conf,$user,$langs,$db; - $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; - //$addheaders=array('Content-Type: application/json'); + $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; + //$addheaders=array('Content-Type: application/json'); - print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); - //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(404, $object['error']['code']); + print __METHOD__." Request GET url=".$url."\n"; + $result=getURLContent($url, 'GET', '', 1, array()); + //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(404, $object['error']['code']); - $url = $this->api_url.'/users/1?api_key='.$this->api_key; + $url = $this->api_url.'/users/1?api_key='.$this->api_key; - print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); - //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(1, $object['statut']); + print __METHOD__." Request GET url=".$url."\n"; + $result=getURLContent($url, 'GET', '', 1, array()); + //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(1, $object['statut']); } /** @@ -183,52 +183,52 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase public function testRestCreateUser() { - // attemp to create without mandatory fields : - $url = $this->api_url.'/users?api_key='.$this->api_key; - $addheaders=array('Content-Type: application/json'); + // attemp to create without mandatory fields : + $url = $this->api_url.'/users?api_key='.$this->api_key; + $addheaders=array('Content-Type: application/json'); - $bodyobj = array( - "lastname"=>"testRestUser", - "password"=>"testRestPassword", - "email"=>"test@restuser.com" - ); - $body = json_encode($bodyobj); + $bodyobj = array( + "lastname"=>"testRestUser", + "password"=>"testRestPassword", + "email"=>"test@restuser.com" + ); + $body = json_encode($bodyobj); - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); - // create regular user - unset($result); - $bodyobj = array( - "login"=>"testRestLogin".mt_rand(), - "lastname"=>"testRestUser", - "password"=>"testRestPassword", - "email"=>"test@restuser.com" - ); - $body = json_encode($bodyobj); - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $resid=json_decode($result['content'], true); - $this->assertNotNull($resid, "Parsing of json result must no be null"); - $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); + // create regular user + unset($result); + $bodyobj = array( + "login"=>"testRestLogin".mt_rand(), + "lastname"=>"testRestUser", + "password"=>"testRestPassword", + "email"=>"test@restuser.com" + ); + $body = json_encode($bodyobj); + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $resid=json_decode($result['content'], true); + $this->assertNotNull($resid, "Parsing of json result must no be null"); + $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); - // attempt to create duplicated user - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); + // attempt to create duplicated user + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); } } diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php index aa91e8d533b..42d7e5842a6 100644 --- a/test/phpunit/SupplierProposalTest.php +++ b/test/phpunit/SupplierProposalTest.php @@ -231,7 +231,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testSupplierProposalOther * * @param SupplierProposal $localobject Proposal diff --git a/test/phpunit/functional/TakePosFunctionalTest.php b/test/phpunit/functional/TakePosFunctionalTest.php index e33a050cecf..597a893c67b 100644 --- a/test/phpunit/functional/TakePosFunctionalTest.php +++ b/test/phpunit/functional/TakePosFunctionalTest.php @@ -67,14 +67,14 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase ), // Geckodriver does not keep the session at the moment?! // XPath selectors also don't seem to work -// array( -// 'browser' => 'Mozilla Firefox on Linux', -// 'browserName' => 'firefox', -// 'sessionStrategy' => 'shared', -// 'desiredCapabilities' => array( -// 'marionette' => true -// ) -// ) + //array( + // 'browser' => 'Mozilla Firefox on Linux', + // 'browserName' => 'firefox', + // 'sessionStrategy' => 'shared', + // 'desiredCapabilities' => array( + // 'marionette' => true + // ) + //) ); /** From e5ef19cd0e25942696a755882940f5b72ad4a754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 12:10:07 +0200 Subject: [PATCH 296/409] restablish original rules --- .travis.yml | 3 +-- dev/setup/codesniffer/ruleset.xml | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e487822ad24..3a996915ca7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -295,8 +295,7 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . + if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 82582d2d18c..32c44ce91e4 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - + From bf1b2242ea94f4408c3569ab382678ed015b0848 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 13:22:29 +0200 Subject: [PATCH 297/409] Fix no focus if we are on edit mode directly --- htdocs/admin/accountant.php | 4 +-- htdocs/admin/company.php | 2 +- htdocs/admin/openinghours.php | 68 ++++++++++++++--------------------- htdocs/langs/en_US/other.lang | 1 + 4 files changed, 30 insertions(+), 45 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index e48f122c4b0..bfde50618cc 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -114,7 +114,7 @@ print ''."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Address print ''."\n"; // Code print ''."\n"; +print ''."\n"; // Note print ''."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Addresse diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index d931cdbf230..c29f6816a05 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -29,7 +29,7 @@ $action=GETPOST('action', 'aZ09'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search // Load translation files required by the page -$langs->loadLangs(array('admin', 'companies')); +$langs->loadLangs(array('admin', 'companies', 'other')); if (! $user->admin) accessforbidden(); @@ -66,6 +66,8 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) * View */ +$form = new Form($db); + $help_url=''; llxHeader('', $langs->trans("CompanyFoundation"), $help_url); @@ -75,12 +77,10 @@ $head = company_admin_prepare_head(); dol_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company'); -$form=new Form($db); - print ''.$langs->trans("OpeningHoursDesc")."
\n"; print "
\n"; -if ($action == 'edit' || $action == 'updateedit') +if (empty($action) || $action == 'edit' || $action == 'updateedit') { /** * Edit parameters @@ -92,66 +92,50 @@ if ($action == 'edit' || $action == 'updateedit') print '
'.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); - print ''.$langs->trans("Product").''; - print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print ''.$langs->trans("WarehouseSource").''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); + print ''.$langs->trans("Product").''; + print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); @@ -92,35 +92,35 @@ if (empty($conf) || ! is_object($conf)) { print '
'; - if ($pdluoid > 0) - { - // If form was opened for a specific pdluoid, field is disabled - print ''; - print ''; - } - else - { - print ''; - } - print '
'; + if ($pdluoid > 0) + { + // If form was opened for a specific pdluoid, field is disabled + print ''; + print ''; + } + else + { + print ''; + } + print '
'.$langs->trans("EatByDate").''; - print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''.$langs->trans("SellByDate").''; - print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print '
'.$langs->trans("EatByDate").''; + print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''.$langs->trans("SellByDate").''; + print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print '
 
 
 
'.$langs // Name print '
'; -print '
'; @@ -156,7 +156,7 @@ print '
'; -print '
'; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index e6ea9a2cb17..912995d7817 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -409,7 +409,7 @@ print '
'.$langs->trans( // Name print '
'; -print '
'; print ''."\n"; - print ''."\n"; + print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; print '
'.$langs->trans("Day").''.$langs->trans("Value").'
'; - print '
'; + print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; + print '
'; + print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; print '
'; print ''; - print '     '; - print ''; print '
'; print '
'; print ''; } -else -{ - /* - * Show parameters - */ - - print '
'; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Day").''.$langs->trans("Value").'
'.$langs->trans("Monday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) . '
'.$langs->trans("Tuesday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) . '
'.$langs->trans("Wednesday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) . '
'.$langs->trans("Thursday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) . '
'.$langs->trans("Friday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) . '
'.$langs->trans("Saturday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) . '
'.$langs->trans("Sunday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) . '
'; - print "
"; - - print ''; - - // Actions buttons - print '
'; - print ''; - print '
'; -} llxFooter(); diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 34590a924be..6e9b6d66f32 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -252,6 +252,7 @@ ThirdPartyCreatedByEmailCollector=Third party created by email collector from em ContactCreatedByEmailCollector=Contact/address created by email collector from email MSGID %s ProjectCreatedByEmailCollector=Project created by email collector from email MSGID %s TicketCreatedByEmailCollector=Ticket created by email collector from email MSGID %s +OpeningHoursFormatDesc=Use a - to separate opening and closing hours.
Use a space to enter different ranges.
Example: 8-12 14-18 ##### Export ##### ExportsArea=Exports area From 1f1945fc5c0bed38fa8a6de964950d44d8dd5cd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 13:32:27 +0200 Subject: [PATCH 298/409] Update index.php --- htdocs/mrp/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index b4f90b758a9..edc4ca4dff9 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -212,7 +212,7 @@ if ($resql) } } else { print ''; - print '' . $langs->trans("None") . ''; + print '' . $langs->trans("None") . ''; print ''; } print ""; From 54b78863319cda11b4f556b0e65809e569725802 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 13:40:18 +0200 Subject: [PATCH 299/409] Update api_orders.class.php --- htdocs/commande/class/api_orders.class.php | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 40732fbd045..5dddf4d0f6f 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -103,24 +103,6 @@ class Orders extends DolibarrApi return $this->_fetch('', '', $ref_ext, '', $contact_list); } - /** - * Get properties of an order object by ref_int - * - * Return an array with order informations - * - * @param string $ref_int Internal reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return array|mixed data without useless information - * - * @url GET byRefInt/{ref_int} - * - * @throws RestException - */ - public function getByRefInt($ref_int, $contact_list = 1) - { - return $this->_fetch('', '', '', $ref_int, $contact_list); - } - /** * Get properties of an order object * From 3b5e62947d1fdb21fbc889dbc55bfcbf4e5a9b1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 13:44:28 +0200 Subject: [PATCH 300/409] Update smtps.class.php --- htdocs/core/class/smtps.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index e8016b4bcfc..0c2a35f9f3f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -514,8 +514,9 @@ class SMTPs $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235'); break; } - if(!$_retVal) + if (! $_retVal) { $this->_setErr(130, 'Invalid Authentication Credentials.'); + } } else { From e95861c3610334b943c1c966eae954131b7aa8b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 13:48:01 +0200 Subject: [PATCH 301/409] Update smtps.class.php --- htdocs/core/class/smtps.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 0c2a35f9f3f..cd6f64c3242 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -496,6 +496,10 @@ class SMTPs return $_retVal; } } + + // Default authentication method is LOGIN + if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN'; + // Send Authentication to Server // Check for errors along the way switch ($conf->global->MAIL_SMTP_AUTH_TYPE) { From 89b0730483d6ee174d9668c1e3a7224af1d5fb94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 13:49:36 +0200 Subject: [PATCH 302/409] Update actioncomm.class.php --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6dbc0e832ef..d51eddb3898 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1566,7 +1566,7 @@ class ActionComm extends CommonObject $event['url']=$url; $event['created']=$this->db->jdate($obj->datec)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); $event['modified']=$this->db->jdate($obj->datem)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); - + if ($qualified && $datestart) { $eventarray[]=$event; From d79114c1f813810b33ab3bf17e989cee459c73f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 15:16:40 +0200 Subject: [PATCH 303/409] Clean code --- htdocs/contact/class/contact.class.php | 2 +- htdocs/core/class/utils.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/expensereport/export_csv.php | 195 ------------------------- htdocs/install/lib/repair.lib.php | 2 +- htdocs/mrp/index.php | 58 +------- htdocs/product/admin/price_rules.php | 3 +- htdocs/takepos/ajax/ajax.php | 29 +++- htdocs/takepos/takepos.php | 2 +- 9 files changed, 34 insertions(+), 261 deletions(-) delete mode 100644 htdocs/expensereport/export_csv.php diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a17f6f27259..3465b3478a0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -628,7 +628,7 @@ class Contact extends CommonObject if ($this->birthday_alert) { //check existing - $sql_check = "SELECT * FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; + $sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $result_check = $this->db->query($sql_check); if (! $result_check || ($this->db->num_rows($result_check)<1)) { diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index cb4e7ef9e5a..3b381bc5796 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1004,7 +1004,7 @@ class Utils if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n"); else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n"); - $sql='SELECT * FROM '.$table; + $sql='SELECT * FROM '.$table; // Here SELECT * is allowed because we don't have definition of columns to take $result = $db->query($sql); while($row = $db->fetch_row($result)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ecdebb1c27a..24f01827e15 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7928,7 +7928,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield if (!isset($dictvalues[$tablename])) { $dictvalues[$tablename] = array(); - $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; + $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields if ($checkentity) $sql.= ' AND entity IN (0,'.getEntity($tablename).')'; $resql = $db->query($sql); diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php deleted file mode 100644 index d3f2518a53c..00000000000 --- a/htdocs/expensereport/export_csv.php +++ /dev/null @@ -1,195 +0,0 @@ - - * Copyright (C) 2018 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 - * 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/expensereport/index.php - * \ingroup expensereport - * \brief Page list of expenses - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; - -// Load translation files required by the page -$langs->loadlangs(array('users', 'trips')); - -if(!$user->rights->expensereport->export_csv) { - accessforbidden(); - exit(); -} - -// Security check -$socid = $_GET["socid"]?$_GET["socid"]:''; -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'expensereport', '', ''); - -$req = "SELECT * FROM ".MAIN_DB_PREFIX."rights_def WHERE id = '178'"; -$result = $db->query($req); -$num = $db->num_rows($result); - -if($num < 1) { - $insert = "INSERT INTO ".MAIN_DB_PREFIX."rights_def ("; - $insert.= "`id` ,"; - $insert.= "`libelle` ,"; - $insert.= "`module` ,"; - $insert.= "`entity` ,"; - $insert.= "`perms` ,"; - $insert.= "`subperms` ,"; - $insert.= "`type` ,"; - $insert.= "`bydefault`"; - $insert.= ")"; - $insert.= "VALUES ("; - $insert.= "'178', 'Exporter les notes de frais au format CSV', 'expensereport', '1', 'export_csv', NULL , 'r', '0'"; - $insert.= ")"; - - $req = $db->query($insert); -} - - -/* - * View - */ - -llxHeader(); - -print load_fiche_titre($langs->trans("ExportTripCSV")); - -print '
'; - -print '
'; -print ''; -print '

Choisir le mois à exporter : '; - -$year = date('Y', time()); -$month = date('m', time()); - -print ' '; - -print ' '; - -print ''; -print '

'; -print '
'."\n"; - -// Si c'est une action -if (isset($_POST['action'])) -{ - if($_POST['action'] == 'export') - { - $dateselected = $_POST['annee'].'-'.$_POST['mois']; - - //var_dump($conf->expensereport->dir_output.'/export/'); - if (!file_exists($conf->expensereport->dir_output.'/export/')) - { - dol_mkdir($conf->expensereport->dir_output.'/export/'); - } - - $dir = $conf->expensereport->dir_output.'/export/expensereport-'.$dateselected.'.csv'; - $outputlangs = $langs; - $outputlangs->charset_output = 'UTF-8'; - - $sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= ' AND d.entity IN ('.getEntity('expensereport').')'; - $sql.= " ORDER BY d.rowid"; - - $result = $db->query($sql); - $num = $db->num_rows($result); - if ($num) - { - $open = fopen($dir, "w+"); - - $ligne = "ID, Référence, ----, Date paiement, Montant HT, TVA, Montant TTC\n"; - for ($i = 0; $i < $num; $i++) - { - $ligne.= "----, ----, ----, ----, ----, ----, ----\n"; - $objet = $db->fetch_object($result); - $objet->total_ht = number_format($objet->total_ht, 2); - $objet->total_tva = number_format($objet->total_tva, 2); - $objet->total_ttc = number_format($objet->total_ttc, 2); - $objet->ref = trim($objet->ref); - $ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n"; - - $ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n"; - - - $sql2 = "SELECT de.rowid, t.label as libelle, de.comments, de.total_ht, de.total_tva, de.total_ttc"; - $sql2.= " FROM ".MAIN_DB_PREFIX."expensereport_det as de,"; - $sql2.= " ".MAIN_DB_PREFIX."c_type_fees as t"; - $sql2.= " WHERE de.fk_c_type_fees = t.id"; - $sql2.= " AND de.fk_expensereport = '".$objet->rowid."'"; - $sql2.= " ORDER BY de.date"; - - $result2 = $db->query($sql2); - $num2 = $db->num_rows($result2); - - if($num2) { - for ($a = 0; $a < $num2; $a++) - { - $objet2 = $db->fetch_object($result2); - $objet2->total_ht = number_format($objet2->total_ht, 2); - $objet2->total_tva = number_format($objet2->total_tva, 2); - $objet2->total_ttc = number_format($objet2->total_ttc, 2); - $objet2->comments = str_replace(',', ';', $objet2->comments); - $objet2->comments = str_replace("\r\n", ' ', $objet2->comments); - $objet2->comments = str_replace("\n", ' ', $objet2->comments); - - $ligne.= "--->, {$objet2->rowid}, {$objet2->libelle}, {$objet2->comments}, {$objet2->total_ht}, {$objet2->total_tva}, {$objet2->total_ttc}\n"; - } - } - } - - $ligne = $outputlangs->convToOutputCharset($ligne); - - fwrite($open, $ligne); - fclose($open); - - print 'Télécharger le fichier expensereport-'.$dateselected.'.csv'; - } else { - print ''.$langs->trans('NoTripsToExportCSV').''; - } - } -} - -print '
'; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/install/lib/repair.lib.php b/htdocs/install/lib/repair.lib.php index 98eac2437fa..dc6544fc2be 100644 --- a/htdocs/install/lib/repair.lib.php +++ b/htdocs/install/lib/repair.lib.php @@ -72,7 +72,7 @@ function checkLinkedElements($sourcetype, $targettype) $out = $langs->trans('SourceType').': '.$sourcetype.' => '.$langs->trans('TargetType').': '.$targettype.' '; - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX .'element_element'; + $sql = 'SELECT rowid, fk_source, fk_target FROM '.MAIN_DB_PREFIX .'element_element'; $sql.= ' WHERE sourcetype="'.$sourcetype.'" AND targettype="'.$targettype.'"'; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index b6c20cde620..098aef21144 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -60,17 +60,9 @@ print '
'; if ($conf->use_javascript_ajax) { -/* $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql.= " FROM ".MAIN_DB_PREFIX."mrp_xxx as p"; - $sql.= " WHERE p.entity IN (".getEntity('project').")"; - $sql.= " AND p.fk_opp_status = cls.rowid"; - $sql.= " AND p.fk_statut = 1"; // Opend projects only - if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - $sql.= " GROUP BY p.fk_opp_status, cls.code"; - */ - $sql= "SELECT * FROM ".MAIN_DB_PREFIX."bom_bom WHERE 1 = 2"; - + $sql= "SELECT COUNT(t.rowid) as nb, status"; + $sql.=" FROM ".MAIN_DB_PREFIX."mrp_mo as t"; + $sql.=" GROUP BY t.status"; $resql = $db->query($sql); if ($resql) @@ -79,11 +71,6 @@ if ($conf->use_javascript_ajax) $i = 0; $totalnb=0; - $totaloppnb=0; - $totalamount=0; - $ponderated_opp_amount=0; - $valsnb=array(); - $valsamount=array(); $dataseries=array(); // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not) while ($i < $num) @@ -93,50 +80,18 @@ if ($conf->use_javascript_ajax) { //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) { - $valsnb[$obj->opp_status]=$obj->nb; - $valsamount[$obj->opp_status]=$obj->opp_amount; + $dataseries[$obj->status]=$obj->nb; $totalnb+=$obj->nb; - if ($obj->opp_status) $totaloppnb+=$obj->nb; - if (! in_array($obj->code, array('WON', 'LOST'))) - { - $totalamount+=$obj->opp_amount; - $ponderated_opp_amount+=$obj->ponderated_opp_amount; - } } - $total+=$row[0]; } $i++; } $db->free($resql); - $ponderated_opp_amount = $ponderated_opp_amount / 100; - print '
'; print ''; print ''."\n"; - /*$listofstatus=array_keys($listofoppstatus); - foreach ($listofstatus as $status) - { - $labelstatus = ''; - - $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); - if ($code) $labelstatus = $langs->trans("OppStatus".$code); - if (empty($labelstatus)) $labelstatus=$listofopplabel[$status]; - - //$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; - //$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%'; - - $dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0)); - if (! $conf->use_javascript_ajax) - { - - print ''; - print ''; - print ''; - print "\n"; - } - }*/ - if ($conf->use_javascript_ajax) + if ($conf->use_javascript_ajax) { print ''; } - //if ($totalinprocess != $total) print "
'.$langs->trans("Statistics").'
'.$labelstatus.''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'
'; @@ -149,11 +104,10 @@ if ($conf->use_javascript_ajax) $dolgraph->setWidth('100%'); $dolgraph->SetHeight(180); $dolgraph->draw('idgraphstatus'); - print $dolgraph->show($totaloppnb?0:1); + print $dolgraph->show($totalnb?0:1); print '
"; print "
"; diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 885af18d63d..ea3f8b5e663 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -97,7 +97,8 @@ if ($_POST) { * View */ -$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product_pricerules"; +$sql = "SELECT rowid, level, fk_level, var_percent, var_min_percent"; +$sql.= " FROM ".MAIN_DB_PREFIX."product_pricerules"; $query = $db->query($sql); $rules = array(); diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 3574b4d29a2..69228b5efb5 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -45,18 +45,31 @@ $term = GETPOST('term', 'alpha'); if ($action=="getProducts") { $object = new Categorie($db); $result=$object->fetch($category); - $prods = $object->getObjectsInCateg("product"); - echo json_encode($prods); + if ($result) + { + $prods = $object->getObjectsInCateg("product"); + echo json_encode($prods); + } + else + { + echo 'Failed to load category with id='.$category; + } } elseif ($action=="search" && $term != '') { - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; + $sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product'; $sql.= ' WHERE entity IN ('.getEntity('product').')'; $sql.= ' AND tosell = 1'; $sql.= natural_search(array('ref','label','barcode'), $term); $resql = $db->query($sql); - $rows = array(); - while ($row = $db->fetch_array($resql)) { - $rows[] = $row; - } - echo json_encode($rows); + if ($resql) + { + $rows = array(); + while ($row = $db->fetch_object($resql)) { + $rows[] = $row; + } + echo json_encode($rows); + } + else { + echo 'Failed to search product : '.$db->lasterror(); + } } diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 37258da056c..eec367b1af0 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -254,7 +254,7 @@ function LoadProducts(position, issubcat) { idata=0; //product data counter $.getJSON('/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) { console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs"); - + console.log(data); while (ishow < maxproduct) { //console.log("ishow"+ishow+" idata="+idata); console.log(data[idata]); From f999430fd33eb9479b1b2f504410dc57e79779df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 15:24:52 +0200 Subject: [PATCH 304/409] FIX Clean the + of categories on the product view only in POS module --- htdocs/takepos/takepos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index eec367b1af0..d3a0f466fc8 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -419,7 +419,7 @@ function New() { function Search2() { console.log("Search2 Call ajax search to replace products"); pageproducts=0; - jQuery(".catwatermark").hide(); + jQuery(".wrapper2 .catwatermark").hide(); $.getJSON('/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined"){ From 4fb0d03500b6932c1dac73c64a7e75da8e6f111f Mon Sep 17 00:00:00 2001 From: c3do Date: Sun, 20 Oct 2019 15:25:18 +0200 Subject: [PATCH 305/409] NEW Add API to get Country by code and iso --- htdocs/api/class/api_setup.class.php | 57 ++++++++++++++++++++++++++-- htdocs/core/class/ccountry.class.php | 26 +++++++------ 2 files changed, 68 insertions(+), 15 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 60f5a54eeba..4048ec62f8a 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -197,13 +197,64 @@ class Setup extends DolibarrApi * @throws RestException */ public function getCountryByID($id, $lang = '') + { + return $this->_fetchCcountry($id, '', '', $lang); + } + + /** + * Get country by Code. + * + * @param string $code Code of country + * @param string $lang Code of the language the name of the + * country must be translated to + * @return array Array of cleaned object properties + * + * @url GET dictionary/countries/byCode/{code} + * + * @throws RestException + */ + public function getCountryByCode($code, $lang = '') + { + return $this->_fetchCcountry('', $code, '', $lang); + } + + /** + * Get country by Iso. + * + * @param string $iso ISO of country + * @param string $lang Code of the language the name of the + * country must be translated to + * @return array Array of cleaned object properties + * + * @url GET dictionary/countries/byISO/{iso} + * + * @throws RestException + */ + public function getCountryByISO($iso, $lang = '') + { + return $this->_fetchCcountry('', '', $iso, $lang); + } + + /** + * Get country. + * + * @param int $id ID of country + * @param string $code Code of country + * @param string $iso ISO of country + * @param string $lang Code of the language the name of the + * country must be translated to + * @return array Array of cleaned object properties + * + * @throws RestException + */ + private function _fetchCcountry($id, $code = '', $iso = '', $lang = '') { $country = new Ccountry($this->db); - if ($country->fetch($id) < 0) { + $result = $country->fetch($id, $code, $iso); + if ($result < 0) { throw new RestException(503, 'Error when retrieving country : '.$country->error); - } - elseif ($country->fetch($id) == 0) { + } elseif ($result == 0) { throw new RestException(404, 'country not found'); } diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 84defbfd163..edbceec50fd 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -163,22 +163,24 @@ class Ccountry // extends CommonObject /** * Load object in memory from database * - * @param int $id Id object - * @param string $code Code + * @param int $id Id object + * @param string $code Code + * @param string $code_iso Code ISO * @return int >0 if OK, 0 if not found, <0 if KO */ - public function fetch($id, $code = '') + public function fetch($id, $code = '', $code_iso = '') { global $langs; - $sql = "SELECT"; - $sql.= " t.rowid,"; - $sql.= " t.code,"; - $sql.= " t.code_iso,"; - $sql.= " t.label,"; - $sql.= " t.active"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_country as t"; - if ($id) $sql.= " WHERE t.rowid = ".$id; - elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; + $sql = "SELECT"; + $sql.= " t.rowid,"; + $sql.= " t.code,"; + $sql.= " t.code_iso,"; + $sql.= " t.label,"; + $sql.= " t.active"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_country as t"; + if ($id) $sql.= " WHERE t.rowid = ".$id; + elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; + elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); From e224170dc2691a679ff3a63be65b8c9b7d904c16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 15:24:52 +0200 Subject: [PATCH 306/409] FIX Clean the + of categories on the product view only in POS module Conflicts: htdocs/takepos/takepos.php --- htdocs/takepos/takepos.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 311bcd00d8b..57ecf5d776b 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -408,9 +408,9 @@ function New() { function Search2() { console.log("Search2"); pageproducts=0; - jQuery(".catwatermark").hide(); - $.getJSON('./ajax.php?action=search&term='+$('#search').val(), function(data) { - for (i = 0; i < 30; i++) { + jQuery(".wrapper2 .catwatermark").hide(); + $.getJSON('/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) { + for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined"){ $("#prodesc"+i).text(""); $("#proimg"+i).attr("src","genimg/empty.png"); From 45d64e468fad3e244f2e2d26331154e6f78dff03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 15:29:15 +0200 Subject: [PATCH 307/409] Fix regression --- htdocs/takepos/takepos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 57ecf5d776b..339bbaa0643 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -409,7 +409,7 @@ function Search2() { console.log("Search2"); pageproducts=0; jQuery(".wrapper2 .catwatermark").hide(); - $.getJSON('/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) { + $.getJSON('./ajax.php?action=search&term='+$('#search').val(), function(data) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined"){ $("#prodesc"+i).text(""); From 05352a62e546c4fdd358361c5f6a0491fa6dd97b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 15:37:20 +0200 Subject: [PATCH 308/409] css --- htdocs/takepos/css/pos.css | 2 +- htdocs/takepos/invoice.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 91c29d73ac1..db3ddfdfa34 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -132,7 +132,7 @@ table.postablelines tr td { div.paymentbordline { width:50%; - background-color:#666; + background-color:#888; border-radius: 8px; margin-bottom: 4px; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index fad734591ed..6a67d9d03f9 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -658,7 +658,7 @@ if ($placeid > 0) { //In Phone basic layout hide some content depends situation if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice" && $action!="order") return; - + if (is_array($invoice->lines) && count($invoice->lines)) { $tmplines = array_reverse($invoice->lines); @@ -718,10 +718,12 @@ print ''; if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) { - $soc = new Societe($db); + $constforcompanyid='CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; + $soc = new Societe($db); if ($invoice->socid > 0) $soc->fetch($invoice->socid); - else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}); - print '

'; + else $soc->fetch($conf->global->$constforcompanyid); + print ''; + print '

'; print $langs->trans("Customer").': '.$soc->name; $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; @@ -732,15 +734,13 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep $warehouse->fetch($conf->global->$constantforkey); print '
'.$langs->trans("Warehouse").': '.$warehouse->ref; } - print '

'; // Module Adherent if (! empty($conf->adherent->enabled)) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $langs->load("members"); - print '

'; - print $langs->trans("Member").': '; + print '
'.$langs->trans("Member").': '; $adh=new Adherent($db); $result=$adh->fetch('', '', $invoice->socid); if ($result > 0) @@ -765,8 +765,8 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } - print '

'; } + print '

'; } if ($action == "search") From bc6fb547982051002650a092e137782530e478c2 Mon Sep 17 00:00:00 2001 From: c3do Date: Sun, 20 Oct 2019 15:56:27 +0200 Subject: [PATCH 309/409] New Add API to get List of Shipment methods --- htdocs/api/class/api_setup.class.php | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 4048ec62f8a..6223744955e 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -371,6 +371,66 @@ class Setup extends DolibarrApi } } + /** + * Get the list of shipment methods. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * + * @return array List of shipment methods + * + * @url GET dictionary/shipment_methods + * + * @throws RestException + */ + public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + $sql = "SELECT t.code, t.libelle, t.description, t.tracking"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t"; + $sql.= " WHERE t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of shipment methods : '.$this->db->lasterror()); + } + + return $list; + } + /** * Get the list of events types. * From e909d16880d25313f6abe633b48ff48eaa0827f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2019 15:57:32 +0200 Subject: [PATCH 310/409] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index d1c8b22d96f..f2add251e28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ FIX: #12041 FIX: #12054 FIX: #12083 FIX: #12088 +FIX: Clean the + of categories on the product view only in POS module FIX: access to public interface when origin email has an alias. FIX: Alias name is not into the email recipient label. FIX: allow standalone credit note even if no invoice From 0ede8175880bf9dc51922d3d35cd115d081e76a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 16:56:47 +0200 Subject: [PATCH 311/409] do not ignore lines with mix od tabs and spaces --- dev/setup/codesniffer/ruleset.xml | 2 +- .../interface_20_modWorkflow_WorkflowManager.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 32c44ce91e4..8c01eea6d99 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -201,7 +201,7 @@ - + diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index f9d33495764..2e14d0c7f47 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -131,7 +131,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $ret = 0; - + // First classify billed the order to allow the proposal classify process if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { @@ -175,7 +175,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } - + return $ret; } From 86f22c45633f9c0ac4dd5297889099a253b06b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2019 17:17:22 +0200 Subject: [PATCH 312/409] do not ignore lines with mix od tabs and spaces --- dev/initdata/generate-invoice.php | 2 +- dev/initdata/generate-proposal.php | 4 ++-- htdocs/bom/bom_list.php | 6 +++--- htdocs/bom/class/api_boms.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/mailing/info.php | 8 ++++---- htdocs/compta/deplacement/info.php | 6 +++--- htdocs/compta/paiement/class/cpaiement.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/lessc.class.php | 2 +- htdocs/core/class/smtps.class.php | 4 ++-- htdocs/core/class/translate.class.php | 2 +- htdocs/core/lib/invoice.lib.php | 4 ++-- htdocs/core/lib/loan.lib.php | 2 +- htdocs/core/lib/member.lib.php | 2 +- htdocs/core/lib/memory.lib.php | 8 ++++---- htdocs/core/menus/standard/auguria_menu.php | 6 +++--- htdocs/core/menus/standard/eldy_menu.php | 2 +- htdocs/core/modules/modProduct.class.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- .../core/tpl/extrafields_list_print_fields.tpl.php | 2 +- htdocs/hrm/admin/admin_hrm.php | 12 ++++++------ htdocs/product/class/product.class.php | 4 ++-- htdocs/product/inventory/list.php | 6 +++--- htdocs/product/stats/facture.php | 2 +- htdocs/societe/class/api_thirdparties.class.php | 6 +++--- htdocs/takepos/admin/receipt.php | 4 ++-- test/phpunit/BOMTest.php | 2 +- 28 files changed, 54 insertions(+), 54 deletions(-) diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index bfdda2896a1..0c754b1c874 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -152,7 +152,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) $fuser = new User($db); $fuser->fetch(mt_rand(1, 2)); $fuser->getRights(); - + $result=$object->create($fuser); if ($result >= 0) { diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 30c9471a281..ad8cf6025bb 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -176,7 +176,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $fuser = new User($db); $fuser->fetch(mt_rand(1, 2)); $fuser->getRights(); - + $object->contactid = $contids[$socids[$socid]][0]; $object->socid = $socids[$socid]; $object->datep = $dates[mt_rand(1, count($dates)-1)]; @@ -200,7 +200,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) } $xnbp++; } - + $result=$object->valid($fuser); if ($result > 0) { diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 46473d52ddb..6e192a06545 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -454,12 +454,12 @@ while ($i < min($num, $limit)) $cssforfield=(empty($val['css'])?'':$val['css']); if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right'; - + if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index f6b25d0cca7..471fb4f2cce 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -100,7 +100,7 @@ class Boms extends DolibarrApi $obj_ret = array(); $tmpobject = new BOM($db); - + $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1314463cd2a..871ec6b9ed2 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1543,7 +1543,7 @@ class ActionComm extends CommonObject $event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type']=$type; $datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); - + // fix for -> Warning: A non-numeric value encountered if(is_numeric($this->db->jdate($obj->datep2))) { diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 0dbc6fc07ab..7b270e460c8 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -58,11 +58,11 @@ if ($object->fetch($id) >= 0) $morehtmlright=''; if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; - + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); - + print '

'; - + //print '
'; $object->user_creation=$object->user_creat; $object->date_creation=$object->date_creat; @@ -70,7 +70,7 @@ if ($object->fetch($id) >= 0) $object->date_validation=$object->date_valid; dol_print_object_info($object, 0); //print '
'; - + dol_fiche_end(); } diff --git a/htdocs/compta/deplacement/info.php b/htdocs/compta/deplacement/info.php index a0accd11a87..510675265a0 100644 --- a/htdocs/compta/deplacement/info.php +++ b/htdocs/compta/deplacement/info.php @@ -47,15 +47,15 @@ if ($id) $object = new Deplacement($db); $object->fetch($id); $object->info($id); - + $head = trip_prepare_head($object); - + dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip'); print '
'; dol_print_object_info($object); print '
'; - + print '
'; } diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index a4e115dfdb0..37614f7e36e 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -34,7 +34,7 @@ class Cpaiement * @var string Id to identify managed objects */ public $element = 'cpaiement'; - + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 61558434105..6d26e585435 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5614,7 +5614,7 @@ class Form }; var d = new Date();"; } - + // Generate the date part, depending on the use or not of the javascript calendar if($addnowlink==1) // server time expressed in user time setup { diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 396991b6612..2da23504440 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -3900,4 +3900,4 @@ class lessc_formatter_lessjs extends lessc_formatter_classic { public $breakSelectors = true; public $assignSeparator = ": "; public $selectorSeparator = ","; -} \ No newline at end of file +} diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index cd6f64c3242..d950f92b3c2 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -496,10 +496,10 @@ class SMTPs return $_retVal; } } - + // Default authentication method is LOGIN if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN'; - + // Send Authentication to Server // Check for errors along the way switch ($conf->global->MAIL_SMTP_AUTH_TYPE) { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 3780ab35b06..f3bc9daf24b 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -781,7 +781,7 @@ class Translate if (preg_match('/^[a-z]+_[A-Z]+/i', $dir)) { $this->load("languages"); - + if (! empty($conf->global->MAIN_LANGUAGES_ALLOWED) && ! in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED)) ) continue; if ($usecode == 2) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 739e115efb1..0b06d21c95d 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -136,14 +136,14 @@ function invoice_admin_prepare_head() $head[$h][1] = $langs->trans("Payments"); $head[$h][2] = 'payment'; $h++; - + if($conf->global->INVOICE_USE_SITUATION){ $head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php'; $head[$h][1] = $langs->trans("InvoiceSituation"); $head[$h][2] = 'situation'; $h++; } - + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index bc7b0034b35..4d47c79e6da 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -40,7 +40,7 @@ function loan_prepare_head($object) $head[$tab][1] = $langs->trans('Card'); $head[$tab][2] = 'card'; $tab++; - + $head[$tab][0] = DOL_URL_ROOT.'/loan/schedule.php?loanid='.$object->id; $head[$tab][1] = $langs->trans('FinancialCommitment'); $head[$tab][2] = 'FinancialCommitment'; diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 93146738f66..6068246341e 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -127,7 +127,7 @@ function member_type_prepare_head(AdherentType $object) $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; - + // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) { diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index d353cca0097..22e660b2e22 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -55,7 +55,7 @@ function dol_setcache($memoryid, $data) $result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); if (! $result) return -1; } - + $memoryid=session_name().'_'.$memoryid; //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); $dolmemcache->add($memoryid, $data); // This fails if key already exists @@ -79,7 +79,7 @@ function dol_setcache($memoryid, $data) $result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); if (! $result) return -1; } - + $memoryid=session_name().'_'.$memoryid; //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); $result=$dolmemcache->add($memoryid, $data); // This fails if key already exists @@ -122,7 +122,7 @@ function dol_getcache($memoryid) $result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); if (! $result) return -1; } - + $memoryid=session_name().'_'.$memoryid; //$m->setOption(Memcached::OPT_COMPRESSION, false); //print "Get memoryid=".$memoryid; @@ -149,7 +149,7 @@ function dol_getcache($memoryid) $result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); if (! $result) return -1; } - + $memoryid=session_name().'_'.$memoryid; //$m->setOption(Memcached::OPT_COMPRESSION, false); $data=$m->get($memoryid); diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index b3c5814240c..adee27687dd 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -113,7 +113,7 @@ class MenuManager $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu); $this->tabMenu=$tabMenu; //var_dump($tabMenu); - + //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } } @@ -152,7 +152,7 @@ class MenuManager if ($mode == 'top') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); if ($mode == 'left') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); } - + if ($mode == 'topnb') { print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); @@ -327,7 +327,7 @@ class MenuManager } unset($this->menu); - + //print 'xx'.$mode; return 0; } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 8389db029be..089194aec2a 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -65,7 +65,7 @@ class MenuManager public function loadMenu($forcemainmenu = '', $forceleftmenu = '') { global $conf, $user, $langs; - + // On sauve en session le menu principal choisi if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 1db0db2e6f5..0729f4a71ef 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -85,7 +85,7 @@ class modProduct extends DolibarrModules $this->const[$r][3] = 'Module to control product codes'; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "PRODUCT_PRICE_UNIQ"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "1"; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 0d4f86ca82a..319f563ad28 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -198,7 +198,7 @@ class pdf_cyan extends ModelePDFPropales if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 35aefb9f719..ca30eb5ae92 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -50,7 +50,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ $value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1); //var_dump($value); } - + print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); print ''; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/hrm/admin/admin_hrm.php b/htdocs/hrm/admin/admin_hrm.php index 243a1ce3222..343e6fa54e9 100644 --- a/htdocs/hrm/admin/admin_hrm.php +++ b/htdocs/hrm/admin/admin_hrm.php @@ -42,15 +42,15 @@ $list = array ( */ if ($action == 'update') { $error = 0; - + foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); - + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error ++; } } - + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -87,13 +87,13 @@ print "\n"; foreach ($list as $key) { $var = ! $var; - + print ''; - + // Param $label = $langs->trans($key); print ''; - + // Value print ''; print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5492f760407..f526c5e3c52 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -940,11 +940,11 @@ class Product extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."product"; $sql.= " SET label = '" . $this->db->escape($this->label) ."'"; - + if ($updatetype && ($this->isProduct() || $this->isService())) { $sql.= ", fk_product_type = " . $this->type; } - + $sql.= ", ref = '" . $this->db->escape($this->ref) ."'"; $sql.= ", ref_ext = ".(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null"); $sql.= ", default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null"); diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 59c81c83e29..0362a3767c3 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -440,12 +440,12 @@ while ($i < min($num, $limit)) $cssforfield=(empty($val['css'])?'':$val['css']); if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right'; - + if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 3ee0cb5de1a..d14eba99fae 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -234,7 +234,7 @@ if ($id > 0 || ! empty($ref)) while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); - + if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty); $total_ht+=$objp->total_ht; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 15670a2095d..1ed4916e3c9 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -72,10 +72,10 @@ class Thirdparties extends DolibarrApi * * @throws RestException */ - public function get($id) + public function get($id) { - return $this->_fetch($id); - } + return $this->_fetch($id); + } /** * Get properties of a thirdparty object by email. diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 92333394edc..ffa4bd6d13b 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -41,12 +41,12 @@ $langs->loadLangs(array("admin", "cashdesk", "commercial")); if (GETPOST('action', 'alpha') == 'set') { $db->begin(); - + $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); - + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); if (! $res > 0) $error++; diff --git a/test/phpunit/BOMTest.php b/test/phpunit/BOMTest.php index b69e59c6283..41cbdd9f247 100644 --- a/test/phpunit/BOMTest.php +++ b/test/phpunit/BOMTest.php @@ -79,7 +79,7 @@ class BOMTest extends PHPUnit\Framework\TestCase { global $conf,$user,$langs,$db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - + print __METHOD__."\n"; } From d921b08e5cf5d5942ab1976c13a04c05323e3f7e Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Sun, 20 Oct 2019 11:44:07 -0500 Subject: [PATCH 313/409] Translate documentation of translate class --- htdocs/core/class/translate.class.php | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 3780ab35b06..e54de5a91d2 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -586,18 +586,18 @@ class Translate /** * Return text translated of text received as parameter (and encode it into HTML) - * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif - * et si toujours pas trouve, il est retourne tel quel - * Les parametres de cette methode peuvent contenir de balises HTML. + * If there is no match for this text, we look in alternative file and if still not found, + * it is returned as it is + * The parameters of this method can contain HTML tags * * @param string $key Key to translate - * @param string $param1 chaine de param1 - * @param string $param2 chaine de param2 - * @param string $param3 chaine de param3 - * @param string $param4 chaine de param4 + * @param string $param1 param1 string + * @param string $param2 param2 string + * @param string $param3 param3 string + * @param string $param4 param4 string * @param int $maxsize Max length of text * @return string Translated string (encoded into HTML entities and UTF8) - */ + */ public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0) { global $conf; @@ -647,9 +647,9 @@ class Translate /** * Return translated value of a text string - * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif - * et si toujours pas trouve, il est retourne tel quel. - * Parameters of this method must not contains any HTML tags. + * If there is no match for this text, we look in alternative file and if still not found + * it is returned as is. + * Parameters of this method must not contain any HTML tags. * * @param string $key Key to translate * @param string $param1 chaine de param1 @@ -667,9 +667,9 @@ class Translate /** * Return translated value of a text string - * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif - * et si toujours pas trouve, il est retourne tel quel. - * No convert to encoding charset of lang object is done. + * If there is no match for this text, we look in alternative file and if still not found, + * it is returned as is. + * No conversion to encoding charset of lang object is done. * Parameters of this method must not contains any HTML tags. * * @param string $key Key to translate @@ -781,7 +781,7 @@ class Translate if (preg_match('/^[a-z]+_[A-Z]+/i', $dir)) { $this->load("languages"); - + if (! empty($conf->global->MAIN_LANGUAGES_ALLOWED) && ! in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED)) ) continue; if ($usecode == 2) From f2e5a235471c4cfe1adbb5375b34ad80ff200798 Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Sun, 20 Oct 2019 13:47:39 -0500 Subject: [PATCH 314/409] Declaration of $soc should not be conditional --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cabd2c75fa4..fe88c9ec717 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2566,6 +2566,7 @@ $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); $formmargin = new FormMargin($db); +$soc = new Societe($db); $paymentstatic=new Paiement($db); $bankaccountstatic = new Account($db); if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } @@ -2586,7 +2587,6 @@ if ($action == 'create') print load_fiche_titre($langs->trans('NewBill'), '', 'invoicing'); - $soc = new Societe($db); if ($socid > 0) $res = $soc->fetch($socid); @@ -3465,7 +3465,6 @@ elseif ($id > 0 || ! empty($ref)) $result = $object->fetch_thirdparty(); - $soc = new Societe($db); $result=$soc->fetch($object->socid); if ($result < 0) dol_print_error($db); $selleruserevenustamp = $mysoc->useRevenueStamp(); From df181d1f3504815fc55f50c574f53f962379093a Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 20 Oct 2019 22:01:54 +0200 Subject: [PATCH 315/409] Multiple payments in a TakePOS sale --- htdocs/takepos/invoice.php | 13 ++++++++----- htdocs/takepos/pay.php | 5 ++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 6a67d9d03f9..2068981c98d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -165,8 +165,12 @@ if ($action == 'valid' && $user->rights->facture->creer) $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; if ($invoice->statut != Facture::STATUS_DRAFT) { - dol_syslog("Sale already validated"); - dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1); + //If invoice is validated but it is not fully paid is not error and make the payment + if ($invoice->getRemainToPay()>0) $res=1; + else{ + dol_syslog("Sale already validated"); + dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1); + } } elseif (count($invoice->lines)==0) { @@ -199,7 +203,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->amounts[$invoice->id] = $amountofpayment; // If user has not used change control, add total invoice payment - if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $invoice->total_ttc; + if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $invoice->getRemainToPay(); $payment->paiementid=$paiementid; $payment->num_payment=$invoice->ref; @@ -427,7 +431,6 @@ $sectionwithinvoicelink=''; if ($action=="valid" || $action=="history") { $sectionwithinvoicelink.=''."\n"; - $sectionwithinvoicelink.=''; $sectionwithinvoicelink.=''; $sectionwithinvoicelink.=$invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - "; $remaintopay = $invoice->getRemainToPay(); @@ -582,7 +585,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) if ($mobilepage=="invoice" || $mobilepage=="") { print $langs->trans('TotalTTC'); print ' : ' . price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency) . ''; - print '
' . $sectionwithinvoicelink; + print '
' . $sectionwithinvoicelink; print ''; } if ($_SESSION["basiclayout"]!=1) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 63bf151f40a..349c03540b2 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -172,9 +172,8 @@ else print "var received=0;"; } console.log("We click on the payment mode to pay amount = "+amountpayed); parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid, function() { - //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); - parent.$.colorbox.close(); - //parent.setFocusOnSearchField(); // This does not have effect + if (amountpayed > || amountpayed == || amountpayed==0 ) parent.$.colorbox.close(); + else location.reload(); }); } From b21bca17de85b4f74ffb1654e36ebdd739ab6d23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 00:55:52 +0200 Subject: [PATCH 316/409] Add button Save and stay when editing property of web site --- htdocs/admin/company.php | 4 ++-- htdocs/langs/en_US/main.lang | 1 + htdocs/website/index.php | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 912995d7817..09a4e95c0ae 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -476,7 +476,7 @@ if (! empty($conf->barcode->enabled)) { } // Logo -print ''; +print ''; print '
'; print ''; print ''; @@ -493,7 +493,7 @@ print '
'; print ''; // Logo (squarred) -print ''; +print ''; print ''; + // Date invoice print ''; // Ref Product @@ -377,7 +378,13 @@ if ($result) { print ''; - print ''; + // Country + print ''; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index a815e5b858b..730aecf9dc1 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -367,6 +367,7 @@ if ($result) { print $objp->invoice_label; print ''; + // Date invoice print ''; // Ref product @@ -387,7 +388,12 @@ if ($result) { print ''; - print ''; + print ''; print ''; From 6ebd9721daa2b4ac0f57006b8533fc302a85166b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 03:50:57 +0200 Subject: [PATCH 319/409] FIX The Button "Automatic binding" did not use the account intracomm or export. --- htdocs/accountancy/customer/index.php | 84 ++++++++++++++++++++++++--- htdocs/accountancy/customer/list.php | 11 ++-- htdocs/accountancy/supplier/index.php | 83 ++++++++++++++++++++++++-- htdocs/accountancy/supplier/list.php | 10 ++-- 4 files changed, 165 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index f43ca801c25..c0e45916922 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; // Load translation files required by the page @@ -65,6 +66,8 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); + /* * Actions @@ -101,7 +104,7 @@ if ($action == 'validatehistory') { $db->begin(); // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - if ($db->type == 'pgsql') { + /*if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; @@ -114,16 +117,83 @@ if ($action == 'validatehistory') { $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; - } + }*/ + + // Customer Invoice lines (must be same request than into page list.php for manual binding) + $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,"; + $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; + $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; + $sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; + $sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; + $sql.= " co.code as country_code, co.label as country_label,"; + $sql.= " s.tva_intra"; + $sql.= " FROM " . MAIN_DB_PREFIX . "facture as f"; + $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; + $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; + $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; + $sql.= " AND l.product_type <= 2"; dol_syslog('htdocs/accountancy/customer/index.php'); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); + $result = $db->query($sql); + if (! $result) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } else { + $num_lines = $db->num_rows($result); + + $isSellerInEEC = isInEEC($mysoc); + + $i = 0; + while ($i < min($num_lines, 10000)) { // No more than 10000 at once + $objp = $db->fetch_object($result); + + // Search suggested account for product/service + $suggestedaccountingaccountfor = ''; + if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $objp->code_sell_p = $objp->code_sell; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $objp->code_sell_p = $objp->code_sell_intra; + $objp->aarowid_suggest = $objp->aarowid_intra; + $suggestedaccountingaccountfor = 'eec'; + } else { // Foreign sale + $objp->code_sell_p = $objp->code_sell_export; + $objp->aarowid_suggest = $objp->aarowid_export; + $suggestedaccountingaccountfor = 'export'; + } + } + + if ($objp->aarowid_suggest > 0) + { + $sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; + $sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest; + $sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid; + + $resqlupdate = $db->query($sqlupdate); + if (! $resqlupdate) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + + $i++; + } + } + + if ($error) + { + $db->rollback(); + } + else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index c15ace96ffc..d4cc5f59388 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -219,9 +219,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql.= " AND l.product_type <= 2"; // Add search filter like @@ -247,7 +247,7 @@ if (strlen(trim($search_account))) { $sql .= natural_search("aa.account_number", $search_account); } if (strlen(trim($search_vat))) { - $sql .= natural_search("l.tva_tx", $search_vat, 1); + $sql .= natural_search("l.tva_tx", price2num($search_vat), 1); } $sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year); if (strlen(trim($search_country))) { @@ -406,7 +406,7 @@ if ($result) { $isSellerInEEC = isInEEC($mysoc); - while ( $i < min($num_lines, $limit) ) { + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); $objp->code_sell_l = ''; @@ -518,6 +518,7 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')); print ''; + // Country print ''; - // Ref product + // Ref Product print ''; // Description - print ''; + // Date invoice print ''; // Ref Product @@ -389,7 +390,13 @@ if ($result) { print ''; - print ''; + // Country + print ''; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index c4aa1316876..659d428b93b 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -380,6 +380,7 @@ if ($result) { print $objp->invoice_label; print ''; + // Date invoice print ''; // Ref product @@ -400,7 +401,12 @@ if ($result) { print ''; - print ''; + print ''; print ''; From febf9ccd0473d415819c5ccfd7832de1ba471672 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 03:50:57 +0200 Subject: [PATCH 321/409] FIX The Button "Automatic binding" did not use the account intracomm or export. --- htdocs/accountancy/customer/index.php | 84 ++++++++++++++++++++++++--- htdocs/accountancy/customer/list.php | 11 ++-- htdocs/accountancy/supplier/index.php | 83 ++++++++++++++++++++++++-- htdocs/accountancy/supplier/list.php | 10 ++-- 4 files changed, 165 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index f063f832f54..aa3a8d691dd 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; // Load translation files required by the page @@ -65,6 +66,8 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); + /* * Actions @@ -102,7 +105,7 @@ if ($action == 'validatehistory') { $db->begin(); // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - if ($db->type == 'pgsql') { + /*if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; @@ -115,16 +118,83 @@ if ($action == 'validatehistory') { $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; - } + }*/ + + // Customer Invoice lines (must be same request than into page list.php for manual binding) + $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,"; + $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; + $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; + $sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; + $sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; + $sql.= " co.code as country_code, co.label as country_label,"; + $sql.= " s.tva_intra"; + $sql.= " FROM " . MAIN_DB_PREFIX . "facture as f"; + $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; + $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; + $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; + $sql.= " AND l.product_type <= 2"; dol_syslog('htdocs/accountancy/customer/index.php'); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); + $result = $db->query($sql); + if (! $result) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } else { + $num_lines = $db->num_rows($result); + + $isSellerInEEC = isInEEC($mysoc); + + $i = 0; + while ($i < min($num_lines, 10000)) { // No more than 10000 at once + $objp = $db->fetch_object($result); + + // Search suggested account for product/service + $suggestedaccountingaccountfor = ''; + if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $objp->code_sell_p = $objp->code_sell; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $objp->code_sell_p = $objp->code_sell_intra; + $objp->aarowid_suggest = $objp->aarowid_intra; + $suggestedaccountingaccountfor = 'eec'; + } else { // Foreign sale + $objp->code_sell_p = $objp->code_sell_export; + $objp->aarowid_suggest = $objp->aarowid_export; + $suggestedaccountingaccountfor = 'export'; + } + } + + if ($objp->aarowid_suggest > 0) + { + $sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; + $sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest; + $sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid; + + $resqlupdate = $db->query($sqlupdate); + if (! $resqlupdate) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + + $i++; + } + } + + if ($error) + { + $db->rollback(); + } + else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 127f1795e19..7826d2b1faf 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -221,9 +221,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql.= " AND l.product_type <= 2"; // Add search filter like @@ -249,7 +249,7 @@ if (strlen(trim($search_account))) { $sql .= natural_search("aa.account_number", $search_account); } if (strlen(trim($search_vat))) { - $sql .= natural_search("l.tva_tx", $search_vat, 1); + $sql .= natural_search("l.tva_tx", price2num($search_vat), 1); } if ($search_month > 0) { @@ -420,7 +420,7 @@ if ($result) { $isSellerInEEC = isInEEC($mysoc); - while ( $i < min($num_lines, $limit) ) { + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); $objp->code_sell_l = ''; @@ -532,6 +532,7 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')); print ''; + // Country print ''; - // Ref product + // Ref Product print ''; // Description - print ''; $texte.= ''; @@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; - // On défini critere recherche compteur + // We define the search criteria of the counter $mask=$conf->global->FICHINTER_ARTIC_MASK; if (! $mask) From 3024919cd6dfcecadb3e27a54f65260f9c030a2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 10:25:23 +0200 Subject: [PATCH 327/409] fix phpcs --- htdocs/core/actions_massactions.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b14bc0f105e..7d8d621ff92 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -266,7 +266,6 @@ if (! $error && $massaction == 'confirm_presend') $objectobj->fetch_thirdparty(); $contactidtosend=array(); foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) { - $emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid, 'email'); if (!in_array($contactemailid, $contactidtosend)) { $contactidtosend[] = $contactemailid; From be3f0471fff7ec46a1933e82bba5358f9586943b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 11:27:48 +0200 Subject: [PATCH 328/409] Fix phpcs --- htdocs/accountancy/supplier/index.php | 14 +++---- htdocs/mrp/ajax/ajax_bom.php | 53 +++++++++++++++++++++++++++ htdocs/takepos/ajax/ajax.php | 11 +++++- 3 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 htdocs/mrp/ajax/ajax_bom.php diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index ef720e99130..bfb6e7b02e4 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -140,13 +140,13 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $num_lines = $db->num_rows($result); - + $isSellerInEEC = isInEEC($mysoc); - + $i = 0; while ($i < min($num_lines, 10000)) { // No more than 10000 at once $objp = $db->fetch_object($result); - + // Search suggested account for product/service $suggestedaccountingaccountfor = ''; if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) @@ -168,13 +168,13 @@ if ($action == 'validatehistory') { $suggestedaccountingaccountfor = 'export'; } } - + if ($objp->aarowid_suggest > 0) { $sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest; $sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid; - + $resqlupdate = $db->query($sqlupdate); if (! $resqlupdate) { @@ -183,11 +183,11 @@ if ($action == 'validatehistory') { break; } } - + $i++; } } - + if ($error) { $db->rollback(); diff --git a/htdocs/mrp/ajax/ajax_bom.php b/htdocs/mrp/ajax/ajax_bom.php new file mode 100644 index 00000000000..7f5a2040403 --- /dev/null +++ b/htdocs/mrp/ajax/ajax_bom.php @@ -0,0 +1,53 @@ + + * + * 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/mrp/ajax/ajax.php + * \brief Ajax search component for Mrp. It get BOM content. + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; + +$idbom = GETPOST('idbom', 'alpha'); +$action = GETPOST('action', 'alpha'); + + +/* + * View + */ + +$object = new BOM($db); +$result=$object->fetch($idbom); +if ($result) +{ + echo json_encode($result); +} +else +{ + echo 'Failed to load category with id='.$idbom; +} diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 69228b5efb5..2a27094bb90 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -45,9 +45,18 @@ $term = GETPOST('term', 'alpha'); if ($action=="getProducts") { $object = new Categorie($db); $result=$object->fetch($category); - if ($result) + if ($result > 0) { $prods = $object->getObjectsInCateg("product"); + // Removed properties we don't need + if (is_array($prods) && count($prods) > 0) + { + foreach($prods as $prod) + { + unset($prod->fields); + unset($prod->db); + } + } echo json_encode($prods); } else From 38aa64836351d83f2d1087cfb561def8ab827d14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 11:38:35 +0200 Subject: [PATCH 329/409] Autofill the MO with data from BOM --- htdocs/mrp/ajax/ajax_bom.php | 7 +++++-- htdocs/mrp/mo_card.php | 32 ++++++++++++++++++++++++++------ htdocs/mrp/mo_document.php | 1 - htdocs/mrp/mo_list.php | 1 - htdocs/mrp/mo_note.php | 1 - 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/htdocs/mrp/ajax/ajax_bom.php b/htdocs/mrp/ajax/ajax_bom.php index 7f5a2040403..761a54876ee 100644 --- a/htdocs/mrp/ajax/ajax_bom.php +++ b/htdocs/mrp/ajax/ajax_bom.php @@ -43,9 +43,12 @@ $action = GETPOST('action', 'alpha'); $object = new BOM($db); $result=$object->fetch($idbom); -if ($result) +if ($result > 0) { - echo json_encode($result); + // We remove properties we don't need in answer + unset ($object->fields); + unset ($object->db); + echo json_encode($object); } else { diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index f15b45b96e5..15a1aeff0a1 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 @@ -204,16 +203,37 @@ if ($action == 'create') dol_fiche_end(); - print ' + ?> - '; + '; print ''; diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 09f34ae583e..351274de4b8 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 2f32058a41f..81cb781ccff 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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/mrp/mo_note.php b/htdocs/mrp/mo_note.php index a006f79a609..d7429a4da86 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 48f5970c7aea369119874fa8f903e354c6350f65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 14:43:39 +0200 Subject: [PATCH 330/409] Debug net measure --- htdocs/product/card.php | 74 ++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5ee8c502009..f8f64decbfa 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -73,6 +73,7 @@ $ref=GETPOST('ref', 'alpha'); $type=GETPOST('type', 'int'); $action=(GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $cancel=GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); $socid=GETPOST('socid', 'int'); $duration_value = GETPOST('duration_value', 'int'); @@ -357,8 +358,18 @@ if (empty($reshook)) $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; + if (! empty($backtopage)) + { + $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation + if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id; // Old method + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + exit; + } } else { @@ -950,6 +961,7 @@ else print ''; if (! empty($modBarCodeProduct->code_auto)) print ''; + print ''; if ($type==1) $title=$langs->trans("NewService"); else $title=$langs->trans("NewProduct"); @@ -1070,12 +1082,6 @@ else print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1); print ''; - // Net Measure - print ''; - // Brut Weight print ''; } + + if (! empty($conf->global->PRODUCT_ADD_NET_MEASURE)) + { + // Net Measure + print ''; + } } // Units @@ -1450,18 +1465,12 @@ else print $form->selectarray('finished', $statutarray, $object->finished); print ''; - // Net Measure - print ''; - // Brut Weight print ''; + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { // Brut Length @@ -1488,6 +1497,15 @@ else print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2); print ''; } + + if (! empty($conf->global->PRODUCT_ADD_NET_MEASURE)) + { + // Net Measure + print ''; + } } // Units if($conf->global->PRODUCT_USE_UNITS) @@ -1863,17 +1881,6 @@ else print $object->getLibFinished(); print ''; - // Net Measure - print '\n"; + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { // Brut Length @@ -1930,6 +1938,20 @@ else } print "\n"; } + + if (! empty($conf->global->PRODUCT_ADD_NET_MEASURE)) + { + // Net Measure + print '
'; print ''; print ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 04f45f8de4b..656f6fb7a28 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -169,6 +169,7 @@ ToValidate=To validate NotValidated=Not validated Save=Save SaveAs=Save As +SaveAndStay=Save and stay TestConnection=Test connection ToClone=Clone ConfirmClone=Choose data you want to clone: diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 1eff07edb39..52dae7ba666 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1236,12 +1236,18 @@ if ($action == 'updatecss') setEventMessages($langs->trans("Saved"), null, 'mesgs'); } - $action='preview'; - - if ($backtopage) + if (! GETPOSTISSET('updateandstay')) // If we click on "Save And Stay", we don not make the redirect { - header("Location: ".$backtopage); - exit; + $action='preview'; + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } + } + else + { + $action = 'editcss'; } } } @@ -2105,6 +2111,7 @@ if (! GETPOST('hide_websitemenu')) if (in_array($action, array('editcss','editmenu','file_manager','replacesite','replacesiteconfirm'))) { + if ($action == 'editcss' && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print ''; if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print ''; if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print ''; if ($action != 'preview') print ''; From 0c5fbdf29d8571d41fabbef9f2fa4cd73b2c2e50 Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Sun, 20 Oct 2019 19:18:39 -0500 Subject: [PATCH 317/409] Translate french documentation --- htdocs/societe/class/societe.class.php | 108 ++++++++++++------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2b4ae2bb7a0..c999c9016f4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -821,7 +821,7 @@ class Societe extends CommonObject * Update parameters of third party * * @param int $id Id of company (deprecated, use 0 here and call update on an object loaded by a fetch) - * @param User $user Utilisateur qui demande la mise a jour + * @param User $user User who requests the update * @param int $call_trigger 0=no, 1=yes * @param int $allowmodcodeclient Inclut modif code client et code compta * @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur @@ -1638,13 +1638,13 @@ class Societe extends CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Definit la societe comme un client + * Defines the company as a customer * - * @param float $remise Valeur en % de la remise - * @param string $note Note/Motif de modification de la remise - * @param User $user Utilisateur qui definie la remise + * @param float $remise Value in % of the discount + * @param string $note Note/Reason for changing the discount + * @param User $user User who sets the discount * @return int <0 if KO, >0 if OK */ public function set_remise_client($remise, $note, User $user) @@ -1652,7 +1652,7 @@ class Societe extends CommonObject // phpcs:enable global $conf, $langs; - // Nettoyage parametres + // Parameter cleaning $note=trim($note); if (! $note) { @@ -1668,7 +1668,7 @@ class Societe extends CommonObject $now=dol_now(); - // Positionne remise courante + // Position current discount $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; $sql.= " SET remise_client = '".$this->db->escape($remise)."'"; $sql.= " WHERE rowid = " . $this->id; @@ -1680,7 +1680,7 @@ class Societe extends CommonObject return -1; } - // Ecrit trace dans historique des remises + // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; $sql.= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; @@ -1701,13 +1701,13 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Definit la societe comme un client + * Defines the company as a customer * - * @param float $remise Valeur en % de la remise - * @param string $note Note/Motif de modification de la remise - * @param User $user Utilisateur qui definie la remise + * @param float $remise Value in % of the discount + * @param string $note Note/Reason for changing the discount + * @param User $user User who sets the discount * @return int <0 if KO, >0 if OK */ public function set_remise_supplier($remise, $note, User $user) @@ -1715,7 +1715,7 @@ class Societe extends CommonObject // phpcs:enable global $conf, $langs; - // Nettoyage parametres + // Parameter cleaning $note=trim($note); if (! $note) { @@ -1731,7 +1731,7 @@ class Societe extends CommonObject $now=dol_now(); - // Positionne remise courante + // Position current discount $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; $sql.= " SET remise_supplier = '".$this->db->escape($remise)."'"; $sql.= " WHERE rowid = " . $this->id; @@ -1743,7 +1743,7 @@ class Societe extends CommonObject return -1; } - // Ecrit trace dans historique des remises + // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier"; $sql.= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; @@ -1827,10 +1827,10 @@ class Societe extends CommonObject } /** - * Renvoie montant TTC des reductions/avoirs en cours disponibles de la societe + * Returns amount of included taxes of the current discounts/credits available from the company * - * @param User $user Filtre sur un user auteur des remises - * @param string $filter Filtre autre + * @param User $user Filter on a user author of discounts + * @param string $filter Other filter * @param integer $maxvalue Filter on max value for discount * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, Credit note amount otherwise @@ -2264,13 +2264,13 @@ class Societe extends CommonObject return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoi le libelle d'un statut donne + * Return the label of a given status * - * @param int $statut Id statut + * @param int $statut Status id * @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 Libelle du statut + * @return string Status label */ public function LibStatut($statut, $mode = 0) { @@ -2429,11 +2429,11 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la liste des contacts de cette societe + * Returns the contact list of this company * - * @return array tableau des contacts + * @return array array of contacts */ public function contact_array() { @@ -2463,11 +2463,11 @@ class Societe extends CommonObject return $contacts; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la liste des contacts de cette societe + * Returns the contact list of this company * - * @return array $contacts tableau des contacts + * @return array $contacts array of contacts */ public function contact_array_objects() { @@ -2608,9 +2608,9 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Attribut un code client a partir du module de controle des codes. + * Assigns a customer code from the code control module. * Return value is stored into this->code_client * * @param Societe $objsoc Object thirdparty @@ -2640,9 +2640,9 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Attribut un code fournisseur a partir du module de controle des codes. + * Assigns a vendor code from the code control module. * Return value is stored into this->code_fournisseur * * @param Societe $objsoc Object thirdparty @@ -2671,10 +2671,10 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Verifie si un code client est modifiable en fonction des parametres - * du module de controle des codes. + * Check if a client code is editable based on the parameters of the + * code control module. * * @return int 0=No, 1=Yes */ @@ -2708,9 +2708,9 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes + * Check if a vendor code is editable in the code control module configuration * * @return int 0=No, 1=Yes */ @@ -2818,11 +2818,11 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie un code compta, suivant le module de code compta. - * Peut etre identique a celui saisit ou genere automatiquement. - * A ce jour seule la generation automatique est implementee + * Returns an accounting code, following the accounting code module. + * May be identical to the one entered or generated automatically. + * To date only the automatic generation is implemented * * @param string $type Type of thirdparty ('customer' or 'supplier') * @return string Code compta si ok, 0 si aucun, <0 si ko @@ -2847,7 +2847,7 @@ class Societe extends CommonObject $classname = $conf->global->SOCIETE_CODECOMPTA_ADDON; $mod = new $classname; - // Defini code compta dans $mod->code + // Set code count in $mod->code $result = $mod->get_code($this->db, $this, $type); if ($type == 'customer') $this->code_compta = $mod->code; @@ -2999,9 +2999,9 @@ class Societe extends CommonObject else return false; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...) + * Check the validity of a professional identifier according to the country of the company (siren, siret, ...) * * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) * @param Societe $soc Objet societe @@ -3017,7 +3017,7 @@ class Societe extends CommonObject if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return 1; - // Verifie SIREN si pays FR + // Check SIREN if country FR if ($idprof == 1 && $soc->country_code == 'FR') { $chaine=trim($this->idprof1); @@ -3207,11 +3207,11 @@ class Societe extends CommonObject return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Indique si la societe a des projets + * Indicates if the company has projects * - * @return bool true si la societe a des projets, false sinon + * @return bool true if the company has projects, false otherwise */ public function has_projects() { @@ -3313,9 +3313,9 @@ class Societe extends CommonObject return isInEEC($this); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Charge la liste des categories fournisseurs + * Load the list of provider categories * * @return int 0 if success, <> 0 if error */ @@ -3704,11 +3704,11 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set prospect level * - * @param User $user Utilisateur qui definie la remise + * @param User $user User who sets the discount * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ From 9b1385ee8687163218f78cfb40921be2f575693a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 03:37:44 +0200 Subject: [PATCH 318/409] FIX If country not defined keep value empty --- htdocs/accountancy/customer/lines.php | 9 ++++++++- htdocs/accountancy/supplier/lines.php | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 3385eb99b0e..6a5196288e2 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -358,6 +358,7 @@ if ($result) { // Ref Invoice print '' . $facture_static->getNomUrl(1) . '' . dol_print_date($db->jdate($objp->datef), 'day') . '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + if ($objp->country_code) + { + print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + } + print '' . $objp->tva_intra . '' . dol_print_date($db->jdate($objp->datef), 'day') . '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + if ($objp->country_code) + { + print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + } + print '' . $objp->tva_intra . ''; $labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label; print $labelcountry; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index faa48ac9176..ef720e99130 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; // Load translation files required by the page @@ -63,6 +64,7 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); /* @@ -99,7 +101,7 @@ if ($action == 'validatehistory') { $db->begin(); // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - if ($db->type == 'pgsql') { + /*if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; @@ -112,16 +114,85 @@ if ($action == 'validatehistory') { $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; - } + }*/ + + // Supplier Invoice Lines (must be same request than into page list.php for manual binding) + $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,"; + $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; + $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; + $sql.= " aa.rowid as aarowid,"; + $sql.= " co.code as country_code, co.label as country_label,"; + $sql.= " s.tva_intra"; + $sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; + $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; + $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; + $sql.= " AND l.product_type <= 2"; dol_syslog('htdocs/accountancy/supplier/index.php'); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); + $result = $db->query($sql); + if (! $result) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } else { + $num_lines = $db->num_rows($result); + + $isSellerInEEC = isInEEC($mysoc); + + $i = 0; + while ($i < min($num_lines, 10000)) { // No more than 10000 at once + $objp = $db->fetch_object($result); + + // Search suggested account for product/service + $suggestedaccountingaccountfor = ''; + if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $objp->code_buy_p = $objp->code_buy; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + //$objp->code_buy_p = $objp->code_buy_intra; + $objp->code_buy_p = $objp->code_buy; + //$objp->aarowid_suggest = $objp->aarowid_intra; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = 'eec'; + } else { // Foreign sale + //$objp->code_buy_p = $objp->code_buy_export; + $objp->code_buy_p = $objp->code_buy; + //$objp->aarowid_suggest = $objp->aarowid_export; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = 'export'; + } + } + + if ($objp->aarowid_suggest > 0) + { + $sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest; + $sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid; + + $resqlupdate = $db->query($sqlupdate); + if (! $resqlupdate) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + + $i++; + } + } + + if ($error) + { + $db->rollback(); + } + else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index f43749f6958..3c61b7a0608 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -222,7 +222,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql.= " AND l.product_type <= 2"; // Add search filter like @@ -307,8 +307,8 @@ if ($result) { $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid); if ($search_day) $param.='&search_day='.urlencode($search_day); if ($search_month) $param.='&search_month='.urlencode($search_month); @@ -463,7 +463,7 @@ if ($result) { print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; if ($product_static->id > 0) print $product_static->getNomUrl(1); @@ -471,7 +471,7 @@ if ($result) { print ''; + print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); From 776bfabfc4a15a8faa78093104bfe7a80dfa3a9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 03:37:44 +0200 Subject: [PATCH 320/409] FIX If country not defined keep value empty --- htdocs/accountancy/customer/lines.php | 9 ++++++++- htdocs/accountancy/supplier/lines.php | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 0e7047b84de..3da2c129e30 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -370,6 +370,7 @@ if ($result) { // Ref Invoice print '' . $facture_static->getNomUrl(1) . '' . dol_print_date($db->jdate($objp->datef), 'day') . '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + if ($objp->country_code) + { + print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + } + print '' . $objp->tva_intra . '' . dol_print_date($db->jdate($objp->datef), 'day') . '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + if ($objp->country_code) + { + print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + } + print '' . $objp->tva_intra . ''; $labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label; print $labelcountry; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index bc632118da7..f1bf4377f42 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; // Load translation files required by the page @@ -63,6 +64,7 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); /* @@ -100,7 +102,7 @@ if ($action == 'validatehistory') { $db->begin(); // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - if ($db->type == 'pgsql') { + /*if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; @@ -113,16 +115,85 @@ if ($action == 'validatehistory') { $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; - } + }*/ + + // Supplier Invoice Lines (must be same request than into page list.php for manual binding) + $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,"; + $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; + $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; + $sql.= " aa.rowid as aarowid,"; + $sql.= " co.code as country_code, co.label as country_label,"; + $sql.= " s.tva_intra"; + $sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; + $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; + $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; + $sql.= " AND l.product_type <= 2"; dol_syslog('htdocs/accountancy/supplier/index.php'); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); + $result = $db->query($sql); + if (! $result) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } else { + $num_lines = $db->num_rows($result); + + $isSellerInEEC = isInEEC($mysoc); + + $i = 0; + while ($i < min($num_lines, 10000)) { // No more than 10000 at once + $objp = $db->fetch_object($result); + + // Search suggested account for product/service + $suggestedaccountingaccountfor = ''; + if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $objp->code_buy_p = $objp->code_buy; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + //$objp->code_buy_p = $objp->code_buy_intra; + $objp->code_buy_p = $objp->code_buy; + //$objp->aarowid_suggest = $objp->aarowid_intra; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = 'eec'; + } else { // Foreign sale + //$objp->code_buy_p = $objp->code_buy_export; + $objp->code_buy_p = $objp->code_buy; + //$objp->aarowid_suggest = $objp->aarowid_export; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = 'export'; + } + } + + if ($objp->aarowid_suggest > 0) + { + $sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest; + $sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid; + + $resqlupdate = $db->query($sqlupdate); + if (! $resqlupdate) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + + $i++; + } + } + + if ($error) + { + $db->rollback(); + } + else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index d7bfdcc5db3..879b708d32e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -224,7 +224,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql.= " AND l.product_type <= 2"; // Add search filter like @@ -321,8 +321,8 @@ if ($result) { $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid); if ($search_day) $param.='&search_day='.urlencode($search_day); if ($search_month) $param.='&search_month='.urlencode($search_month); @@ -477,7 +477,7 @@ if ($result) { print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; if ($product_static->id > 0) print $product_static->getNomUrl(1); @@ -485,7 +485,7 @@ if ($result) { print ''; + print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); From 6a55aedf594f8bd0a7e33a783805b07dd3c13937 Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Mon, 21 Oct 2019 08:46:07 +0200 Subject: [PATCH 322/409] Create file. List of parcels details related to an expedition. --- .../mysql/tables/llx_expedition_package.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_expedition_package.sql diff --git a/htdocs/install/mysql/tables/llx_expedition_package.sql b/htdocs/install/mysql/tables/llx_expedition_package.sql new file mode 100644 index 00000000000..b897e2ab312 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_expedition_package.sql @@ -0,0 +1,18 @@ +--List of parcels details related to an expedition +create table llx_expedition_package +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_expedition integer NOT NULL, + description varchar(255), --Description of goods in the package (required by the custom) + value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom) + fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) + height float, -- height + width float, -- width + size float, -- depth + size_units integer, -- unit of all sizes (height, width, depth) + weight float, -- weight + weight_units integer, -- unit of weight + dangerous_goods smallint DEFAULT 0, -- 0 = no dangerous goods or 1 = Explosives, 2 = Flammable Gases, 3 = Flammable Liquids, 4 = Flammable solids, 5 = Oxidizing, 6 = Toxic & Infectious, 7 = Radioactive, 8 = Corrosives, 9 = Miscellaneous (see https://en.wikipedia.org/wiki/Dangerous_goods). I'm not sure if just register 0 (no) or 1 (yes) is enough. + tail_lift smallint DEFAULT 0, -- 0 = no tail lift required to load/unload package(s), 1 = a tail lift is required to load/unload package(s). Sometime tail lift load can be different than tail lift delivery so maybe adding a new table line. + rang integer DEFAULT 0 +)ENGINE=innodb; From 16bd837dc7403c403cfcea671487a8165d6a70ae Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Mon, 21 Oct 2019 08:54:59 +0200 Subject: [PATCH 323/409] create file Dictionary of package type --- htdocs/install/mysql/tables/llx_c_shipment_package_type | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_c_shipment_package_type diff --git a/htdocs/install/mysql/tables/llx_c_shipment_package_type b/htdocs/install/mysql/tables/llx_c_shipment_package_type new file mode 100644 index 00000000000..e510352eba2 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_shipment_package_type @@ -0,0 +1,9 @@ +--Dictionary of package type +create table llx_c_shipment_package_type +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + label varchar(50) NOT NULL, -- Short name + description varchar(255), -- Description + active integer DEFAULT 1 NOT NULL, -- Active or not + entity integer DEFAULT 1 NOT NULL -- Multi company id +)ENGINE=innodb; From c2357405445977d00db6039fd080decf158ec797 Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Mon, 21 Oct 2019 08:58:13 +0200 Subject: [PATCH 324/409] parcel to package --- htdocs/install/mysql/tables/llx_expedition_package.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_expedition_package.sql b/htdocs/install/mysql/tables/llx_expedition_package.sql index b897e2ab312..2f8d97a26a9 100644 --- a/htdocs/install/mysql/tables/llx_expedition_package.sql +++ b/htdocs/install/mysql/tables/llx_expedition_package.sql @@ -5,7 +5,7 @@ create table llx_expedition_package fk_expedition integer NOT NULL, description varchar(255), --Description of goods in the package (required by the custom) value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom) - fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) + fk_package_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) height float, -- height width float, -- width size float, -- depth From db22cdb8ea86bd6312ddbd7dfa042ee2704bd37b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 21 Oct 2019 09:43:34 +0200 Subject: [PATCH 325/409] internationalization --- .../core/modules/fichinter/doc/pdf_soleil.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 623f67ddd72..ac59960cf59 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -25,7 +25,7 @@ /** * \file htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php * \ingroup ficheinter - * \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil + * \brief File of Class to build interventions documents with model Soleil */ require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -142,7 +142,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->option_condreg = 0; // Display payment terms $this->option_codeproduitservice = 0; // Display product-service code $this->option_multilang = 1; // Available in several languages - $this->option_draft_watermark = 1; //Support add of a watermark on drafts + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company $this->emetteur=$mysoc; @@ -266,7 +266,7 @@ class pdf_soleil extends ModelePDFFicheinter $tab_height = 130; $tab_height_newpage = 150; - // Affiche notes + // Display notes $notetoshow=empty($object->note_public)?'':$object->note_public; if ($notetoshow) { @@ -394,7 +394,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -573,7 +573,7 @@ class pdf_soleil extends ModelePDFFicheinter pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FICHINTER_DRAFT_WATERMARK); } - //Prepare la suite + //Prepare next $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); From a0303e903a96799858858778b12fd0e859619a0c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 21 Oct 2019 09:53:42 +0200 Subject: [PATCH 326/409] internationalization --- htdocs/core/modules/fichinter/mod_arctic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 6ec78b1ac1a..4d8ea35e4d9 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -82,7 +82,7 @@ class mod_arctic extends ModeleNumRefFicheinter $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard")); $tooltip.=$langs->trans("GenericMaskCodes5"); - // Parametrage du prefix + // Setting the prefix $texte.= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'
'.$langs->trans("NetMeasure").''; - print ''; - print $formproduct->selectMeasuringUnits("net_measure_units", "net_measure", GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); - print '
'.$langs->trans("Weight").''; print ''; @@ -1108,6 +1114,15 @@ else print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units')?GETPOST('volume_units', 'alpha'):'0', 0, 2); print '
'.$langs->trans("NetMeasure").''; + print ''; + print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), ''); + print '
'.$langs->trans("NetMeasure").''; - print ' '; - print $form->selectUnits($object->net_measure_units, 'units'); - //print $formproduct->selectMeasuringUnits("net_measure_units", "weight", $object->net_measure_units, 0, 2); - print '
'.$langs->trans("Weight").''; print ' '; print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2); print '
'.$langs->trans("NetMeasure").''; + print ' '; + print $formproduct->selectMeasuringUnits($object->net_measure_units, ''); + print '
'.$langs->trans("NetMeasure").''; - if ($object->net_measure != '') - { - print $object->net_measure." ".measuring_units_string(0, "weight", $object->net_measure_units); - } - else - { - print ' '; - } - // Brut Weight print '
'.$langs->trans("Weight").''; if ($object->weight != '') @@ -1885,6 +1892,7 @@ else print ' '; } print "
'.$langs->trans("NetMeasure").''; + if ($object->net_measure != '') + { + print $object->net_measure." ".measuring_units_string(0, "weight", $object->net_measure_units); + } + else + { + print ' '; + } + } } // Unit From e261d6329576421f1dde3b45e3b16863b05d0516 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 14:44:39 +0200 Subject: [PATCH 331/409] NEW Can add a button "Create" after combo of object with modulebuilder. --- htdocs/bom/bom_card.php | 15 +++--- htdocs/bom/class/bom.class.php | 2 +- htdocs/core/actions_addupdatedelete.inc.php | 5 +- htdocs/core/class/commonobject.class.php | 49 +++++++++++++------ htdocs/core/class/cunits.class.php | 3 +- htdocs/core/class/html.form.class.php | 12 +++-- .../template/class/myobject.class.php | 5 +- .../modulebuilder/template/myobject_card.php | 19 +++---- htdocs/mrp/class/mo.class.php | 8 +-- htdocs/mrp/mo_card.php | 15 +++--- .../product/class/html.formproduct.class.php | 16 +++--- htdocs/product/inventory/inventory.php | 7 +++ htdocs/projet/card.php | 8 +-- htdocs/societe/card.php | 7 +-- htdocs/theme/eldy/btn.inc.php | 1 + htdocs/theme/eldy/global.inc.php | 3 +- htdocs/theme/md/btn.inc.php | 1 + htdocs/theme/md/style.css.php | 3 +- 18 files changed, 110 insertions(+), 69 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 0949fa1a334..17fae31ef7d 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -79,6 +79,7 @@ $permissionnote=$user->rights->bom->write; // Used by the include of actions_set $permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php $permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php $permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); /* @@ -93,11 +94,11 @@ if (empty($reshook)) { $error=0; - $permissiontoadd = $user->rights->bom->write; - $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; - if (empty($backtopage)) { - if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist; + + if (empty($backtopage) || ($cancel && empty($id))) { + //var_dump($backurlforlist);exit; + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__'); } $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record @@ -218,7 +219,7 @@ if ($action == 'create') dol_fiche_head(array(), ''); - print ''."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; @@ -252,7 +253,9 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
'."\n"; + //$object->fields['keyfield']['disabled'] = 1; + + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 07ae81e2994..02e39149364 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -91,7 +91,7 @@ class BOM extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index e87333e4c01..d618a0702c8 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -32,6 +32,8 @@ if ($cancel) { + /*var_dump($cancel); + var_dump($backtopage);exit;*/ if (! empty($backtopage)) { header("Location: ".$backtopage); @@ -80,7 +82,8 @@ if ($action == 'add' && ! empty($permissiontoadd)) if ($result > 0) { // Creation OK - $urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist; + $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; + $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation header("Location: ".$urltogo); exit; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cc8ae3238c0..95fa2c2fc59 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5556,16 +5556,20 @@ abstract class CommonObject $type=''; $param = array(); $param['options']=array(); - $size =$this->fields[$key]['size']; + $reg=array(); + $size = $this->fields[$key]['size']; // Because we work on extrafields - if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ - $param['options']=array($reg[1].':'.$reg[2]=>'N'); - $type ='link'; - } elseif(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)) { - $param['options']=array($reg[1].':'.$reg[2]=>'N'); + if (preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N'); + $type ='link'; + } elseif (preg_match('/^(integer|link):(.*):(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[2].':'.$reg[3].':'.$reg[4] => 'N'); + $type ='link'; + } elseif (preg_match('/^(integer|link):(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[2].':'.$reg[3] => 'N'); $type ='link'; } elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) { - $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); + $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N'); $type ='sellist'; } elseif(preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) { $param['options']=array(); @@ -6078,16 +6082,26 @@ abstract class CommonObject } elseif ($type == 'link') { - $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath' + $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]' + $param_list_array = explode(':', $param_list[0]); $showempty=(($required && $default != '')?0:1); - $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty); - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + + $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1); + + if (! empty($param_list_array[2])) // If we set to add a create button { - list($class,$classfile)=explode(':', $param_list[0]); - if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) $url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php', 1); - else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.$class.'_card.php', 1); - $out.=''; - // TODO Add Javascript code to add input fields contents to new elements urls + if (! GETPOSTISSET('backtopage') && empty($val['disabled'])) // To avoid to open several infinitely the 'Create Object' button and to avoid to have button if field is protected by a "disabled". + { + list($class,$classfile)=explode(':', $param_list[0]); + if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) $url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php', 1); + else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.strtolower($class).'_card.php', 1); + $paramforthenewlink = ''; + $paramforthenewlink .= (GETPOSTISSET('action')?'&action='.GETPOST('action','aZ09'):''); + $paramforthenewlink .= (GETPOSTISSET('id')?'&id='.GETPOST('id','int'):''); + $paramforthenewlink .= '&fk_'.strtolower($class).'=--IDFORBACKTOPAGE--'; + // TODO Add Javascript code to add input fields already filled into $paramforthenewlink so we won't loose them when going back to main page + $out.=''; + } } } elseif ($type == 'password') @@ -6167,6 +6181,7 @@ abstract class CommonObject $label = $val['label']; $type = $val['type']; $size = $val['css']; + $reg = array(); // Convert var to be able to share same code than showOutputField of extrafields if (preg_match('/varchar\((\d+)\)/', $type, $reg)) @@ -6182,7 +6197,9 @@ abstract class CommonObject $computed=$val['computed']; $unique=$val['unique']; $required=$val['required']; - $param=$val['param']; + $param=array(); + $param['options']=array(); + if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval']; if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 1837f82a2a4..07cd778d3a0 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -234,8 +234,6 @@ class CUnits // extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); - $records=array(); - $sql = 'SELECT'; $sql.= " t.rowid,"; $sql.= " t.code,"; @@ -273,6 +271,7 @@ class CUnits // extends CommonObject if (!empty($limit)) { $sql .= ' ' . $this->db->plimit($limit, $offset); } + $resql = $this->db->query($sql); if ($resql) { $this->records=array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6d26e585435..66646ee4c4f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5824,10 +5824,11 @@ class Form * @param string $morecss More CSS * @param string $moreparams More params provided to ajax call * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) + * @param int $disabled 1=Html component is disabled * @return string Return HTML string * @see selectForFormsList() select_thirdparty */ - public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0) + public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0) { global $conf, $user; @@ -5868,12 +5869,12 @@ class Form $out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array()); $out.= ''; if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"'; - $out.= ''; + $out.= ''; } else { // Immediate load of all database - $out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo); + $out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled); } return $out; @@ -5893,10 +5894,11 @@ class Form * @param string $moreparams More params provided to ajax call * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) * @param int $outputmode 0=HTML select string, 1=Array + * @param int $disabled 1=Html component is disabled * @return string Return HTML string * @see selectForForms() */ - public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0) + public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0) { global $conf, $langs, $user; @@ -5948,7 +5950,7 @@ class Form } // Construct $out and $outarray - $out.= ''."\n"; // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 $textifempty=' '; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 1f83308f1d7..d5c7c9d2e4e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -64,7 +64,7 @@ class MyObject extends CommonObject /** - * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') + * 'type' if the field format ('integer', 'integer:Class:pathtoclass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') * 'label' the translation key. * 'enabled' is a condition when the field must be managed. * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -81,6 +81,7 @@ class MyObject extends CommonObject * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. */ // BEGIN MODULEBUILDER PROPERTIES @@ -94,7 +95,7 @@ class MyObject extends CommonObject 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), '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'), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 5727d596a6d..e39022814e7 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -105,10 +105,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote=$user->rights->mymodule->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->mymodule->write; // Used by the include of actions_dellink.inc.php -$permissionedit=$user->rights->mymodule->write; // Used by the include of actions_lineupdown.inc.php -$permissiontoadd=$user->rights->mymodule->write; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->rights->mymodule->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->mymodule->write; // Used by the include of actions_dellink.inc.php +$permissionedit = $user->rights->mymodule->write; // Used by the include of actions_lineupdown.inc.php +$permissiontoadd = $user->rights->mymodule->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0); @@ -124,11 +125,11 @@ if (empty($reshook)) { $error=0; - $permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0); $backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1); - if (empty($backtopage)) { - if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist; - else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); } $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record @@ -226,7 +227,7 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
'."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 5bac2320b24..8d356775a78 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -96,7 +96,7 @@ class Mo extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>-1, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'index'=>1, 'comment'=>"Qty to produce",), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), @@ -104,11 +104,11 @@ class Mo extends CommonObject 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",), 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'), 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), - 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,), + 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'Done', '-1'=>'Canceled')), ); public $rowid; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 15a1aeff0a1..03e32174207 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -108,7 +108,7 @@ $permissionnote=$user->rights->mrp->write; // Used by the include of actions_set $permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php $permissionedit=$user->rights->mrp->write; // Used by the include of actions_lineupdown.inc.php $permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php - +$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0); /* @@ -125,11 +125,12 @@ if (empty($reshook)) { $error=0; - $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0); $backurlforlist = dol_buildpath('/mrp/mo_list.php', 1); - if (empty($backtopage)) { - if (empty($id)) $backtopage = $backurlforlist; - else $backtopage = dol_buildpath('/mrp/mo_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + + if (empty($backtopage) || ($cancel && empty($id))) { + //var_dump($backurlforlist);exit; + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; + else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); } $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record @@ -257,7 +258,9 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
'."\n"; + $object->fields['fk_bom']['disabled'] = 1; + + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 33bf1240c92..8684c23511e 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -332,7 +332,7 @@ class FormProduct * @param string $name Name of HTML field * @param string $measuring_style Unit to show: weight, size, surface, volume, time * @param string $default Preselected value - * @param int $adddefault Add empty unit called "Default" + * @param int|string $adddefault 1=Add empty unit called "Default", ''=Add empty value * @param int $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power) * @return string */ @@ -346,24 +346,26 @@ class FormProduct // TODO Use a cache require_once DOL_DOCUMENT_ROOT . '/core/class/cunits.class.php'; $measuringUnits = new CUnits($db); + + $filter = array(); + $filter['t.active'] = 1; + if ($measuring_style) $filter['t.unit_type'] = $measuring_style; + $result = $measuringUnits->fetchAll( '', '', 0, 0, - array( - 't.unit_type' => $measuring_style, - 't.active' => 1, - ) + $filter ); if ($result < 0) { dol_print_error($db); return -1; } else { $return .= '
'; - $coldisplay++; +if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) { + print ''; + $coldisplay++; if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { } else { print 'id.'#line_'.$line->id.'">'.img_edit().''; From 8e474701c1312501e8949fc3f45b7f2ac629d661 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 15:49:08 +0200 Subject: [PATCH 333/409] Fix missing token --- htdocs/core/class/html.formfile.class.php | 13 +++++++++---- htdocs/langs/en_US/mrp.lang | 1 + .../modulebuilder/template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 4 ++-- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/mrp/mo_document.php | 2 +- htdocs/mrp/mo_note.php | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8a0341135c7..82bfe17bf69 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -231,10 +231,10 @@ class FormFile if (empty($usewithoutform)) { - $out .= '