diff --git a/ChangeLog b/ChangeLog index 70ae8ff8b5c..54244427b81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -112,6 +112,7 @@ NEW: When you create product or service, sell accountancy account by default is NEW: Widget birthdays of the month. NEW: Option in workflow module to set a reception billed on validate supplier bill. NEW: Autocompletion on lists should be available on mobile applications. +NEW: Add mass action to close several members. For Developers: NEW: Module "DebugBar" is available as a stable module. @@ -121,7 +122,7 @@ NEW: Add constant XFRAMEOPTIONS_ALLOWALL NEW: Add function isValidVATID() NEW: ADD document's product support in APIs NEW: REST API: get the list of objects in a category. -NEW: Update Stripe library to 6.34.3 +NEW: Update Stripe library to 6.35 NEW: Upgrade jquery lib to 3.3.1 NEW: Add hook 'addHtmlHeader()' NEW: Add hook 'createRecurringInvoices()' @@ -174,7 +175,9 @@ Following changes may create regressions for some external modules, but were nec * Removed deprecated use of string in dol_print_date(). Only date allowed. * Deprecated property ->fk_departement is now ->state_id everywhere. * Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr. - +* Column llx_facture.facnumber change to llx_facture.ref +* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable + called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features. ***** ChangeLog for 9.0.3 compared to 9.0.2 ***** FIX: #11013 diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 881b5b1a6a4..b6d526bf8e1 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -191,7 +191,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 74d6bf700bb..32c6e50018e 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -271,7 +271,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 181bdb4ded4..dbb8e0d1310 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -188,7 +188,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 1410e5097cf..aa810a737b9 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -199,7 +199,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 30099b40be4..daf73e5b2a7 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -75,10 +75,13 @@ + @@ -97,8 +100,11 @@ - - + + + + 0 + + + + + 0 @@ -152,7 +162,10 @@ - + + + 0 + @@ -169,7 +182,16 @@ - + + @@ -310,22 +332,29 @@ - + + + + 0 + 0 0 + 0 @@ -334,12 +363,15 @@ + 0 + 0 + 0 diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 9d4f4b68370..0193d9c1f75 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -247,11 +247,10 @@ if ($resql) print ''; print ''; - $newcardbutton = '' . $langs->trans("Addanaccount").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create'); - print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); + + print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); // Box to select active chart of account print $langs->trans("Selectchartofaccounts") . " : "; @@ -298,7 +297,7 @@ if ($resql) if (! empty($arrayfields['aa.pcg_type']['checked'])) print ''; if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print ''; if (! empty($arrayfields['aa.active']['checked'])) print ' '; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ''; @@ -390,11 +389,11 @@ if ($resql) { print ''; if (empty($obj->active)) { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index df2dec9d3b1..725dddf1339 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -111,14 +111,9 @@ if ($result) $i = 0; - if (! empty($user->rights->accounting->fiscalyear)) - { - $addbutton = '' . $langs->trans("NewFiscalYear") .''; - } - else - { - $addbutton = '' . $langs->trans("NewFiscalYear") .''; - } + + $addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear); + $title = $langs->trans('AccountingPeriods'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1); diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 965b63ba9b9..984a5b08e90 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -214,11 +214,11 @@ if (! empty($user->admin)) print ''; print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -227,11 +227,11 @@ if (! empty($user->admin)) print ''; print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -240,11 +240,11 @@ if (! empty($user->admin)) print ''; print '' . $langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL") . ''; if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -253,11 +253,11 @@ if (! empty($user->admin)) print ''; print '' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -266,11 +266,11 @@ if (! empty($user->admin)) print ''; print '' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . ''; if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -279,11 +279,11 @@ if (! empty($user->admin)) print ''; print '' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 8974b65a68f..d94ce0ec315 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -531,11 +531,11 @@ if ($action == 'create') print '' . $langs->trans("Status") . ''; print ''; if (empty($object->validated)) { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 207ea3464d8..073d180cd16 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -443,19 +443,18 @@ print ''; print ''; $listofformat=AccountancyExport::getType(); -$button = ''; -if (count($filter)) $button.= $langs->trans("ExportFilteredList"); -else $button.= $langs->trans("ExportList"); -//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')'; -$button.= ''; + +if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList"); +else $buttonLabel = $langs->trans("ExportList"); + +$newcardbutton = dolGetButtonTitle($buttonLabel, '', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'')); + +$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); + +$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create'); -$groupby = ' ' . $langs->trans("GroupByAccountAccounting") . ''; -$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; -$newcardbutton.= ''; -$newcardbutton.= ''; - -print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$newcardbutton, '', $limit); +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $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 diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 38dc49c5bf6..a2cf4864df8 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -256,10 +256,8 @@ if ($action == 'delbookkeepingyear') { print '
'; -$viewflat = ' ' . $langs->trans("ViewFlatList") . ''; -$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; -$newcardbutton.= ''; -$newcardbutton.= ''; +$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); +$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create'); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index b9339a8150b..0bfbbea2581 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France - + * Copyright (C) 2017 André Schild * * 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 @@ -51,6 +51,7 @@ class AccountancyExport public static $EXPORT_TYPE_AGIRIS = 9; public static $EXPORT_TYPE_FEC = 11; public static $EXPORT_TYPE_OPENCONCERTO = 12; + public static $EXPORT_TYPE_SAGE50_SWISS = 13; /** @@ -106,6 +107,7 @@ class AccountancyExport self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), + self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'), ); } @@ -130,6 +132,7 @@ class AccountancyExport self::$EXPORT_TYPE_AGIRIS => 'agiris', self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto', self::$EXPORT_TYPE_FEC => 'fec', + self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch', ); return $formatcode[$type]; @@ -194,6 +197,10 @@ class AccountancyExport 'label' => $langs->trans('Modelcsv_openconcerto'), 'ACCOUNTING_EXPORT_FORMAT' => 'csv', ), + self::$EXPORT_TYPE_SAGE50_SWISS => array( + 'label' => $langs->trans('Modelcsv_Sage50_Swiss'), + 'ACCOUNTING_EXPORT_FORMAT' => 'csv', + ), ), 'cr'=> array ( '1' => $langs->trans("Unix"), @@ -261,6 +268,9 @@ class AccountancyExport case self::$EXPORT_TYPE_FEC : $this->exportFEC($TData); break; + case self::$EXPORT_TYPE_SAGE50_SWISS : + $this->exportSAGE50SWISS($TData); + break; default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; @@ -575,19 +585,19 @@ class AccountancyExport $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->piece_num . $separator; - print $line->label_operation . $separator; + print self::toAnsi($line->label_operation) . $separator; print $date . $separator; - print $line->label_operation . $separator; + print self::toAnsi($line->label_operation) . $separator; if (empty($line->subledger_account)) { print length_accountg($line->numero_compte) . $separator; - print $line->label_compte . $separator; + print self::toAnsi($line->label_compte) . $separator; } else { print length_accounta($line->subledger_account) . $separator; - print $line->subledger_label . $separator; + print self::toAnsi($line->subledger_label) . $separator; } - print $line->doc_ref . $separator; + print self::toAnsi($line->doc_ref) . $separator; print price($line->debit) . $separator; print price($line->credit) . $separator; print price($line->montant) . $separator; @@ -616,7 +626,7 @@ class AccountancyExport $date = dol_print_date($line->doc_date, '%d/%m/%Y'); print $date . $separator; - print $line->code_journal; + print $line->code_journal . $separator; if (empty($line->subledger_account)) { print length_accountg($line->numero_compte) . $separator; } else { @@ -757,6 +767,156 @@ class AccountancyExport } } + /** + * Export format : SAGE50SWISS + * + * https://onlinehelp.sageschweiz.ch/default.aspx?tabid=19984 + * http://media.topal.ch/Public/Schnittstellen/TAF/Specification/Sage50-TAF-format.pdf + * + * @param array $objectLines data + * + * @return void + */ + public function exportSAGE50SWISS($objectLines) + { + // SAGE50SWISS + $this->separator = ','; + $this->end_line = "\r\n"; + + // Print header line + print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag"; + print $this->end_line; + $thisPieceNum= ""; + $thisPieceAccountNr= ""; + $aSize= count($objectLines); + foreach ($objectLines as $aIndex=>$line) + { + $sammelBuchung= false; + if ($aIndex-2 >= 0 && $objectLines[$aIndex-2]->piece_num == $line->piece_num) + { + $sammelBuchung= true; + } + elseif ($aIndex+2 < $aSize && $objectLines[$aIndex+2]->piece_num == $line->piece_num) + { + $sammelBuchung= true; + } + elseif ($aIndex+1 < $aSize + && $objectLines[$aIndex+1]->piece_num == $line->piece_num + && $aIndex-1 < $aSize + && $objectLines[$aIndex-1]->piece_num == $line->piece_num + ) + { + $sammelBuchung= true; + } + + //Blg + print $line->piece_num . $this->separator; + + // Datum + $date = dol_print_date($line->doc_date, '%d.%m.%Y'); + print $date . $this->separator; + + // Kto + print length_accountg($line->numero_compte) . $this->separator; + // S/H + if ($line->sens == 'D') + { + print 'S' . $this->separator; + } + else + { + print 'H' . $this->separator; + } + //Grp + print self::trunc($line->code_journal, 1) . $this->separator; + // GKto + if (empty($line->code_tiers)) + { + if ($line->piece_num == $thisPieceNum) + { + print length_accounta($thisPieceAccountNr) . $this->separator; + } + else + { + print "div" . $this->separator; + } + } + else + { + print length_accounta($line->code_tiers) . $this->separator; + } + //SId + print $this->separator; + //SIdx + print "0" . $this->separator; + //KIdx + print "0" . $this->separator; + //BTyp + print "0" . $this->separator; + + //MTyp 1=Fibu Einzelbuchung 2=Sammebuchung + if ($sammelBuchung) + { + print "2" . $this->separator; + } + else + { + print "1" . $this->separator; + } + // Code + print '""' . $this->separator; + // Netto + if ($line->montant >= 0) + { + print $line->montant . $this->separator; + } + else + { + print $line->montant*-1 . $this->separator; + } + // Steuer + print "0.00" . $this->separator; + // FW-Betrag + print "0.00" . $this->separator; + // Tx1 + $line1= self::toAnsi($line->label_compte, 29); + if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3) + { + $line1= ""; + } + $line2= self::toAnsi($line->doc_ref, 29); + if (strlen($line1) == 0) + { + $line1= $line2; + $line2= ""; + } + if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27) + { + $line1= $line1 . ' / ' . $line2; + $line2= ""; + } + + print '"' . self::toAnsi($line1). '"' . $this->separator; + // Tx2 + print '"' . self::toAnsi($line2). '"' . $this->separator; + //PkKey + print "0" . $this->separator; + //OpId + print $this->separator; + + // Flag + print "0"; + + print $this->end_line; + + if ($line->piece_num !== $thisPieceNum) + { + $thisPieceNum= $line->piece_num; + $thisPieceAccountNr= $line->numero_compte; + } + } + } + /** * * @param string $str data @@ -767,4 +927,20 @@ class AccountancyExport { return dol_trunc($str, $size, 'right', 'UTF-8', 1); } + + /** + * + * @param unknown $str Original string to encode and optionaly truncate + * @param integer $size truncate string after $size characters + * @return string String encoded in Windows-1251 charset + */ + public static function toAnsi($str, $size = -1) + { + $retVal= dol_string_nohtmltag($str, 1, 'Windows-1251'); + if ($retVal >= 0 && $size >= 0) + { + $retVal= mb_substr($retVal, 0, $size, 'Windows-1251'); + } + return $retVal; + } } diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index c8a855c0d8a..a704b1c9789 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -83,13 +83,13 @@ class AccountancySystem if ($rowid > 0 || $ref) { - $sql = "SELECT a.pcg_version, a.label, a.active"; + $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a"; $sql .= " WHERE"; if ($rowid) { $sql .= " a.rowid = '" . $rowid . "'"; } elseif ($ref) { - $sql .= " a.pcg_version = '" . $ref . "'"; + $sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'"; } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 33f8990bc8d..4d97b38bfb7 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -151,12 +151,13 @@ class AccountingAccount extends CommonObject /** * Load record in memory * - * @param int $rowid Id - * @param string $account_number Account number - * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system - * @return int <0 if KO, 0 if not found, Id of record if OK and found + * @param int $rowid Id + * @param string $account_number Account number + * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account + * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'. + * @return int <0 if KO, 0 if not found, Id of record if OK and found */ - public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) + public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') { global $conf; @@ -174,6 +175,9 @@ class AccountingAccount extends CommonObject if (! empty($limittocurrentchart)) { $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; } + if (! empty($limittoachartaccount)) { + $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; + } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index f6c178f2e4d..105251ec114 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -137,7 +137,7 @@ if ($object->id > 0) print '
'; $object->info($id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; @@ -151,9 +151,7 @@ if ($object->id > 0) $newcardbutton = ''; if (! empty($conf->agenda->enabled)) { - $newcardbutton.=''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); } if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5d57208eb0e..3aed4bc11d5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -273,7 +273,7 @@ if (empty($reshook)) { if (empty($login)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } } // Create new object @@ -509,7 +509,7 @@ if (empty($reshook)) { if (empty($login)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } else { $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; @@ -1567,7 +1567,7 @@ else $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 220); + print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 240); } // Confirm remove member diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fc61e56115c..3119e044be0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -596,7 +596,7 @@ class Adherent extends CommonObject { while ($obj=$this->db->fetch_object($resql2)) { - $this->type=$obj->label; + $this->type=$obj->label; } } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index c310bb18627..3a39632d783 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -65,7 +65,7 @@ class AdherentType extends CommonObject * @var string Adherent type label */ public $label; - + /** * @var string Adherent type nature */ @@ -410,8 +410,8 @@ class AdherentType extends CommonObject return -1; } } - - /** + + /** * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) @@ -422,7 +422,7 @@ class AdherentType extends CommonObject global $langs; if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } - else return $langs->trans("Physical & Morale"); + else return $langs->trans("Physical & Morale"); //return $morphy; } @@ -463,6 +463,7 @@ class AdherentType extends CommonObject } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -472,7 +473,7 @@ class AdherentType extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - private function _load_ldap_dn($info, $mode = 0) + public function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; @@ -485,12 +486,13 @@ class AdherentType extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - private function _load_ldap_info() + public function _load_ldap_info() { // phpcs:enable global $conf,$langs; diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index 4d860abcc68..885e453c6f1 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -43,13 +43,13 @@ if (empty($sortorder)) { $sortorder="ASC"; } if (empty($sortfield)) { $sortfield="d.login"; } if (! isset($statut)) { - $statut = 1 ; + $statut = 1 ; } if (! isset($cotis)) { - // by default, members must be up to date of subscription - $cotis=1; + // by default, members must be up to date of subscription + $cotis=1; } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0da7a2b0ea4..eaeb1fe305c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -189,6 +189,42 @@ if (empty($reshook)) $search_array_options=array(); } + // Close + if ($massaction == 'close' && $user->rights->adherent->creer) + { + $tmpmember = new Adherent($db); + $error=0; + $nbclose=0; + + $db->begin(); + + foreach($toselect as $idtoclose) + { + $tmpmember->fetch($idtoclose); + $result=$tmpmember->resiliate($user); + + if ($result < 0 && ! count($tmpmember->errors)) + { + setEventMessages($tmpmember->error, $tmpmember->errors, 'errors'); + } + else + { + if ($result > 0) $nbclose++; + } + } + + if (! $error) + { + setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs'); + + $db->commit(); + } + else + { + $db->rollback(); + } + } + // Mass actions $objectclass='Adherent'; $objectlabel='Members'; @@ -326,12 +362,11 @@ if ($search_type > 0) } $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 ($sall != "") $param.="&sall=".urlencode($sall); if ($statut != "") $param.="&statut=".urlencode($statut); if ($search_ref) $param.="&search_ref=".urlencode($search_ref); -if ($search_nom) $param.="&search_nom=".urlencode($search_nom); if ($search_civility) $param.="&search_civility=".urlencode($search_civility); if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname); if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); @@ -358,6 +393,7 @@ $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); +if ($user->rights->adherent->creer) $arrayofmassactions['close']=$langs->trans("Resiliate"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); @@ -365,9 +401,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->adherent->creer) { - $newcardbutton=''.$langs->trans('NewMember').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); } print ''; @@ -457,7 +491,7 @@ if (! empty($arrayfields['d.lastname']['checked'])) if (! empty($arrayfields['d.gender']['checked'])) { print ''; - $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); + $arraygender=array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print ''; } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 2ae7e2d0001..bffb3418dba 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -235,7 +235,7 @@ else print '
'; print ''.$langs->trans("MembersStatisticsByTown").'
'; print '
';//+ - print ''.$langs->trans("MembersStatisticsByRegion").'
';//+ + print ''.$langs->trans("MembersStatisticsByRegion").'
';//+ } print '
'; } diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 4a7229af5ef..5cad21cdd71 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -151,8 +151,7 @@ print '
'; print ''; print ''; print ''; print ''; + print''; } if (! empty($arrayfields['d.lastname']['checked'])) diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index e85eed336fb..99e3cc5f526 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -47,10 +47,10 @@ foreach($linkedObjectBlock as $key => $objectlink) + if ($user->rights->adherent->lire) { + $total = $total + $objectlink->amount; + echo price($objectlink->amount); + } ?> diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 089d817ac94..650a466140c 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -236,10 +236,8 @@ if (! $rowid && $action != 'create' && $action != 'edit') $newcardbutton=''; if ($user->rights->adherent->configurer) { - $newcardbutton=''.$langs->trans('NewMemberType').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); + } print ''; if ($optioncss != '') print ''; @@ -283,9 +281,9 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 24b4766471d..649bfab3d97 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -143,7 +143,7 @@ print ''; print ''; print ''; // Action column -print ''; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index b7f1f0e6db9..b6e62973cf7 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -275,7 +275,7 @@ foreach ($dirmodels as $reldir) } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index e8e035f8b49..efc192e6de1 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -184,7 +184,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 54f3a4cbb73..32398f05ada 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -987,7 +987,7 @@ else print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index bf02df80b5b..63597eaa22b 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -256,7 +256,7 @@ foreach ($dirmodels as $reldir) } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index a9b7d9e75ca..1d05d5e0afe 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -120,6 +120,12 @@ $modules=array( 'img' => 'trip' )*/ ), + 'holiday' => array( + array( + 'code' => 'MAIN_DELAY_HOLIDAYS', + 'img' => 'holiday' + ), + ), ); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); @@ -262,8 +268,8 @@ print $langs->trans("DescWeather").'
'; if($action == 'edit') { - $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod')); - $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod')); + $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; else $str_mode_enabled = $str_mode_percentage; print ''.$str_mode_enabled.''; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index a27be02acb0..6d1b640f45b 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -608,9 +608,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; // Delete - print ''; print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 05357c9ceb9..14cb63cd923 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -322,9 +322,7 @@ print ''; $newcardbutton=''; //if ($user->rights->emailcollector->creer) //{ -$newcardbutton=''.$langs->trans('New').''; -$newcardbutton.= ''; -$newcardbutton.= ''; +$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'])); //} print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); @@ -386,7 +384,7 @@ $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 ''; @@ -441,7 +439,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 04dcf3ddc36..23a154511c1 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -261,7 +261,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index cac83ef8d8b..da77c0e78d3 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -267,7 +267,7 @@ foreach ($dirmodels as $reldir) } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index b9b78e55ec9..94abf8df2ab 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -66,8 +66,8 @@ else if ($action == 'add' || GETPOST("modify")) { - $external_rss_title = "external_rss_title_" . GETPOST("norss"); - $external_rss_urlrss = "external_rss_urlrss_" . GETPOST("norss"); + $external_rss_title = "external_rss_title_" . GETPOST("norss", 'int'); + $external_rss_urlrss = "external_rss_urlrss_" . GETPOST("norss", 'int'); if (! empty($_POST[$external_rss_urlrss])) { @@ -95,7 +95,7 @@ if ($action == 'add' || GETPOST("modify")) { // Ajoute boite box_external_rss dans definition des boites $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; - $sql.= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss").' ('.GETPOST($external_rss_title)).")')"; + $sql.= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')"; if (! $db->query($sql)) { dol_print_error($db); @@ -103,8 +103,8 @@ if ($action == 'add' || GETPOST("modify")) } } - $result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . GETPOST("norss"), GETPOST($external_rss_title), 'chaine', 0, '', $conf->entity); - if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . GETPOST("norss"), GETPOST($external_rss_urlrss), 'chaine', 0, '', $conf->entity); + $result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . GETPOST("norss", 'int'), GETPOST($external_rss_title, 'alpha'), 'chaine', 0, '', $conf->entity); + if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . GETPOST("norss", 'int'), GETPOST($external_rss_urlrss, 'alpha'), 'chaine', 0, '', $conf->entity); if ($result1 && $result2) { @@ -122,13 +122,13 @@ if ($action == 'add' || GETPOST("modify")) if ($_POST["delete"]) { - if(GETPOST("norss")) + if (GETPOST("norss", 'int')) { $db->begin(); // Supprime boite box_external_rss de definition des boites $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def"; - $sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss"))." %'"; + $sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss", 'int'))." %'"; $resql=$db->query($sql); if ($resql) @@ -168,8 +168,8 @@ if ($_POST["delete"]) } - $result1=dolibarr_del_const($db, "EXTERNAL_RSS_TITLE_" . GETPOST("norss"), $conf->entity); - if ($result1) $result2=dolibarr_del_const($db, "EXTERNAL_RSS_URLRSS_" . GETPOST("norss"), $conf->entity); + $result1=dolibarr_del_const($db, "EXTERNAL_RSS_TITLE_".GETPOST("norss", 'int'), $conf->entity); + if ($result1) $result2=dolibarr_del_const($db, "EXTERNAL_RSS_URLRSS_".GETPOST("norss", 'int'), $conf->entity); if ($result1 && $result2) { @@ -270,13 +270,13 @@ if ($resql) print ''; print ""; - print ""; + print ""; print ""; print ''; print ""; - print ""; + print ""; print ""; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 57a18afcbd3..765f2e6f995 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -352,7 +352,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index a407edd3864..27f105435d5 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -331,7 +331,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 347d45d729d..e3571fdb253 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -257,7 +257,7 @@ foreach ($dirmodels as $reldir) } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index d11d07c5f38..7635c9a3c19 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -252,7 +252,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 517ec9b9dc5..4ee9e214890 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -162,7 +162,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN)) dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); //$link=img_picto($langs->trans("Active"),'tick').' '; - $link=''; + $link=''; //$link.=$langs->trans("Disable"); $link.=img_picto($langs->trans("Activated"), 'switch_on'); $link.=''; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index d74f10ca58c..bc12fd5ddd6 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -519,7 +519,7 @@ else { dol_fiche_head($head, 'common', '', -1); - print $langs->trans("EMailsDesc")."
\n"; + print ''.$langs->trans("EMailsDesc")."
\n"; print "
\n"; print '
'.$langs->trans("Filter").'
'.$langs->trans("Member").''; -$filter='s.client in (1,2,3)'; -print $form->select_company($id,'memberid',$filter,1); +print $form->select_company($id,'memberid','',1); print '
'.$langs->trans("User").''; print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 2e46262398f..8e8482d4398 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -247,9 +247,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->adherent->cotisation->creer) { - $newcardbutton=''.$langs->trans('NewSubscription').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); } print ''; @@ -308,7 +306,7 @@ if (! empty($arrayfields['d.fk_type']['checked'])) { print ''; print ''; - print' dateh, 'day'); ?> rights->adherent->lire) { - $total = $total + $objectlink->amount; - echo price($objectlink->amount); - } ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'.dol_escape_htmltag($objp->label).''; - if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } - elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } - else print $langs->trans("Physical & Morale"); + if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } + elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } + else print $langs->trans("Physical & Morale"); print ''.yn($objp->subscription).''.yn($objp->vote).'
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; - print ' '.img_edit().''; - print '   '; + print ''; + print ''.img_edit().''; print ' '.img_delete().''; print '
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
".$langs->trans("Title")."global->$keyrsstitle . "\">global->$keyrsstitle) . "\">
".$langs->trans("URL")."global->$keyrssurl . "\">global->$keyrssurl) . "\">
'; diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 4ce8d8c0b72..1e54fdea3dd 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -396,7 +396,7 @@ else { dol_fiche_head($head, 'common_emailing', '', -1); - print $langs->trans("EMailsDesc")."
\n"; + print ''.$langs->trans("EMailsDesc")."
\n"; print "
\n"; print '
'; diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index fa895f84182..931d1168238 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -356,7 +356,7 @@ $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 ''; @@ -406,7 +406,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 51fe9a25554..b4f5fbd3355 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -177,13 +177,13 @@ if ($action == 'add') } if (! $error && ! $_POST['url']) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("URL")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors'); $action = 'create'; $error++; } if (! $error && ! $_POST['titre']) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors'); $action = 'create'; $error++; } diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 310322aa44c..d1b56d51cee 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -256,9 +256,7 @@ if ($action == 'delete') $newcardbutton=''; if ($user->admin) { - $newcardbutton=''.$langs->trans('New').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF'])); } print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index aaba339e30e..4e80fe55e25 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -183,7 +183,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 0bbdf9eefdf..bd2d7782cef 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -61,6 +61,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); @@ -177,76 +179,25 @@ if ($action == 'edit') // Edit 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 ''; - // Show prof id 1 in address into pdf - - if (! $noCountryCode) + // Show prof id in address into pdf + for($i=1; $i<=6; $i++) { - $pid1=$langs->transcountry("ProfId1", $mysoc->country_code); - if ($pid1 == '-') $pid1=false; - } - else - { - $pid1 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid1) - { - print ''; - } - - // Show prof id 2 in address into pdf - - if (! $noCountryCode) - { - $pid2=$langs->transcountry("ProfId2", $mysoc->country_code); - if ($pid2 == '-') $pid2=false; - } - else - { - $pid2 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid2) - { - print ''; - } - - // Show prof id 3 in address into pdf - - if (! $noCountryCode) - { - $pid3=$langs->transcountry("ProfId3", $mysoc->country_code); - if ($pid3 == '-') $pid3=false; - } - else - { - $pid3 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid3) - { - print ''; - } - - // Show prof id 4 in address into pdf - - if (! $noCountryCode) - { - $pid4=$langs->transcountry("ProfId4", $mysoc->country_code); - if ($pid4 == '-') $pid4=false; - } - else - { - $pid4 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid4) - { - print ''; + 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 '
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; - print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS', isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0, 1, $noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; - print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS', isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0, 1, $noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; - print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS', isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0, 1, $noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; - print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS', isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0, 1, $noCountryCode); - 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 '
'; @@ -419,77 +370,26 @@ else // Show print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS, 1); print ''; - // Show prof id 1 in address into pdf - - if (! $noCountryCode) - { - $pid1=$langs->transcountry("ProfId1", $mysoc->country_code); - if ($pid1 == '-') $pid1=false; - } - else - { - $pid1 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid1) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; - print yn($conf->global->MAIN_PROFID1_IN_ADDRESS, 1); - print ''; - } - - // Show prof id 2 in address into pdf - - if (! $noCountryCode) - { - $pid2=$langs->transcountry("ProfId2", $mysoc->country_code); - if ($pid2 == '-') $pid2=false; - } - else - { - $pid2 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid2) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; - print yn($conf->global->MAIN_PROFID2_IN_ADDRESS, 1); - print ''; - } - - // Show prof id 3 in address into pdf - - if (! $noCountryCode) - { - $pid3=$langs->transcountry("ProfId3", $mysoc->country_code); - if ($pid3 == '-') $pid3=false; - } - else - { - $pid3 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid3) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; - print yn($conf->global->MAIN_PROFID3_IN_ADDRESS, 1); - print ''; - } - - // Show prof id 4 in address into pdf - - if (! $noCountryCode) - { - $pid4=$langs->transcountry("ProfId4", $mysoc->country_code); - if ($pid4 == '-') $pid4=false; - } - else - { - $pid4 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid4) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; - print yn($conf->global->MAIN_PROFID4_IN_ADDRESS, 1); - 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 ''.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print yn($conf->global->$keyforconstant, 1); + print ''; + } + } print ''."\n"; print '
'; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index db41876b02c..843de325e73 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -314,7 +314,7 @@ foreach ($dirmodels as $reldir) } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index f97c1d7823b..a1fd76e0d5d 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -266,7 +266,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 96552ed2c0d..e0b4b986969 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -64,10 +64,10 @@ if ($action == 'update' || $action == 'add') $constnote=$_POST["constnote"][$key]; $res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); - + if (! $res > 0) $error++; } - + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -123,9 +123,9 @@ $head = mailmanspip_admin_prepare_head(); if (! empty($conf->global->ADHERENT_USE_SPIP)) { print ''; - + dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); - + //$link=img_picto($langs->trans("Active"),'tick').' '; $link=''; //$link.=$langs->trans("Disable"); @@ -141,25 +141,25 @@ if (! empty($conf->global->ADHERENT_USE_SPIP)) print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); print '
'; - + form_constantes($constantes, 2); - + dol_fiche_end(); print '
'; - + print ''; } else { dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); - - $link='
'; + + $link=''; //$link.=$langs->trans("Activate"); $link.=img_picto($langs->trans("Disabled"), 'switch_off'); $link.=''; print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); - + dol_fiche_end(); } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 6d8936fbe71..836afc27a7c 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -276,7 +276,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index c414eca8158..e895a0b4005 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -178,7 +178,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER') // TODO We add/delete permission here until permission can have a condition on a global var include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; $newmodule=new modFournisseur($db); - + if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) { // clear default rights array @@ -191,7 +191,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER') $newmodule->rights[$r][3] = 0; $newmodule->rights[$r][4] = 'commande'; $newmodule->rights[$r][5] = 'approve2'; - + // Insert $newmodule->insert_permissions(1); } @@ -199,7 +199,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER') { // Remove all rights with Permission1190 $newmodule->delete_permissions(); - + // Add all right without Permission1190 $newmodule->insert_permissions(1); } @@ -306,7 +306,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 4cf53e6d82f..49af65bd786 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -268,7 +268,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index b757fb66673..8b17c860fd4 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -283,7 +283,7 @@ foreach ($dirmodels as $reldir) } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 8e018bc2255..c04c91e0e66 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -36,7 +36,13 @@ $action=GETPOST('action', 'alpha'); if ($action == 'convert') { - $db->query("alter table ".$_GET["table"]." ENGINE=INNODB"); + $sql="ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB"; + $db->query($sql); +} +if ($action == 'convertutf8') +{ + $sql="ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $db->query($sql); } @@ -111,23 +117,28 @@ else print ''.$obj->Name.''; print ''.$obj->Engine.''; - if (isset($row[1]) && $row[1] == "MyISAM") + if (isset($obj->Engine) && $obj->Engine == "MyISAM") { - print ''.$langs->trans("Convert").''; + print ''.$langs->trans("Convert").' InnoDB'; } else { print ' '; } print ''.$obj->Row_format.''; - print ''.$obj->Rows.''; - print ''.$obj->Avg_row_length.''; - print ''.$obj->Data_length.''; - print ''.$obj->Max_data_length.''; - print ''.$obj->Index_length.''; - print ''.$obj->Auto_increment.''; - print ''.$obj->Check_time.''; - print ''.$obj->Collation.''; + print ''.$obj->Rows.''; + print ''.$obj->Avg_row_length.''; + print ''.$obj->Data_length.''; + print ''.$obj->Max_data_length.''; + print ''.$obj->Index_length.''; + print ''.$obj->Auto_increment.''; + print ''.$obj->Check_time.''; + print ''.$obj->Collation; + if (isset($obj->Collation) && ($obj->Collation == "utf8mb4_general_ci" || $obj->Collation == "utf8mb4_unicode_ci")) + { + print '
'.$langs->trans("Convert").' UTF8'; + } + print ''; print ''; $i++; } diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f9e985cec94..331d7e992ba 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -259,7 +259,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->TICKET_ADDON == 'mod_' . $classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; + print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; } print ''; diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index c593846a29d..c1ddedfea53 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -36,6 +36,8 @@ $export_type=GETPOST('export_type', 'alpha'); $file=GETPOST('zipfilename_template', 'alpha'); $compression = GETPOST('compression'); +$file = dol_sanitizeFileName($file); + $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST("page", 'int'); @@ -57,10 +59,11 @@ $errormsg=''; if ($action == 'delete') { - $file=$conf->admin->dir_output.'/'.GETPOST('urlfile'); - $ret=dol_delete_file($file, 1); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + $filerelative = dol_sanitizeFileName(GETPOST('urlfile', 'alpha')); + $filepath=$conf->admin->dir_output.'/'.$filerelative; + $ret=dol_delete_file($filepath, 1); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filerelative), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filerelative), null, 'errors'); $action=''; } diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 987f965576a..d508afe63d2 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -255,7 +255,7 @@ if ($result) //print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index b1e8c310ed0..806f53c463c 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -171,13 +171,13 @@ foreach($workflowcodes as $key => $params) { if (! empty($conf->global->$key)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 6d7ac9d2f85..ed23151d99b 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -108,13 +108,13 @@ print ''.$langs->trans("ApiProductionMode").''; $production_mode=(empty($conf->global->API_PRODUCTION_MODE)?false:true); if ($production_mode) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 029b5334d55..7ca92570aa4 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -372,7 +372,7 @@ $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 ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -421,7 +421,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index ae64665bbfd..d7302a2c795 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -449,7 +449,7 @@ class BlockedLog { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties 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','lines' + 'ref','ref_client','ref_supplier','date','datef','datev','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' ))) continue; // Discard if not into a dedicated list if ($key == 'lines') { @@ -459,8 +459,8 @@ class BlockedLog $lineid++; foreach($tmpline as $keyline => $valueline) { - if (! in_array($keyline, array( - 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' + if (! in_array($keyline, array( + 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' ))) continue; // Discard if not into a dedicated list if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass(); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php new file mode 100644 index 00000000000..a4bf134e3ce --- /dev/null +++ b/htdocs/bom/bom_agenda.php @@ -0,0 +1,248 @@ + + * 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 htdocs/modulebuilder/template/myobject_agenda.php + * \ingroup bom + * \brief Page of MyObject events + */ + +// Load Dolibarr environment +require '../main.inc.php'; +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'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.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, 'bom', $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 BOM($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomagenda','globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); + +// 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->bom->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 = bomPrepareHead($object); + + + dol_fiche_head($head, 'agenda', $langs->trans("BillOfMaterials"), -1, 'bom'); + + // 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->bom->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=''; + $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='&socid='.$socid; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + + //print load_fiche_titre($langs->trans("ActionsOnBom"), '', ''); + + // 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/bom/bom_card.php b/htdocs/bom/bom_card.php index 42dd3ba7d95..0f2dfb5e52b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -110,8 +110,40 @@ if (empty($reshook)) $autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO'; $trackid='bom'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; -} + // Add line + if ($action == 'addline' && $user->rights->bom->write) + { + $langs->load('errors'); + $error = 0; + + // Set if we used free entry or predefined product + $idprod=GETPOST('idprod', 'int'); + $qty=GETPOST('qty', 'int'); + $efficiency=GETPOST('efficiency', 'int'); + + if ($qty == '') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error++; + } + if (! ($idprod > 0)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors'); + $error++; + } + + $bomline = new BOMLine($db); + $bomline->fk_bom = $id; + $bomline->fk_product = $idprod; + $bomline->qty = $qty; + $bomline->efficiency = $efficiency; + + $result = $bomline->create($user); + if ($result <= 0) + { + setEventMessages($bomline->error, $bomline->errors, 'errors'); + } + } +} /* @@ -307,10 +339,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'; print '
'; - print ''."\n"; + print '
'."\n"; // Common attributes - //$keyforbreak='fieldkeytoswithonsecondcolumn'; + $keyforbreak='description'; include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; // Other attributes @@ -320,11 +352,67 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 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)) + { +// $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 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, '/bom/tpl'); + + $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"; @@ -335,7 +423,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - print '' . $langs->trans('SendMail') . ''."\n"; + //print '' . $langs->trans('SendMail') . ''."\n"; // Modify if ($user->rights->bom->write) diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 197b9779988..012094fbb05 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -68,8 +68,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('bom'); // 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->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->id); -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->ref); +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->ref); /* @@ -117,7 +117,7 @@ if ($object->id) print '
'; print '
'; - print ''; + print '
'; // Number of files print ''; @@ -132,10 +132,8 @@ if ($object->id) dol_fiche_end(); $modulepart = 'bom'; - //$permission = $user->rights->bom->create; - $permission = 1; - //$permtoedit = $user->rights->bom->create; - $permtoedit = 1; + $permission = $user->rights->bom->write; + $permtoedit = $user->rights->bom->write; $param = '&id=' . $object->id; //$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 8c9d60f1fe7..bbb51211137 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -372,12 +372,18 @@ print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; - if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $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'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -387,7 +393,7 @@ $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 ''; @@ -399,11 +405,11 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + $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'))) $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"; @@ -444,31 +450,23 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + 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 (! empty($arrayfields['t.'.$key]['checked'])) { - print ''; + 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, ''); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 9646b5d0d2e..de67cbc82e8 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -16,7 +16,7 @@ */ /** - * \file class/bom.class.php + * \file bom/class/bom.class.php * \ingroup bom * \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete) */ @@ -62,7 +62,7 @@ class BOM extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; - const STATUS_DISABLED = -1; + const STATUS_CANCELED = 9; /** @@ -94,18 +94,19 @@ 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,), - '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,), - 'date_valid' => array('type'=>'datetime', 'label'=>'DateValid', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), - 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), - 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), - 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), - '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'=>50, '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'), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')), + 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + '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,), + '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,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), + 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), + 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), ); public $rowid; public $ref; @@ -121,6 +122,7 @@ class BOM extends CommonObject public $status; public $fk_product; public $qty; + public $efficiency; // END MODULEBUILDER PROPERTIES @@ -758,8 +760,9 @@ class BOM extends CommonObject { global $langs; //$langs->load("mrp"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $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) @@ -772,28 +775,23 @@ class BOM extends CommonObject } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } } @@ -850,6 +848,31 @@ class BOM extends CommonObject } } + /** + * Create an array of lines + * + * @return array|int array of lines if OK, <0 if KO + */ + public function getLinesArray() + { + $this->lines=array(); + + $objectline = new BOMLine($this->db); + $result = $objectline->fetchAll('', '', 0, 0, array('fk_bom'=>$this->id)); + + if (is_numeric($result)) + { + $this->error = $this->error; + $this->errors = $this->errors; + return $result; + } + else + { + $this->lines = $result; + return $this->lines(); + } + } + /** * Initialise object with example values * Id must be 0 if object instance is a specimen @@ -923,7 +946,7 @@ class BOMLine extends CommonObject /** * @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png */ - public $picto = 'bomline@bom'; + public $picto = 'bomline'; /** @@ -951,20 +974,22 @@ class BOMLine extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), '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'), + 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'isameasure'=>'1',), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), - 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), - 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>40, 'notnull'=>1,), ); public $rowid; - public $description; - public $import_key; - public $qty; - public $fk_product; public $fk_bom; + public $fk_product; + public $description; + public $qty; + public $efficiency; public $rank; + public $import_key; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php new file mode 100644 index 00000000000..da9942fce44 --- /dev/null +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -0,0 +1,189 @@ + + * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Ferran Marcet + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) { + print "Error: this template page cannot be called directly as an URL"; + exit; +} + + +if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) +global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; + +if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility +elseif (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; + + +// Define colspan for the button 'Add' +$colspan = 3; // Columns: total ht + col edit + col delete +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required +if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +//print $object->element; + +// Lines for extrafield +$objectline = new BOMLine($this->db); +?> + + +lines) == 0 || $forcetoshowtitlelines); +if ($nolinesbefore) { +?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + global->PRODUCT_USE_UNITS) + { + print ''; + } + ?> + + + + + +global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay++; + echo ''; + } + + $coldisplay++; + ?> + + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + } + $remise_percent = $buyer->remise_percent; + if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') + { + $remise_percent = $seller->remise_supplier_percent; + } + + $coldisplay++; + ?> + + + + + +showOptionals($extrafieldsline, '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 new file mode 100644 index 00000000000..3763b771854 --- /dev/null +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -0,0 +1,325 @@ + + * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $seller, $buyer + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax; +if (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; + + +// Define colspan for the button 'Add' +$colspan = 3; // Col total ht + col edit + col delete +if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc +if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; +?> + + + + + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + $coldisplay++; + ?> + + fk_prev_id == null) { + print ''; + } else { + print ''; + } + + $coldisplay++; + print ''; + + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; + print ''; + } + + if ($inputalsopricewithtax) + { + $coldisplay++; + print ''; + } + ?> + + + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + } + ?> + + + + + + + +showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + +service->enabled) && $line->product_type == 1 && $dateSelector) { ?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + + + + + diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php new file mode 100644 index 00000000000..46c25e3674c --- /dev/null +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -0,0 +1,330 @@ + + * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 Juanjo Menent + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $object_rights->creer initialized from = $object->getRights() + * $disableedit, $disablemove, $disableremove + * + * $type, $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; + +if (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; +if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; + +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; +$domData .= ' data-qty="'.$line->qty.'"'; +$domData .= ' data-product_type="'.$line->product_type.'"'; + + +?> + + + > + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + + + + + + + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + + + + + + + + + + global->PRODUCT_USE_UNITS) + { + print ''; + } + ?> + + remise_percent) && $line->special_code != 3) { ?> + + + + global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); + + ?> + + special_code == 3) { ?> + + + + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + + + + + + + + + statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?> + + + + + 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> + + + + + + + + + + + + +showOptionals($extrafieldsline, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + + diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 17e23f0cadb..844443244cd 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -82,12 +82,8 @@ $userstatic=new User($db); llxHeader('', $langs->trans("ListOfBookmarks")); $newcardbutton=''; -if ($user->rights->bookmark->creer) -{ - $newcardbutton=''.$langs->trans('NewBookmark').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} +$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer)); + print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton); diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 4fcb7450e9d..cdba572f96c 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -121,7 +121,7 @@ print "\n"; print ''; print ''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index a7aab12b2ef..6dbbdd4f900 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -49,11 +49,11 @@ switch($action) // Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ... if ( $_POST['hdnSource'] == 'LISTE' ) { - $sql.= " AND p.rowid = ".$_POST['selProduit']; + $sql.= " AND p.rowid = ".((int) GETPOST('selProduit', 'int')); } elseif ( $_POST['hdnSource'] == 'REF' ) { - $sql.= " AND p.ref = '".$_POST['txtRef']."'"; + $sql.= " AND p.ref = '".$db->escape(GETPOST('txtRef', 'alpha'))."'"; } $result = $db->query($sql); diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 56da8496b9f..8bd64c76e2b 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -134,7 +134,7 @@ print ''; print "\n"; diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index d65a39fc6aa..bc8bb1bcaed 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -78,7 +78,7 @@ 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 ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
+
trans('AddNewLine'); ?>trans("FreeZone"); ?> +
trans('Qty'); ?>'; + print ''; + print $langs->trans('Unit'); + print 'textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?> 
+ + 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'; + + 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')); + } + 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')); + } + + echo ''; + } + + $coldisplay++; + ?> +
"> + '; + print $form->selectUnits($line->fk_unit, "units"); + print '"> + +
+
+ + + + + + + + fk_product > 0) { ?> + + fk_parent_line > 0) echo img_picto('', 'rightarrow'); + ?> + + product_type==1) echo img_object($langs->trans('ShowService'), 'service'); + else print img_object($langs->trans('ShowProduct'), 'product'); + echo ' '.$line->ref; + ?> + + product_label); + ?> + +

+ + + + 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); + } + + ?> +
' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '%fk_prev_id != null) print ' readonly'; + print '>fk_prev_id != null) print ' readonly'; + print '> + 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 'fk_prev_id != null ) print ' readonly'; + print '>'; + } else { ?> +   + + '; + print $form->selectUnits($line->fk_unit, "units"); + print ' + info_bits & 2) != 2) { + print 'fk_prev_id != null ) print ' readonly'; + print '>%'; + } else { ?> +   + + + ">
+ "> +
trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> + global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); + print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); + print ' '.$langs->trans('to').' '; + print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); + print '' + ?> +
+ info_bits & 2) == 2) { + ?> + + trans("ShowReduc"), 'reduc').' '; + if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); + elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); + elseif ($line->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); + //else $txt=$langs->trans("Discount"); + print $txt; + ?> + + description) + { + if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); + } + elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); + // Add date of deposit + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + echo ' ('.dol_print_date($discount->datec).')'; + } + elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); + } + elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); + } + else + { + echo ($txt?' - ':'').dol_htmlentitiesbr($line->description); + } + } + } + else + { + $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; + + if ($line->fk_product > 0) + { + echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } + else + { + if ($type==1) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); + + if (! empty($line->label)) { + $text.= ' '.$line->label.''; + echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } else { + if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); + echo $text.' '.dol_htmlentitiesbr($line->description); + } + } + + // Show date range + if ($line->element == 'facturedetrec') { + if ($line->date_start_fill || $line->date_end_fill) echo '
'; + if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + if ($line->date_start_fill && $line->date_end_fill) echo ' - '; + if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + if ($line->date_start_fill || $line->date_end_fill) echo '
'; + } + else { + if ($line->date_start || $line->date_end) echo '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + //echo get_date_range($line->date_start, $line->date_end, $format); + } + + // Add description in form + if ($line->fk_product > 0 && ! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (! empty($line->description) && $line->description!=$line->product_label)?'
'.dol_htmlentitiesbr($line->description):''; + } + } + + if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) + { + $accountingaccount=new AccountingAccount($this->db); + $accountingaccount->fetch($line->fk_accounting_account); + echo '

' . $langs->trans('AccountingAffectation') . ' : ' . $accountingaccount->getNomUrl(0, 1, 1); + } + + ?> +
ref_fourn?$line->ref_fourn:$line->ref_supplier); + ?>tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); + if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); + if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); + //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); + ?>subprice); ?>multicurrency_subprice); ?>pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?> + info_bits & 2) != 2) && $line->special_code != 3) { + // 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;"')." "; + 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 + } else echo ' '; + ?> + '; + $label = $line->getLabelOfUnit('short'); + if ($label !== '') { + print $langs->trans($label); + } + print 'remise_percent, $langs); + ?> trans('Option'); ?>global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print 'country_code).'='.price($line->total_ht); + print '
'.$langs->transcountry("TotalVAT", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_tva); + if (price2num($line->total_localtax1)) print '
'.$langs->transcountry("TotalLT1", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax1); + if (price2num($line->total_localtax2)) print '
'.$langs->transcountry("TotalLT2", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax2); + print '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); + print '">'; + } + print price($line->total_ht); + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print '
'; + } + ?> +
multicurrency_total_ht); ?>total_ttc); ?> + info_bits & 2) == 2 || ! empty($disableedit)) { ?> + + id.'#line_'.$line->id; ?>"> + + + + + 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 ''; + } + ?> + + 0) { ?> + id; ?>"> + + + + + id; ?>"> + + + + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>>
'.$langs->trans("CashDeskThirdPartyForSell").''; -print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3) AND s.status = 1', 1, 0, 0, array(), 0); +print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client in (1,3) AND s.status = 1)', 1, 0, 0, array(), 0); print '
'; $disabled=0; $langs->load("companies"); if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice -print $form->select_company(GETPOST('socid', 'int')?GETPOST('socid', 'int'):$conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3) AND s.status = 1', !$disabled, $disabled, 1); +print $form->select_company(GETPOST('socid', 'int')?GETPOST('socid', 'int'):$conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client IN (1,3) AND s.status = 1)', !$disabled, $disabled, 1); //print ''; print '
'; + print '
'; // Prospect/Customer print ''; - + if (! empty($conf->banque->enabled)) { if ($object->fk_account > 0) @@ -502,7 +524,6 @@ if ($id) print '
'.$langs->trans('ProspectCustomer').''; @@ -534,7 +534,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; // Level of prospect print ''; // Company print ''; // User diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index bbdfc57af50..1b78370048a 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink) - + - - + + diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 48b4ee6440d..eabb217fb99 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -161,7 +161,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) $error=0; if (empty($desc)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReasonDiscount")), null, 'errors'); $error++; } @@ -193,7 +193,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) } else { - setEventMessages($langs->trans("ErrorFieldFormat", $langs->trans("NewGlobalDiscount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("NewGlobalDiscount")), null, 'errors'); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 38a38d45b12..fd7832f868f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -815,7 +815,7 @@ class Commande extends CommonOrder } if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Source")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Source")); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } @@ -1685,7 +1685,7 @@ class Commande extends CommonOrder $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = dr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE c.rowid=".$id; @@ -4051,6 +4051,33 @@ class OrderLine extends CommonOrderLine $error=0; + // check if order line is not in a shipment line before deleting + $sqlCheckShipmentLine = "SELECT"; + $sqlCheckShipmentLine .= " ed.rowid"; + $sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed"; + $sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = " . $this->rowid; + + $resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine); + if (!$resqlCheckShipmentLine) { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + } else { + $langs->load('errors'); + $num = $this->db->num_rows($resqlCheckShipmentLine); + if ($num > 0) { + $error++; + $objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine); + $this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid; + $this->errors[] = $this->error; + } + $this->db->free($resqlCheckShipmentLine); + } + if ($error) { + dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR); + return -1; + } + $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ad3fd777a5c..f64aadf0e53 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -443,10 +443,8 @@ if ($resql) $newcardbutton=''; if ($contextpage == 'orderlist' && $user->rights->commande->creer) { - $newcardbutton=''.$langs->trans('NewOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/commande/card.php?action=create'); + } // Lines of title fields print ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 3a40f6b1863..81a477d07c5 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -264,7 +264,7 @@ print '
'; diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index fff9b40d5ea..a4bba8f7adc 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -267,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') { $error = 0; if ($action == 'createfilter' && empty($template_name)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('AdvTgtOrCreateNewFilter')), null, 'errors'); $error ++; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 34ed7708e9e..b6f5d9328f8 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -424,7 +424,7 @@ if (empty($reshook)) $object->sendto = $_POST["sendto"]; if (! $object->sendto) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("MailTo")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTo")), null, 'errors'); $error++; } @@ -471,13 +471,13 @@ if (empty($reshook)) if ($result) { setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs'); + $action = ''; } else { setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); + $action = 'test'; } - - $action=''; } } @@ -746,7 +746,7 @@ if ($action == 'create') dol_fiche_head(); - print ''; + print '
'; print ''; print ''; print ''; @@ -870,7 +870,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 300); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600); } } @@ -893,7 +893,7 @@ else print '
'; print '
'; - print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; + print '
'; // Description print '
'.$form->editfieldkey("MailTitle", 'titre', $object->titre, $object, $user->rights->mailing->creer && $object->statut < 3, 'string').''; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index b9c93ece52c..3cc5f12566d 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -130,13 +130,12 @@ if ($action == 'delete') $resql=$db->query($sql); if ($resql) { - if (!empty($id)) + if (! empty($id)) { $obj = new MailingTargets($db); $obj->update_nb($id); - header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } else { @@ -196,7 +195,7 @@ if ($object->fetch($id) >= 0) print '
'; print '
'; - print ''; + print '
'; print ''; @@ -432,7 +431,6 @@ if ($object->fetch($id) >= 0) $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $param = "&id=".$object->id; @@ -471,7 +469,7 @@ if ($object->fetch($id) >= 0) if ($page) $param.= "&page=".$page; print '
'; - print '
'.$langs->trans("MailTitle").''.$object->titre.'
'; + print '
'; // Ligne des champs de filtres print ''; @@ -505,7 +503,7 @@ if ($object->fetch($id) >= 0) print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1); print ''; // Action column - print ''; @@ -533,6 +531,15 @@ if ($object->fetch($id) >= 0) if ($num) { + include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $objectstaticmember=new Adherent($db); + $objectstaticuser=new User($db); + $objectstaticcompany=new Societe($db); + $objectstaticcontact=new Contact($db); + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -551,32 +558,23 @@ if ($object->fetch($id) >= 0) { if ($obj->source_type == 'member') { - include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $objectstatic=new Adherent($db); - $objectstatic->fetch($obj->source_id); - print $objectstatic->getNomUrl(1); + $objectstaticmember->fetch($obj->source_id); + print $objectstaticmember->getNomUrl(1); } elseif ($obj->source_type == 'user') { - include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $objectstatic=new User($db); - $objectstatic->fetch($obj->source_id); - $objectstatic->id=$obj->source_id; - print $objectstatic->getNomUrl(1); + $objectstaticuser->fetch($obj->source_id); + print $objectstaticuser->getNomUrl(1); } elseif ($obj->source_type == 'thirdparty') { - include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $objectstatic=new Societe($db); - $objectstatic->fetch($obj->source_id); - print $objectstatic->getNomUrl(1); + $objectstaticcompany->fetch($obj->source_id); + print $objectstaticcompany->getNomUrl(1); } elseif ($obj->source_type == 'contact') { - include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $objectstatic=new Contact($db); - $objectstatic->fetch($obj->source_id); - print $objectstatic->getNomUrl(1); + $objectstaticcontact->fetch($obj->source_id); + print $objectstaticcontact->getNomUrl(1); } else { @@ -605,7 +603,7 @@ if ($object->fetch($id) >= 0) if ($obj->statut == 0) // Not sent yet { if ($user->rights->mailing->creer && $allowaddtarget) { - print ''.img_delete($langs->trans("RemoveRecipient")).''; + print ''.img_delete($langs->trans("RemoveRecipient")).''; } } /*if ($obj->statut == -1) // Sent with error diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 54fdaef111b..da74efaaf98 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -156,9 +156,7 @@ if ($result) $newcardbutton=''; if ($user->rights->mailing->creer) { - $newcardbutton=''.$langs->trans('NewMailing').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create'); } $i = 0; @@ -193,7 +191,7 @@ if ($result) if (! $filteremail) print ''; print ''; print ''; - print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index abed072bc2c..c8cba5c3dda 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1679,7 +1679,7 @@ if ($action == 'create') print ''; print ''; print ''; } @@ -2421,10 +2421,15 @@ $formquestion = array_merge($formquestion, array( } print '
'; - print '
'; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '   '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ''; print '
'; + if (! empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) + { + print '
'; + } if (! empty($object->lines)) + { $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + } // Form to add new line if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') @@ -2439,16 +2444,21 @@ $formquestion = array_merge($formquestion, array( } } - print '
'; + if (! empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) + { + print '
'; + } print ''; print "\n"; dol_fiche_end(); + /* - * Boutons Actions + * Button Actions */ + if ($action != 'presend') { print '
'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b02f788f040..ff01690660a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -441,10 +441,8 @@ if ($resql) $newcardbutton=''; if ($user->rights->propal->creer) { - $newcardbutton=''.$langs->trans('NewPropal').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create'); + } // Lignes des champs de filtre print '
'; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 48138246824..aa47f1c226d 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -252,7 +252,7 @@ print '
'; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; - $filter='s.client in (1,2,3)'; + $filter='s.client IN (1,2,3)'; print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
getNomUrl(1); ?> ref_client; ?>date, 'day'); ?>date, 'day'); ?> rights->propale->lire) { $total = $total + $objectlink->total_ht; @@ -80,8 +80,8 @@ if (count($linkedObjectBlock) > 1)
trans("Total"); ?>
'; print ''; // Company print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index c8c3576f496..444927ea27d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -756,34 +756,16 @@ if ($resql) { if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments { - if ($user->rights->banque->modifier) { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } else { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); } - else // If direct entries is not done using miscellaneous payments + else // If direct entries is not done using miscellaneous payments { - if ($user->rights->banque->modifier) { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } else { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); } } else { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1); } } @@ -895,12 +877,12 @@ if ($resql) } if (! empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['ba.ref']['checked'])) { - print ''; } if (! empty($arrayfields['b.debit']['checked'])) @@ -924,7 +906,7 @@ if ($resql) } if (! empty($arrayfields['balance']['checked'])) { - print ''; @@ -958,7 +940,7 @@ if ($resql) if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); @@ -979,6 +961,7 @@ if ($resql) $balancebefore = 0; // For balance $balancecalculated = false; $posconciliatecol = 0; + $cachebankaccount = array(); // Loop on each record $sign = 1; @@ -1355,7 +1338,7 @@ if ($resql) // Bank account if (! empty($arrayfields['ba.ref']['checked'])) { - print '\n"; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 5a7ac205fe5..cc43f9cf830 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -44,7 +44,7 @@ class PaymentVarious extends CommonObject /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'bill'; + public $picto = 'payment'; /** * @var int ID @@ -63,6 +63,7 @@ class PaymentVarious extends CommonObject public $amount; public $type_payment; public $num_payment; + public $category_transaction; /** * @var string various payments label @@ -414,13 +415,13 @@ class PaymentVarious extends CommonObject $sign=1; if ($this->sens == '0') $sign=-1; - $bank_line_id = $acc->addline( + $bank_line_id = $acc->addline( $this->datep, $this->type_payment, $this->label, $sign * abs($this->amount), $this->num_payment, - '', + ($this->category_transaction > 0 ? $this->category_transaction : 0), $user ); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 080cef69778..aeb593f53b9 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -227,9 +227,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->banque->configurer) { - $newcardbutton.=''.$langs->trans("NewFinancialAccount").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create'); } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index a1c1d8ae349..2d911b5c6bb 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -37,7 +37,7 @@ if (! empty($conf->projet->enabled)) } // Load translation files required by the page -$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); +$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "categories")); // Get parameters $id = GETPOST('id', 'int'); @@ -45,14 +45,15 @@ $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); -$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; -$label=GETPOST("label", "alpha"); -$sens=GETPOST("sens", "int"); -$amount=GETPOST("amount", "alpha"); -$paymenttype=GETPOST("paymenttype", "int"); -$accountancy_code=GETPOST("accountancy_code", "alpha"); -$subledger_account=GETPOST("subledger_account", "alpha"); -$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; +$label = GETPOST("label", "alpha"); +$sens = GETPOST("sens", "int"); +$amount = GETPOST("amount", "alpha"); +$paymenttype = GETPOST("paymenttype", "int"); +$accountancy_code = GETPOST("accountancy_code", "alpha"); +$subledger_account = GETPOST("subledger_account", "alpha"); +$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +$category_transaction = GETPOST("category_transaction", 'alpha'); // Security check $socid = GETPOST("socid", "int"); @@ -64,8 +65,6 @@ $object = new PaymentVarious($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('variouscard','globalcard')); - - /** * Actions */ @@ -113,6 +112,7 @@ if (empty($reshook)) $object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; $object->num_payment=GETPOST("num_payment", 'alpha'); $object->fk_user_author=$user->id; + $object->category_transaction=GETPOST("category_transaction", 'alpha'); $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; $object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; @@ -144,6 +144,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); $error++; } + // TODO Remove this and allow instead to edit a various payment to enter accounting code if (! empty($conf->accounting->enabled) && ! $object->accountancy_code) { $langs->load('errors'); @@ -240,6 +241,16 @@ if ($id) } } +$options = array(); + +// Load bank groups +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; +$bankcateg = new BankCateg($db); + +foreach ($bankcateg->fetchAll() as $bankcategory) { + $options[$bankcategory->id] = $bankcategory->label; +} + /* ************************************************************************** */ /* */ /* Create mode */ @@ -259,7 +270,7 @@ if ($action == 'create') print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; -if ($mode == 'customer') $filter='s.client in (1,2,3)'; +if ($mode == 'customer') $filter='s.client IN (1,2,3)'; if ($mode == 'supplier') $filter='s.fournisseur = 1'; print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
'; - $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); + print ''; + $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''), 0, 'maxwidth100'); print ''; + print ''; $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); print $form->textwithpicto('', $htmltext, 1); print ''; + print ''; print $bankaccount->getNomUrl(1); print "
'; // Date payment - print ''; @@ -314,17 +325,48 @@ if ($action == 'create') print ''."\n"; } + // Project + if (! empty($conf->projet->enabled)) + { + $formproject=new FormProjets($db); + + // Associated project + $langs->load("projects"); + + print ''; + } + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; + + // Category + if (is_array($options) && count($options) && $conf->categorie->enabled) + { + print ''; + } + // Accountancy account if (! empty($conf->accounting->enabled)) { - print ''; + // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code + print ''; print ''; } else // For external software { - print ''; + print ''; print ''; } @@ -351,26 +393,6 @@ if ($action == 'create') print ''; } - // Project - if (! empty($conf->projet->enabled)) - { - $formproject=new FormProjets($db); - - // Associated project - $langs->load("projects"); - - print ''; - } - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; + print '
'; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).''; print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print '
'.$langs->trans("Project").''; + + $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); + + print '
'.$langs->trans("RubriquesTransactions").''; + print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1); + print '
'.$langs->trans("AccountAccounting").'
'.$langs->trans("AccountAccounting").''; print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print '
'.$langs->trans("AccountAccounting").'
'.$langs->trans("AccountAccounting").''; print '
'.$langs->trans("Project").''; - - $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); - - print '
'; dol_fiche_end(); @@ -395,7 +417,7 @@ if ($id) { $head=various_payment_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment'); + dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref='
'; // Project @@ -479,7 +501,7 @@ if ($id) print '
'; print $object->subledger_account; print '
'; - print '
'; print '
'; print '
'; @@ -514,7 +535,12 @@ if ($id) * Action buttons */ print '
'."\n"; - if ($object->rappro == 0) + + // TODO + // Add button modify + + // Delete + if (empty($object->rappro)) { if (! empty($user->rights->banque->modifier)) { @@ -529,6 +555,7 @@ if ($id) { print ''.$langs->trans("Delete").''; } + print "
"; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 02c3b331544..3d37b7e7de6 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -82,7 +82,7 @@ if ($object->id) { $head=various_payment_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, 'payment'); + dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref='
'; // Project diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index 9afae281f78..33fd53b602b 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -50,7 +50,7 @@ $object->info($id); $head = various_payment_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, 'payment'); +dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref='
'; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 8be0b075e40..c9aba472dd8 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -57,7 +57,7 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="v.datep"; +if (! $sortfield) $sortfield="v.datep,v.rowid"; if (! $sortorder) $sortorder="DESC"; $filtre=GETPOST("filtre", 'alpha'); @@ -110,13 +110,13 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$search_ref; +if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref); if ($search_label) $sql.=natural_search(array('v.label'), $search_label); if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; -if ($search_date) $sql.=" AND v.datep=".$search_date; -if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code; +if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account); +if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'"; +if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code); if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":", "=", $filtre); @@ -223,7 +223,7 @@ if ($result) // Credit print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -234,7 +234,7 @@ if ($result) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 32a5e50a452..d18a8c38cfe 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -402,7 +402,7 @@ $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 ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -458,7 +458,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 04ff015a498..6584af5db98 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -41,7 +41,7 @@ include_once 'class/cashcontrol.class.php'; $cashcontrol= new CashControl($db); $cashcontrol->fetch($id); -$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit; +//$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit; $sortorder='ASC'; $sortfield='b.datev,b.dateo,b.rowid'; @@ -152,7 +152,7 @@ if ($resql) $cash=$bank=$cheque=$other=0; $totalarray=array(); - while ($i < min($num, $limit)) + while ($i < $num) { $objp = $db->fetch_object($resql); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 9ad85788ca0..58a8fd32ef5 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -153,7 +153,7 @@ if ($resql) print ''; // print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 85b4e3bb728..260edb5f61c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -477,7 +477,7 @@ if (empty($reshook)) // Check parameters - // Check for mandatory fields defined into setup + // Check for mandatory fields in thirdparty (defined into setup) $array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL'); foreach($array_to_check as $key) { @@ -518,20 +518,40 @@ if (empty($reshook)) } } - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); + // Check for mandatory fields in invoice + $array_to_check=array('REF_CUSTOMER'=>'RefCustomer'); + foreach($array_to_check as $key => $val) + { + $keymin=strtolower($key); + $vallabel=$object->$keymin; + + // Check for mandatory + $keymandatory ='INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION'; + if (! $vallabel && ! empty($conf->global->$keymandatory)) + { + $langs->load("errors"); + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors'); + } } // Check for warehouse - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - if (! $idwarehouse || $idwarehouse == - 1) { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); - $action = ''; + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); + } else { + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + if (! $idwarehouse || $idwarehouse == - 1) { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $action = ''; + } } } @@ -575,20 +595,23 @@ if (empty($reshook)) $object->fetch($id); $object->fetch_thirdparty(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - // Check parameters - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - if (! $idwarehouse || $idwarehouse == - 1) { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); - $action = ''; + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); + } else { + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + if (! $idwarehouse || $idwarehouse == - 1) { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $action = ''; + } } } @@ -916,7 +939,7 @@ if (empty($reshook)) if (empty($dateinvoice)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -1543,7 +1566,7 @@ if (empty($reshook)) $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error++; - $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date")); + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); setEventMessages($mesg, null, 'errors'); } @@ -1551,7 +1574,7 @@ if (empty($reshook)) if (!($_POST['situations'] > 0)) { $error++; - $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")); + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); setEventMessages($mesg, null, 'errors'); } @@ -1920,7 +1943,7 @@ if (empty($reshook)) if ($result > 0) { - // Define output language + // Define output language and generate document if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; @@ -2032,7 +2055,7 @@ if (empty($reshook)) $line->fetch(GETPOST('lineid')); $percent = $line->get_prev_progress($object->id); - if($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0) + if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0) { // in case of situation credit note if(GETPOST('progress') >= 0 ) @@ -2124,7 +2147,7 @@ if (empty($reshook)) } } -$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'), $_POST['units'], $pu_ht_devise); @@ -2713,7 +2736,7 @@ if ($action == 'create') else { print ''; - print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { @@ -3426,28 +3449,35 @@ elseif ($id > 0 || ! empty($ref)) $text = $langs->trans('ConfirmDeleteBill', $object->ref); $formquestion = array(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->statut >= 1) { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); - $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' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) - ); - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); + } else { + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); + $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' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) + ); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); + } + else + { + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); + } } else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); } @@ -3496,35 +3526,38 @@ elseif ($id > 0 || ! empty($ref)) } $formquestion = array(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; - $formproduct = new FormProduct($db); - $warehouse = new Entrepot($db); - $warehouse_array = $warehouse->list_array(); - if (count($warehouse_array) == 1) { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array)); - $value = ''; + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); } else { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease"); - $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + $formproduct = new FormProduct($db); + $warehouse = new Entrepot($db); + $warehouse_array = $warehouse->list_array(); + if (count($warehouse_array) == 1) { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array)); + $value = ''; + } else { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease"); + $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + } + $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' => $label,'value' => $value)); } - $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' => $label,'value' => $value)); } if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on { @@ -3538,33 +3571,38 @@ elseif ($id > 0 || ! empty($ref)) $text = $langs->trans('ConfirmUnvalidateBill', $object->ref); $formquestion = array(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; - $formproduct = new FormProduct($db); - $warehouse = new Entrepot($db); - $warehouse_array = $warehouse->list_array(); - if (count($warehouse_array) == 1) { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array)); - $value = ''; + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + { + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); } else { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); - $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + $formproduct = new FormProduct($db); + $warehouse = new Entrepot($db); + $warehouse_array = $warehouse->list_array(); + if (count($warehouse_array) == 1) { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array)); + $value = ''; + } else { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); + $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + } + $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' => $label,'value' => $value)); } - $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' => $label,'value' => $value)); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('UnvalidateBill'), $text, 'confirm_modif', $formquestion, "yes", 1); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 017d4e22569..9036b513961 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -73,10 +73,10 @@ class Invoices extends DolibarrApi } // Get payment details - $this->invoice->totalpaye = $this->invoice->getSommePaiement(); + $this->invoice->totalpaid = $this->invoice->getSommePaiement(); $this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed(); $this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed(); - $this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT'); + $this->invoice->remaintopay = price2num($this->invoice->total_ttc - $this->invoice->totalpaid - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT'); if (! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 89f324d2450..c1cc9df9e5c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -527,7 +527,7 @@ class FactureRec extends CommonInvoice $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, '; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; - $sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc,'; + $sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; //$sql.= ' l.situation_percent, l.fk_prev_id,'; //$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.rang, l.special_code,'; @@ -583,6 +583,11 @@ class FactureRec extends CommonInvoice $line->total_tva = $objp->total_tva; $line->total_ttc = $objp->total_ttc; $line->code_ventilation = $objp->fk_code_ventilation; + $line->fk_fournprice = $objp->fk_fournprice; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $line->pa_ht = $marginInfos[0]; + $line->marge_tx = $marginInfos[1]; + $line->marque_tx = $marginInfos[2]; $line->rang = $objp->rang; $line->special_code = $objp->special_code; $line->fk_unit = $objp->fk_unit; @@ -695,15 +700,17 @@ class FactureRec extends CommonInvoice * @param double $pu_ht_devise Unit price in currency * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice + * @param int $fk_fournprice Supplier price id (to calculate margin) or '' + * @param int $pa_ht Buying price of line (to calculate margin) or '' * @return int <0 if KO, Id of line if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0) { global $mysoc; $facid=$this->id; - dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill", LOG_DEBUG); + dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill,pa_ht=$pa_ht", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Check parameters @@ -795,6 +802,8 @@ class FactureRec extends CommonInvoice $sql.= ", total_ttc"; $sql.= ", date_start_fill"; $sql.= ", date_end_fill"; + $sql.= ", fk_product_fournisseur_price"; + $sql.= ", buy_price_ht"; $sql.= ", info_bits"; $sql.= ", rang"; $sql.= ", special_code"; @@ -824,6 +833,8 @@ class FactureRec extends CommonInvoice $sql.= ", ".price2num($total_ttc); $sql.= ", ".(int) $date_start_fill; $sql.= ", ".(int) $date_end_fill; + $sql.= ", ".($fk_fournprice > 0 ? $fk_fournprice : 'null'); + $sql.= ", ".($pa_ht ? price2num($pa_ht) : 0); $sql.= ", ".$info_bits; $sql.= ", ".$rang; $sql.= ", ".$special_code; @@ -877,9 +888,11 @@ class FactureRec extends CommonInvoice * @param int $notrigger disable line update trigger * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice + * @param int $fk_fournprice Id of origin supplier price + * @param int $pa_ht Price (without tax) of product when it was bought * @return int <0 if KO, Id of line if OK */ - public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0) + public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0) { global $mysoc; @@ -894,16 +907,6 @@ class FactureRec extends CommonInvoice // Check parameters if ($type < 0) return -1; - $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - - // Clean vat code - $vat_src_code=''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) - { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } - if ($this->brouillon) { // Clean parameters @@ -932,10 +935,20 @@ class FactureRec extends CommonInvoice $pu=$pu_ttc; } - // Calcul du total TTC et de la TVA pour la ligne a partir de - // qty, pu, remise_percent et txtva + // Calculate total with, without tax and tax from qty, pu, remise_percent and txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; @@ -984,6 +997,8 @@ class FactureRec extends CommonInvoice $sql.= ", total_ttc='".price2num($total_ttc)."'"; $sql.= ", date_start_fill=".((int) $date_start_fill); $sql.= ", date_end_fill=".((int) $date_end_fill); + $sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : 'null'); + $sql.= ", buy_price_ht=".($pa_ht ? price2num($pa_ht) : 0); $sql.= ", info_bits=".$info_bits; $sql.= ", rang=".$rang; $sql.= ", special_code=".$special_code; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7483d527f4d..686190c359b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2284,7 +2284,7 @@ class Facture extends CommonInvoice // Controle que facture source connue if ($this->fk_facture_source <= 0) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("InvoiceReplacement")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceReplacement")); $this->db->rollback(); return -10; } @@ -3133,7 +3133,13 @@ class Facture extends CommonInvoice // phpcs:enable global $mysoc,$user; - include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; + // Progress should never be changed for discount lines + if (($line->info_bits & 2) == 2) + { + return; + } + + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Cap percentages to 100 if ($percent > 100) $percent = 100; @@ -3149,7 +3155,6 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc = $tabprice[18]; $line->update($user); $this->update_price(1); - $this->db->commit(); } /** @@ -4597,6 +4602,7 @@ class FactureLigne extends CommonInvoiceLine if ($result <= 0) { $this->error='ErrorProductIdDoesNotExists'; + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); return -1; } } @@ -4627,7 +4633,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; - $sql.= " ".$this->product_type.","; + $sql.= " ".((int) $this->product_type).","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index fa8af87ac29..5eedb9b5740 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -100,6 +100,20 @@ $permissionnote = $user->rights->facture->creer; // Used by the include of actio $permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php $permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php +$usercanread = $user->rights->facture->lire; +$usercancreate = $user->rights->facture->creer; +$usercanissuepayment = $user->rights->facture->paiement; +$usercandelete = $user->rights->facture->supprimer; +$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate))); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send); +$usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->reopen); +$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($usercancreate)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate))); + +$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); +$usercancreatemargin = $user->rights->margins->creer; +$usercanreadallmargin = $user->rights->margins->liretous; +$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; + $now = dol_now(); @@ -435,10 +449,12 @@ if (empty($reshook)) $predef=''; $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $price_ht = GETPOST('price_ht'); - if (GETPOST('prod_entry_mode') == 'free') + $price_ht_devise = GETPOST('multicurrency_price_ht'); + $prod_entry_mode = GETPOST('prod_entry_mode', 'alpha'); + if ($prod_entry_mode == 'free') { $idprod=0; - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); } else { @@ -466,11 +482,11 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error ++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { + if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error ++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' + if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error ++; @@ -479,7 +495,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error ++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { + if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error ++; } @@ -491,257 +507,239 @@ 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); - exit(); - } - $ret = $object->fetch_thirdparty(); - - // Clean parameters - $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); - $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); - $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); - - // Define special_code for special lines - $special_code = 0; - // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices - - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit - // Ecrase $base_price_type par celui du produit - // Replaces $fk_unit with the product's - if (! empty($idprod)) - { - $prod = new Product($db); - $prod->fetch($idprod); - - $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); - - // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); - if (empty($tva_tx)) $tva_npr=0; - - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - - // We define price for product - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) - { - $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; - $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 (empty($tva_tx)) $tva_npr=0; - } + $ret = $object->fetch($id); + if ($ret < 0) { + dol_print_error($db, $object->error); + exit(); } - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + $ret = $object->fetch_thirdparty(); + + // Clean parameters + $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); + $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); + $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); + + // Define special_code for special lines + $special_code = 0; + // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices + + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $tva_tx par celui du produit + // Ecrase $base_price_type par celui du produit + // Replaces $fk_unit with the product's + if (! empty($idprod)) { - include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + $prod = new Product($db); + $prod->fetch($idprod); - $prodcustprice = new Productcustomerprice($db); + $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); + // Update if prices fields are defined + $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + if (empty($tva_tx)) $tva_npr=0; - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) + // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. + $pqp = (GETPOST('pbq', 'int') ? GETPOST('pbq', 'int') : 0); + + $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); + + $pu_ht = $datapriceofproduct['pu_ht']; + $pu_ttc = $datapriceofproduct['pu_ttc']; + $price_min = $datapriceofproduct['price_min']; + $price_base_type = $datapriceofproduct['price_base_type']; + $tva_tx = $datapriceofproduct['tva_tx']; + $tva_npr = $datapriceofproduct['tva_npr']; + + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + + // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? + if (! empty($price_ht)) { - if (count($prodcustprice->lines) > 0) + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + elseif ($tmpvat != $tmpprodvat) + { + if ($price_base_type != 'HT') { - $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; + $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } - } - $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $desc = ''; - // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? - if (! empty($price_ht)) - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tmpvat != $tmpprodvat) - { - if ($price_base_type != 'HT') + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) + $newlang = GETPOST('lang_id', 'aZ09'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; } else { - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $desc = $prod->description; } - } - $desc = ''; + $desc = dol_concatdesc($desc, $product_desc); - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $outputlangs = $langs; - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id', 'aZ09')) - $newlang = GETPOST('lang_id', 'aZ09'); - if (empty($newlang)) - $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); + $tmptxt = '('; + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'alpha')) $newlang = GETPOST('lang_id', 'alpha'); + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); + } + if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; + if (! empty($prod->country_code)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; + if (! empty($prod->country_code)) $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } + $tmptxt .= ')'; + $desc = dol_concatdesc($desc, $tmptxt); } - $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; + $type = $prod->type; + $fk_unit = $prod->fk_unit; } else { - $desc = $prod->description; + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); + $tva_tx = str_replace('*', '', $tva_tx); + if (empty($tva_tx)) $tva_npr=0; + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + $desc = $product_desc; + $type = GETPOST('type'); + $fk_unit= GETPOST('units', 'alpha'); } - $desc = dol_concatdesc($desc, $product_desc); + $date_start_fill = GETPOST('date_start_fill', 'int'); + $date_end_fill = GETPOST('date_end_fill', 'int'); - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) - { - $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); - $tmptxt .= ')'; - $desc = dol_concatdesc($desc, $tmptxt); - } + // Margin + $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); + $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value - $type = $prod->type; - $fk_unit = $prod->fk_unit; - } - else - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); - $tva_tx = str_replace('*', '', $tva_tx); - if (empty($tva_tx)) $tva_npr=0; - $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); - $desc = $product_desc; - $type = GETPOST('type'); - $fk_unit= GETPOST('units', 'alpha'); - } + // Local Taxes + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - $date_start_fill = GETPOST('date_start_fill', 'int'); - $date_end_fill = GETPOST('date_end_fill', 'int'); + $info_bits = 0; + if ($tva_npr) + $info_bits |= 0x01; - // Margin - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value - - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - - $info_bits = 0; - if ($tva_npr) - $info_bits |= 0x01; - - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) - { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); - setEventMessages($mesg, null, 'errors'); - } - else - { - // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill); - - if ($result > 0) - { - /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $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 - - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - }*/ - $object->fetch($object->id); // Reload lines - - unset($_POST['prod_entry_mode']); - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['multicurrency_price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - unset($_POST['np_marginRate']); - unset($_POST['np_markRate']); - unset($_POST['dp_desc']); - unset($_POST['idprod']); - unset($_POST['units']); - - unset($_POST['date_starthour']); - unset($_POST['date_startmin']); - unset($_POST['date_startsec']); - unset($_POST['date_startday']); - unset($_POST['date_startmonth']); - unset($_POST['date_startyear']); - unset($_POST['date_endhour']); - unset($_POST['date_endmin']); - unset($_POST['date_endsec']); - unset($_POST['date_endday']); - unset($_POST['date_endmonth']); - unset($_POST['date_endyear']); - - unset($_POST['date_start_fill']); - unset($_POST['date_end_fill']); - - unset($_POST['situations']); - unset($_POST['progress']); + if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { + $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); + setEventMessages($mesg, null, 'errors'); } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + // Insert line + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); - $action = ''; - } + if ($result > 0) + { + // Define output language and generate document + /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $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 + + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + }*/ + $object->fetch($object->id); // Reload lines + + unset($_POST['prod_entry_mode']); + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + unset($_POST['dp_desc']); + unset($_POST['idprod']); + unset($_POST['units']); + + unset($_POST['date_starthour']); + unset($_POST['date_startmin']); + unset($_POST['date_startsec']); + unset($_POST['date_startday']); + unset($_POST['date_startmonth']); + unset($_POST['date_startyear']); + unset($_POST['date_endhour']); + unset($_POST['date_endmin']); + unset($_POST['date_endsec']); + unset($_POST['date_endday']); + unset($_POST['date_endmonth']); + unset($_POST['date_endyear']); + + unset($_POST['date_start_fill']); + unset($_POST['date_end_fill']); + + unset($_POST['situations']); + unset($_POST['progress']); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + + $action = ''; + } } } - elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel', 'alpha')) + elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) { if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -855,7 +853,7 @@ if (empty($reshook)) // Update line if (! $error) { -$result = $object->updateline( + $result = $object->updateline( GETPOST('lineid'), $description, $pu_ht, @@ -877,7 +875,9 @@ $result = $object->updateline( $pu_ht_devise, 0, $date_start_fill, - $date_end_fill + $date_end_fill, + $fournprice, + $buyingprice ); if ($result >= 0) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 05ce6cc3504..d12fc90fd77 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -607,9 +607,7 @@ if ($resql) $newcardbutton=''; if($user->rights->facture->creer) { - $newcardbutton=''.$langs->trans('NewBill').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/facture/card.php?action=create'); } $i = 0; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index d184fb58966..97f0b876abc 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -47,10 +47,31 @@ foreach($linkedObjectBlock as $key => $objectlink) if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - trans("CustomerInvoice"); ?> + type) { + case Facture::TYPE_REPLACEMENT: + echo $langs->trans("InvoiceReplacement"); + break; + case Facture::TYPE_CREDIT_NOTE: + echo $langs->trans("InvoiceAvoir"); + break; + case Facture::TYPE_DEPOSIT: + echo $langs->trans("InvoiceDeposit"); + break; + case Facture::TYPE_PROFORMA: + echo $langs->trans("InvoiceProForma"); + break; + case Facture::TYPE_SITUATION: + echo $langs->trans("InvoiceSituation"); + break; + default: + echo $langs->trans("CustomerInvoice"); + break; + } + ?> getNomUrl(1); ?> - ref_client; ?> - date, 'day'); ?> + ref_client; ?> + date, 'day'); ?> rights->facture->lire) { $sign = 1; @@ -76,8 +97,8 @@ if (count($linkedObjectBlock) > 1) trans("Total"); ?> - - + + diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 184c9600926..b7f9c307f14 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -45,9 +45,7 @@ $localtax_static = new Localtax($db); $newcardbutton=''; if ($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('NewLocalTaxPayment', ($ltt+1)).''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt+1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt); } print load_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments", $mysoc->country_code), $newcardbutton); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 0107ba60383..11de8aa48a2 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -138,9 +138,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->banque->cheque) { - $newcardbutton = ''.$langs->trans('NewCheckDeposit').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'); } print ''; @@ -177,7 +175,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c005e0d70e6..39089c31274 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -255,7 +255,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 49f44af1702..2b67b73c95b 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -108,9 +108,7 @@ if ($result) $newcardbutton=''; if ($user->rights->prelevement->bons->creer) { - $newcardbutton = ''.$langs->trans('NewStandingOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php'); } // Lines of title fields @@ -136,7 +134,7 @@ if ($result) print ' '; print ''; print ' '; - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 33728093ec1..8b11716bf6f 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -59,7 +59,7 @@ if ($action == 'confirm_rejet') if (empty($daterej)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } elseif ($daterej > dol_now()) diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 8180517a2e8..81e58e19cca 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -146,7 +146,7 @@ if ($result) print ''; print ' '; print ' '; - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; diff --git a/htdocs/compta/salaries/list.php b/htdocs/compta/salaries/list.php index 6ce49536d20..4fa8bd09a76 100644 --- a/htdocs/compta/salaries/list.php +++ b/htdocs/compta/salaries/list.php @@ -196,7 +196,7 @@ if ($result) // Amount print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 12acff2ee4d..3ac50a65e9a 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -602,6 +602,8 @@ if ($id > 0) $num = $db->num_rows($resql); $i = 0; $total = 0; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; print ''; @@ -668,6 +670,8 @@ if ($id > 0) print '\n"; print "
'.$langs->trans("RefPayment").''.price($resteapayer)."
"; + print '
'; + $db->free($resql); } else diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 01efe621dc8..7e25d8c3423 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -236,7 +236,7 @@ if ($resql) print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 061008f42a8..d735edd5840 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -150,10 +150,8 @@ if ($result) $newcardbutton=''; if ($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('NewVATPayment').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt+1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/tva/card.php?action=create'); + } print ''; if ($optioncss != '') print ''; @@ -189,7 +187,7 @@ if ($result) print ''; } print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 886a6171818..4d26fef7965 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -146,11 +146,20 @@ $dolibarr_main_db_character_set='utf8'; // Database character set used to sort data (forced during database creation. value of database is then used). // Default value: depends on database driver // Examples: -// dolibarr_main_db_collation='utf8_unicode_ci'; +// $dolibarr_main_db_collation='utf8_unicode_ci'; // $dolibarr_main_db_collation='utf8_unicode_ci'; +// dolibarr_main_instance_unique_id +// An ID that is unique for each installation. +// Default value: randomly defined during installation +// Examples: +// $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; +// +$dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; + + //################## // Login @@ -159,18 +168,18 @@ $dolibarr_main_db_collation='utf8_unicode_ci'; // dolibarr_main_authentication // This parameter contains the way authentication is done. // If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_* -// Default value: dolibarr +// Default value: 'dolibarr' // Possible values: Any values found in files in htdocs/core/login directory after // the "function_" string and before the ".php" string. You can also separate several // values using a ",". In this case, Dolibarr will check login/pass for each value in // order defined into value. However, note that this can't work with all values. // Examples: -// $dolibarr_main_authentication='http'; -// $dolibarr_main_authentication='dolibarr'; -// $dolibarr_main_authentication='ldap'; -// $dolibarr_main_authentication='openid,dolibarr'; -// $dolibarr_main_authentication='forceuser'; // Add also $dolibarr_auto_user='loginforuser'; - +// $dolibarr_main_authentication='dolibarr'; // Use the password defined into application on user record. +// $dolibarr_main_authentication='http'; // Use the HTTP Basic authentication +// $dolibarr_main_authentication='ldap'; // Check the password into a LDAP server +// $dolibarr_main_authentication='ldap,dolibarr'; // You can set several mode using a comma as a separator. +// $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser'; +// $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com // $dolibarr_main_authentication='dolibarr'; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 5b9e84f2d16..2b135c3cc37 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -227,7 +227,7 @@ else print '
'; $object->info($id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print '
'; @@ -261,9 +261,7 @@ else { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - $newcardbutton.=''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e310d3e0b6d..97dd835bda0 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -376,21 +376,24 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error++; - $result = $object->update($contactid, $user); - - if ($result > 0) { - // Categories association - $categories = GETPOST('contcats', 'array'); - $object->setCategories($categories); - - $object->old_lastname=''; - $object->old_firstname=''; - $action = 'view'; - } - else + if (! $error) { - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'edit'; + $result = $object->update($contactid, $user); + + if ($result > 0) { + // Categories association + $categories = GETPOST('contcats', 'array'); + $object->setCategories($categories); + + $object->old_lastname=''; + $object->old_firstname=''; + $action = 'view'; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; + } } } @@ -505,7 +508,7 @@ else $linkback=''; print load_fiche_titre($title, $linkback, 'title_companies.png'); - // Affiche les erreurs + // Show errors dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) @@ -800,8 +803,8 @@ else $objsoc = new Societe($db); $objsoc->fetch($object->socid); - // Affiche les erreurs - dol_htmloutput_errors($error, $errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) { @@ -1122,11 +1125,10 @@ else { $objsoc = new Societe($db); - /* - * Fiche en mode visualisation - */ + // View mode - dol_htmloutput_errors($error, $errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); dol_fiche_head($head, 'card', $title, -1, 'contact'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d350c8b3ff3..dfefb8060fe 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -698,9 +698,9 @@ class Contact extends CommonObject $langs->load("dict"); - dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); + dol_syslog(get_class($this) . "::fetch id=" . $id . " ref_ext=" . $ref_ext . " email=" . $email, LOG_DEBUG); - if (empty($id) && empty($ref_ext)) + if (empty($id) && empty($ref_ext) && empty($email)) { $this->error='BadParameter'; return -1; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 667965396a6..3f0d0313ee0 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -390,7 +390,7 @@ if ($sql_select) print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index febc613434d..fa26c5ed30b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -455,9 +455,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->societe->contact->creer) { - $newcardbutton=''.$langs->trans('NewContactAddress').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create'); } print ''; @@ -695,8 +693,8 @@ if (! empty($arrayfields['p.import_key']['checked'])) print ''; } // Action column -print ''; -$searchpicto=$form->showFilterButtons(); +print ''; +$searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -785,7 +783,7 @@ while ($i < min($num, $limit)) // Name if (! empty($arrayfields['p.lastname']['checked'])) { - print ''; + print ''; print $contactstatic->getNomUrl(1, '', 0); print ''; if (! $i) $totalarray['nbfield']++; @@ -793,7 +791,7 @@ while ($i < min($num, $limit)) // Firstname if (! empty($arrayfields['p.firstname']['checked'])) { - print ''.$obj->firstname.''; + print ''.$obj->firstname.''; if (! $i) $totalarray['nbfield']++; } // Job position diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 687dc2c7f2f..5c9ac3375dd 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2139,22 +2139,22 @@ else { if ($user->rights->contrat->activer) { - print ''; + print ''; } else { - print ''; + print ''; } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->rights->contrat->desactiver) { - print ''; + print ''; } else { - print ''; + print ''; } //if (! $numactive) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 316983a5d0a..d21b383bf97 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -878,14 +878,14 @@ class Contrat extends CommonObject if ($this->commercial_signature_id <= 0) { $langs->load("commercial"); - $this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeSignature")); + $this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeSignature")); $paramsok=0; } if ($this->commercial_suivi_id <= 0) { $langs->load("commercial"); $this->error.=($this->error?"
":''); - $this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeFollowUp")); + $this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp")); $paramsok=0; } if (! $paramsok) return -1; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 36c527ef283..28c4702a5c2 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -376,9 +376,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->contrat->creer) { - $newcardbutton=''.$langs->trans('NewContractSubscription').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contrat/card.php?action=create'); } print ''; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 886e836f10e..3451e14ae2a 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -145,7 +145,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Ligne info remises tiers diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 19b40fa451d..07b5cceee1a 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -524,7 +524,7 @@ if (! empty($arrayfields['status']['checked'])) print ''; } // Action column -print ''; diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 272ac1532a6..72c78cb8a4d 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -194,7 +194,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) // Security: // Disallow file with some extensions. We rename them. // Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code. - if (preg_match('/(\.htm|\.html|\.php|\.pl|\.cgi)$/i', $filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) + if (isAFileWithExecutableContent($filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) { $filenameto.= '.noexe'; } diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index af2093481c3..836652ea819 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -43,7 +43,7 @@ if (GETPOST('addfile', 'alpha')) $vardir=$conf->user->dir_output."/".$user->id; $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0); + dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid, 0); $action='presend'; } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ddb1bb0c6d0..bf9b617693f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -505,6 +505,31 @@ class CMailFile return true; } + $sendingmode = $this->sendmode; + if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') + { + // List of sending methods + $listofmethods=array(); + $listofmethods['mail']='PHP mail function'; + //$listofmethods['simplemail']='Simplemail class'; + $listofmethods['smtps']='SMTP/SMTPS socket library'; + + // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. + // You ensure that every user is using its own SMTP server when using the mass emailing module. + $linktoadminemailbefore=''; + $linktoadminemailend=''; + $this->error = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]); + $this->errors[] = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]); + $this->error .= '
'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']); + $this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']); + if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) + { + $this->error .= '
'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS); + $this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS); + } + return false; + } + // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10; $tmparray1 = explode(',', $this->addr_to); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a32c55a13e8..a064e611c2f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3860,9 +3860,10 @@ abstract class CommonObject * @param int $dateSelector 1=Show also date range input fields * @param Societe $seller Object thirdparty who sell * @param Societe $buyer Object thirdparty who buy + * @param string $defaulttpldir Directory where to find the template * @return void */ - public function formAddObjectLine($dateSelector, $seller, $buyer) + public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl') { global $conf,$user,$langs,$object,$hookmanager; global $form,$bcnd,$var; @@ -3874,10 +3875,17 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer - $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -3913,7 +3921,7 @@ abstract class CommonObject // Define usemargins $usemargins=0; - if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element, array('facture','propal','commande'))) $usemargins=1; + if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element, array('facture','facturerec','propal','commande'))) $usemargins=1; $num = count($this->lines); @@ -4130,9 +4138,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4153,9 +4168,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4355,9 +4377,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 861c273e28a..62c7f0f9e24 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -637,6 +637,10 @@ class Conf $this->expensereport->payment = new stdClass(); $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; } + if (isset($this->holiday)) { + $this->holiday->approve = new stdClass(); + $this->holiday->approve->warning_delay=(isset($this->global->MAIN_DELAY_HOLIDAYS)?$this->global->MAIN_DELAY_HOLIDAYS:0)*24*60*60; + } if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index caea57280b9..8e0cf0946dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1276,14 +1276,16 @@ class ExtraFields $labeltoshow = dol_trunc($labeltoshow, 45); if ($value == $obj->rowid) { - foreach ($fields_label as $field_toshow) { - $translabel = $langs->trans($obj->$field_toshow); - if ($translabel != $obj->$field_toshow) { - $labeltoshow = dol_trunc($translabel, 18) . ' '; - } else { - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; - } - } + if (!$notrans) { + foreach ($fields_label as $field_toshow) { + $translabel = $langs->trans($obj->$field_toshow); + if ($translabel != $obj->$field_toshow) { + $labeltoshow = dol_trunc($translabel, 18) . ' '; + } else { + $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; + } + } + } $out .= ''; } else { if (!$notrans) { @@ -1968,7 +1970,7 @@ class ExtraFields public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') { global $_POST, $langs; - $nofillrequired='';// For error when required field left blank + $nofillrequired=0;// For error when required field left blank $error_field_required = array(); if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; @@ -1999,7 +2001,8 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') + if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') + || (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c86874cdde9..63246fb0287 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -103,7 +103,7 @@ class Form * @return string HTML edit field */ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id') - { + { global $conf,$langs; $ret=''; @@ -144,7 +144,7 @@ class Form } return $ret; - } + } /** * Output value of a field for an editable field @@ -1046,7 +1046,7 @@ class Form * * @param string $selected Preselected type * @param string $htmlname Name of field in form - * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)') + * @param string $filter Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>] are allowed here (example: 's.rowid <> x', 's.client IN (1,3)') * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty') * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) @@ -1080,7 +1080,7 @@ class Form unset($societetmp); } // mode 1 - $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype?'&showtype='.$showtype:''); + $urloption='htmlname='.urlencode($htmlname).'&outjson=1&filter='.urlencode($filter).($showtype?'&showtype='.urlencode($showtype):''); $out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out.=''; if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; @@ -1138,7 +1138,7 @@ class Form // Clean $filter that may contains sql conditions so sql code if (function_exists('testSqlAndScriptInject')) { - if (testSqlAndScriptInject($filter, 3)>0) { + if (testSqlAndScriptInject($filter, 3) > 0) { $filter =''; } } @@ -1914,6 +1914,16 @@ class Form $selected_input_value=$producttmpselect->ref; unset($producttmpselect); } + // handle case where product or service module is disabled + no filter specified + if ($filtertype == '') + { + if (empty($conf->product->enabled)) { // when product module is disabled, show services only + $filtertype = 1; + } + elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only + $filtertype = 0; + } + } // mode=1 means customers products $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; //Price by customer @@ -2165,7 +2175,14 @@ class Form { $sql.= " AND p.tosell = ".$status; } - if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; + // Filter by product type + if (strval($filtertype) != '') $sql.= " AND p.fk_product_type = ".$filtertype; + elseif (empty($conf->product->enabled)) { // when product module is disabled, show services only + $sql.= " AND p.fk_product_type = 1"; + } + elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only + $sql.= " AND p.fk_product_type = 0"; + } // Add criteria on ref/label if ($filterkey != '') { @@ -3649,9 +3666,10 @@ class Form * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib To add more attribute on select * @param int $showcurrency Show currency in label + * @param string $morecss More CSS * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) */ - public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0) + public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '') { // phpcs:enable global $langs, $conf; @@ -3674,7 +3692,7 @@ class Form $i = 0; if ($num) { - print ''; if ($useempty == 1 || ($useempty == 2 && $num > 1)) { print ''; @@ -5704,7 +5722,6 @@ class Form { $objectdesc=$classname.':'.$classpath; $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; - //if ($objecttmp->element == 'societe') $urlforajaxcall = DOL_URL_ROOT.'/societe/ajax/company.php'; // No immediate load of all database $urloption='htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.($moreparams?$moreparams:''); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index c9c1bc3d782..31353ea3d10 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -205,9 +205,7 @@ class FormActions $newcardbutton=''; if (! empty($conf->agenda->enabled)) { - $newcardbutton = ''.$langs->trans("AddEvent").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage)); } print ''."\n"; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 576aff4db66..b729ad51fc5 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -688,7 +688,9 @@ class FormFile $out.= ''; $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; + if (method_exists($module, 'formBuilddocLineOptions')) + { + $colspanmore++; + $out .= ''; + } } } $out.= ''; // Execute hooks - $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart); + $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'modulepart'=>$modulepart); if (is_object($hookmanager)) { $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); @@ -801,9 +807,10 @@ class FormFile // Show file name with link to download $out.= ''; } - else $out = $hookmanager->resPrint; // Replace line + else + { + $out = $hookmanager->resPrint; // Replace all $out + } } } @@ -1830,7 +1840,7 @@ class FormFile print ''; print ''; print ' 0) print ' fieldrequired'; // No fieldrequired on the view output if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; @@ -65,11 +65,13 @@ foreach($object->fields as $key => $val) } print '
'; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + $colspan = (3+($addcolumforpicto?1:0)); $colspanmore = 0; + + $out.= ''; // Model if (! empty($modellist)) @@ -745,13 +747,17 @@ class FormFile { foreach($hookmanager->hooks['formfile'] as $module) { - if (method_exists($module, 'formBuilddocLineOptions')) $out .= '
'; $out.= 'trans("File").': '.$file["name"]); $out.= dol_trunc($file["name"], 150); $out.= ''."\n"; @@ -847,14 +854,17 @@ class FormFile if (is_object($hookmanager)) { - $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); + $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { $out.= $hookmanager->resPrint; // Complete line $out.= '
' . dol_print_date($link->datea, "dayhour", "tzuser") . ''; - print '' . img_edit() . ''; // id= is included into $param + print '' . img_edit() . ''; // id= is included into $param if ($permtodelete) { print '   ' . img_delete() . ''; // id= is included into $param } else { diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index f022d2c3791..f9b0a59280f 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -96,7 +96,7 @@ class FormMargin $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); } - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign $pa = $line->qty * $pa_ht; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 40c5ef8c048..fe00f803a6b 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -196,6 +196,7 @@ class Translate $modulename = ''; // Search if a module directory name is provided into lang file name + $regs=array(); if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) { $newdomain = $regs[1]; @@ -223,7 +224,7 @@ class Translate return -1; } - foreach($this->dir as $keydir => $searchdir) + foreach($this->dir as $searchdir) { // Directory of translation files $file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang"; diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 575cf2256ef..b05f118b08b 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -284,7 +284,7 @@ abstract class DoliDB implements Database if ($string==0 || $string=="0000-00-00 00:00:00") return ''; $string=preg_replace('/([^0-9])/i', '', $string); $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); + $date=dol_mktime((int) substr($tmp, 8, 2), (int) substr($tmp, 10, 2), (int) substr($tmp, 12, 2), (int) substr($tmp, 4, 2), (int) substr($tmp, 6, 2), (int) substr($tmp, 0, 4), $gm); return $date; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 6b546f5dfc3..a0dede0a895 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -141,12 +141,14 @@ class DoliDBMysqli extends DoliDB // If client is old latin, we force utf8 $clientmustbe=empty($conf->db->dolibarr_main_db_character_set)?'utf8':$conf->db->dolibarr_main_db_character_set; if (preg_match('/latin1/', $clientmustbe)) $clientmustbe='utf8'; + if (preg_match('/utf8mb4/', $clientmustbe)) $clientmustbe='utf8'; - if ($this->db->character_set_name() != $clientmustbe) { - $this->db->set_charset($clientmustbe); // This set utf8_general_ci + if ($this->db->character_set_name() != $clientmustbe) { + $this->db->set_charset($clientmustbe); // This set utf8_unicode_ci - $collation = $conf->db->dolibarr_main_db_collation; - if (preg_match('/latin1/', $collation)) $collation='utf8_unicode_ci'; + $collation = $conf->db->dolibarr_main_db_collation; + if (preg_match('/latin1/', $collation)) $collation='utf8_unicode_ci'; + if (preg_match('/utf8mb4/', $collation)) $collation='utf8_unicode_ci'; if (! preg_match('/general/', $collation)) $this->db->query("SET collation_connection = ".$collation); } diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index db86d5e8b58..cf8557de961 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -841,10 +841,11 @@ function copyToClipboard(text,text2) * @return boolean False * @see document_preview */ -function newpopup(url,title) { +function newpopup(url, title) { var argv = newpopup.arguments; var argc = newpopup.arguments.length; tmp=url; + console.log("newpopup "+argv[2]+" "+argv[3]); var l = (argc > 2) ? argv[2] : 600; var h = (argc > 3) ? argv[3] : 400; var left = (screen.width - l)/2; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 243e943143e..6635220cc23 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1044,9 +1044,9 @@ function unActivateModule($value, $requiredby = 1) $result=$objMod->remove(); if ($result <= 0) $ret=$objMod->error; } - else + else // We come here when we try to unactivate a module when module does not exists anymore in sources { - //print $dir.$modFile; + //print $dir.$modFile;exit; // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; $genericMod = new DolibarrModules($db); @@ -1054,11 +1054,11 @@ function unActivateModule($value, $requiredby = 1) $genericMod->rights_class=strtolower(preg_replace('/^mod/i', '', $modName)); $genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', $modName)); dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name " . $modName); - $genericMod->_remove(array()); + $genericMod->remove(''); } - // Desactivation des modules qui dependent de lui - if (! $ret && $requiredby) + // Disable modules that depends on module we disable + if (! $ret && $requiredby && is_object($objMod) && is_array($objMod->requiredby)) { $countrb=count($objMod->requiredby); for ($i = 0; $i < $countrb; $i++) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d6fe993aa2d..99344b12dc1 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -187,11 +187,13 @@ function societe_prepare_head(Societe $object) $foundonexternalonlinesystem=0; $langs->load("banks"); - $title = $langs->trans("BankAccounts"); + //$title = $langs->trans("BankAccounts"); + $title = $langs->trans("PaymentInformation"); + if (! empty($conf->stripe->enabled)) { - $langs->load("stripe"); - $title = $langs->trans("BankAccountsAndGateways"); + //$langs->load("stripe"); + //$title = $langs->trans("BankAccountsAndGateways"); $servicestatus = 0; if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) $servicestatus = 1; @@ -730,9 +732,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $newcardbutton=''; if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink)) { - $newcardbutton=''.$langs->trans("AddProject").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } print "\n"; @@ -934,9 +934,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if ($user->rights->societe->contact->creer) { $addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); - $newcardbutton=''.$addcontact.''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } print "\n"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 92bc9f11c00..f4a25334e00 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1056,7 +1056,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable // Security: // Disallow file with some extensions. We rename them. // Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code. - if (preg_match('/(\.htm|\.html|\.php|\.pl|\.cgi)$/i', $dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) + if (isAFileWithExecutableContent($dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) { $file_name.= '.noexe'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9b8232bb188..19b39fd776d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -649,7 +649,7 @@ function dol_include_once($relpath, $classname = '') * @param int $returnemptyifnotfound 0:If $type==0 and if file was not found into alternate dir, return default path into main dir (no test on it) * 1:If $type==0 and if file was not found into alternate dir, return empty string * 2:If $type==0 and if file was not found into alternate dir, test into main dir, return default path if found, empty string if not found - * @return string Full filesystem path (if path=0), Full url path (if mode=1) + * @return string Full filesystem path (if path=0) or '' if file not found, Full url path (if mode=1) */ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) { @@ -1982,7 +1982,7 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $ //var_dump($localtz); //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); $dt = new DateTime(null, $localtz); - $dt->setDate($year, $month, $day); + $dt->setDate((int) $year, (int) $month, (int) $day); $dt->setTime((int) $hour, (int) $minute, (int) $second); $date=$dt->getTimestamp(); // should include daylight saving time //var_dump($date); @@ -3441,16 +3441,17 @@ function img_info($titlealt = 'default') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute. + * @param string $morecss Add more CSS * @return string Return img tag */ -function img_warning($titlealt = 'default', $moreatt = '') +function img_warning($titlealt = 'default', $moreatt = '', $morecss = 'pictowarning') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); //return '
'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'
'; - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); + return img_picto($titlealt, 'warning.png', 'class="valignmiddle'.($morecss?' '.$morecss:'').'"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); } /** @@ -3626,7 +3627,7 @@ function img_mime($file, $titlealt = '', $morecss = '') if (empty($titlealt)) $titlealt = 'Mime type: '.$mimetype; //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); - return ''; + return ''; } @@ -7955,7 +7956,6 @@ function roundUpToNextMultiple($n, $x = 5) */ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array()) { - $attr=array( 'class'=>'badge'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'') ); @@ -8017,6 +8017,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st { global $conf; + $return = ''; + // image's filename are still in French $statusImg=array( 'status0' => 'statut0' @@ -8116,7 +8118,6 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $attr['aria-label'] = $label; } - if(empty($userRight)){ $attr['class'] = 'butActionRefused'; $attr['href'] = ''; @@ -8153,3 +8154,130 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = return '
<'.$tag.' '.$compiledAttributes.'>'.$html.'
'; } + +/** + * Function dolGetButtonTitle : this kind of buttons are used in title in list + * + * @param string $label label of button + * @param string $helpText optional : content for help tooltip + * @param string $iconClass class for icon element + * @param string $url the url for link + * @param string $id attribute id of button + * @param int $status 0 no user rights, 1 active, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip + * @param array $params various params for future : recommended rather than adding more function arguments + * @return string html button + */ +function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array()) +{ + global $langs, $conf, $user; + + // Actually this conf is used in css too for external module compatibility and smooth transition to this function + if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin) && $status <= 0) { + return ''; + } + + $class = 'btnTitle' ; + + // hidden conf keep during button transition TODO: remove this block + if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + $class = 'butActionNew'; + } + + $attr=array( + 'class' => $class + ,'href' => empty($url)?'':$url + ); + + if(!empty($helpText)){ + $attr['title'] = dol_escape_htmltag($helpText); + } + + if($status <= 0){ + $attr['class'] .= ' refused'; + + // hidden conf keep during button transition TODO: remove this block + if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + $attr['class'] = 'butActionNewRefused'; + } + + $attr['href'] = ''; + + if($status == -1){ // Not enough permissions + $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled")); + } + elseif($status == 0){ // disable + $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")); + } + } + + if(!empty($attr['title'])){ + $attr['class'] .= ' classfortooltip'; + } + + if(empty($id)){ + $attr['id'] = $id; + } + + // Override attr + if(!empty($params['attr']) && is_array($params['attr'])){ + foreach($params['attr'] as $key => $value){ + if($key == 'class'){ + $attr['class'].= ' '.$value; + } + elseif($key == 'classOverride'){ + $attr['class'] = $value; + } + else{ + $attr[$key] = $value; + } + } + } + + if(isset($attr['href']) && empty($attr['href'])){ + unset($attr['href']); + } + + // TODO : add a hook + + // escape all attribute + $attr = array_map('dol_escape_htmltag', $attr); + + $TCompiledAttr = array(); + foreach($attr as $key => $value){ + $TCompiledAttr[] = $key.'="'.$value.'"'; + } + + $compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):''; + + $tag = !empty($attr['href'])?'a':'span'; + + + $button ='<'.$tag.' '.$compiledAttributes.' >'; + $button.= ''; + $button.= ''.$label.''; + $button.= ''; + + // hidden conf keep during button transition TODO: remove this block + if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + $button='<'.$tag.' '.$compiledAttributes.' >'.$label.''; + $button.= ''; + $button.= ''; + } + + return $button; +} + +/** + * Return if a file can contains executable content + * + * @param string $filename File NamedRange + * @return boolean True if yes, False if no + */ +function isAFileWithExecutableContent($filename) +{ + if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename)) + { + return true; + } + return false; +} diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 76d3d54515d..a315747b8f6 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -568,7 +568,7 @@ function isValidUrl($url, $http = 0, $pass = 0, $port = 0, $path = 0, $query = 0 * Check if VAT numero is valid (check done on syntax only, no database or remote access) * * @param Societe $company VAT number - * @return int 1=Check is OK, 0=Check is KO + * @return int 1=Check is OK, 0=Check is KO */ function isValidVATID($company) { @@ -577,7 +577,7 @@ function isValidVATID($company) $vatprefix = $company->country_code; if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; else $vatprefix = preg_quote($vatprefix, '/'); - if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', $company->tva_intra)) + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,14}$/i', str_replace(' ', '', $company->tva_intra))) { return 0; } @@ -1282,6 +1282,10 @@ function check_value($mask, $value) if (! empty($reg[3]) && preg_match('/^@/', $reg[3])) $maskraz=preg_replace('/^@/', '', $reg[3]); if ($maskraz >= 0) { + if ($maskraz == 99) { + $maskraz = date('m'); + $resetEveryMonth = true; + } if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define reg diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index c161eb056fe..714bc26b7da 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -172,14 +172,18 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = * For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain' * * @param string $url Full URL. + * @param int $mode 0=return 'mydomain', 1=return 'mydomain.com' * @return string Returns domaine name */ -function getDomainFromURL($url) +function getDomainFromURL($url, $mode = 0) { $tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s):// $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain - $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) - $tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name + $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part www.abc before domain name + if (empty($mode)) + { + $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) + } return $tmpdomain; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index cc40fcb9272..14c0435b4ad 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1374,6 +1374,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (! empty($object->lines[$i]->date_start) || ! empty($object->lines[$i]->date_end)) { $format='day'; + $period = ''; // Show duration if exists if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) { diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 4ce610aaf90..7da112fa255 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -145,8 +145,8 @@ function user_prepare_head($object) if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)) - || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id) - || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id ) + || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) + || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all)) ) { // Bank diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9f81d343c8b..3710cc2cf91 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -540,10 +540,10 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, global $langs; if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; - print ''; + print ''; print ''; print $text; print ''; @@ -1659,9 +1659,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM { $langs->load("hrm"); - $newmenu->add("/user/list.php?leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm'); - $newmenu->add("/user/card.php?action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->hrm->employee->write); - $newmenu->add("/user/list.php?leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->hrm->employee->read); + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm'); + $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->hrm->employee->write); + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->hrm->employee->read); } // Leave/Holiday/Vacation module @@ -1670,19 +1670,19 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Load translation files required by the page $langs->loadLangs(array("holiday","trips")); - $newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); - $newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1, $user->rights->holiday->write); - $newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("New"), 1, $user->rights->holiday->write); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") { - $newmenu->add("/holiday/list.php?search_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_statut=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_statut=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_statut=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); } - $newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); - $newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); } // Trips and expenses (old module) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 1fc25035933..c7158413e24 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -667,7 +667,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it array( 'doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1), 'img/' => dol_buildpath(strtolower($this->name).'/img/', 1), - 'images/' => dol_buildpath(strtolower($this->name).'/imgages/', 1), + 'images/' => dol_buildpath(strtolower($this->name).'/images/', 1), ) ); } @@ -746,7 +746,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $filefound= false; // Define path to file README.md. - // First check README-la_LA.md then README.md + // First check ChangeLog-la_LA.md then ChangeLog.md $pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog-'.$langs->defaultlang.'.md', 0); if (dol_is_file($pathoffile)) { $filefound = true; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 03dae9cbe5e..97fedf45808 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -353,11 +353,17 @@ class pdf_strato extends ModelePDFContract $desc=dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines) $txt=''; $txt.=$outputlangs->transnoentities("Quantity").' : '.$objectligne->qty.' - '.$outputlangs->transnoentities("UnitPrice").' : '.price($objectligne->subprice).''; // Desc (not empty for free lines) - $txt.='
'; - $txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; - $txt.='
'; - $txt.=$outputlangs->transnoentities("DateStartRealShort")." : ".$daters.''; - if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.''; + if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF)) + { + $txt.='
'; + $txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; + } + if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF)) + { + $txt.='
'; + $txt.=$outputlangs->transnoentities("DateStartRealShort")." : ".$daters.''; + if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.''; + } $pdf->startTransaction(); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0); diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 3eafc454530..ffb1fd83cce 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -76,7 +76,7 @@ class ExportExcel extends ModeleExports $this->db = $db; $this->id='excel'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 95'; // Label of driver + $this->label='Excel 95 (old library)'; // Label of driver $this->desc = $langs->trans('Excel95FormatDesc'); $this->extension='xls'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index e33849427b1..7460d71ff13 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -76,7 +76,7 @@ class ExportExcel2007 extends ExportExcel $this->db = $db; $this->id='excel2007'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007'; // Label of driver + $this->label='Excel 2007 (old library)'; // Label of driver $this->desc = $langs->trans('Excel2007FormatDesc'); $this->extension='xlsx'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 32b6029a294..266cedc1310 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -78,7 +78,7 @@ class ExportExcel2007new extends ModeleExports $this->db = $db; $this->id='excel2007new'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007 by PHPSpreadSheet'; // Label of driver + $this->label='Excel 2007'; // Label of driver $this->desc = $langs->trans('Excel2007FormatDesc'); $this->extension='xlsx'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index a641e209f9e..de1ebc00a8b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1238,23 +1238,6 @@ class pdf_crabe extends ModelePDFFactures //} // VAT - // Situations totals migth be wrong on huge amounts - if ($object->situation_cycle_ref && $object->situation_counter > 1) { - - $sum_pdf_tva = 0; - foreach($this->tva as $tvakey => $tvaval){ - $sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object - } - - if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one) - $coef_fix_tva = $object->total_tva / $sum_pdf_tva; - - foreach($this->tva as $tvakey => $tvaval) { - $this->tva[$tvakey]=$tvaval * $coef_fix_tva; - } - } - } - foreach($this->tva as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 6eba74b17e4..f75e5035670 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -137,7 +137,7 @@ class ImportCsv extends ModeleImports * * @param Translate $outputlangs Output language * @param array $headerlinefields Array of fields name - * @return string + * @return string$limittoachartaccount */ public function write_title_example($outputlangs, $headerlinefields) { @@ -443,11 +443,29 @@ class ImportCsv extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method), array('', $newval)); + $param_array = array('', $newval); + if ($class == 'AccountingAccount') + { + //var_dump($arrayrecord[0]['val']); + /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; + $tmpchartofaccount = new AccountancySystem($this->db); + $tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS); + var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']); + if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val']) + { + $this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref); + $this->errors[$error]['type']='RESTRICTONCURRENCTCHART'; + $errorforthistable++; + $error++; + }*/ + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } + 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') { - call_user_func_array(array($classinstance, $method), array('', '', $newval)); + $param_array = array('', '', $newval); + call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; @@ -459,7 +477,7 @@ class ImportCsv extends ModeleImports { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index e83e22bd8ca..ae0290401cc 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -470,11 +470,29 @@ class ImportXlsx extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method), array('', $newval)); + $param_array = array('', $newval); + if ($class == 'AccountingAccount') + { + //var_dump($arrayrecord[0]['val']); + /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; + $tmpchartofaccount = new AccountancySystem($this->db); + $tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS); + var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']); + if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val']) + { + $this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref); + $this->errors[$error]['type']='RESTRICTONCURRENCTCHART'; + $errorforthistable++; + $error++; + }*/ + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } + 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') { - call_user_func_array(array($classinstance, $method), array('', '', $newval)); + $param_array = array('', '', $newval); + call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; @@ -486,7 +504,7 @@ class ImportXlsx extends ModeleImports { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 66b2a511bf7..b7ef8950fe1 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -301,11 +301,12 @@ class modAccounting extends DolibarrModules $this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account'); $this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation"); - $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); + $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); $this->import_convertvalue_array[$r]=array( - 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), - 'aa.account_parent'=>array('rule'=>'zeroifnull'), + 'aa.account_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch','element'=>'AccountingAccount'), + 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), ); - $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); + $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); + $this->import_updatekeys_array[$r]=array('aa.fk_pcg_version'=>'Chartofaccounts','aa.account_number'=>'AccountAccounting'); } } diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index be88c709090..a08ce2f7873 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -70,7 +70,7 @@ class modDataPolicy extends DolibarrModules { $this->descriptionlong = ""; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'development'; + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where datapolicy 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. diff --git a/htdocs/core/modules/modIFTTT.class.php b/htdocs/core/modules/modIFTTT.class.php deleted file mode 100644 index c3bab06ed93..00000000000 --- a/htdocs/core/modules/modIFTTT.class.php +++ /dev/null @@ -1,251 +0,0 @@ - - * - * 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 ifttt Module IFTTT - * \brief Descriptor file for IFTTT module - * \file htdocs/core/modules/modIFTTT.class.php - * \ingroup ifttt - * \brief Description and activation file for module IFTTT - */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; - - -/** - * Description and activation class for module IFTTT - */ -class modIFTTT 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 = 2620; - // Key text used to identify module (for permissions, menus, etc...) - $this->rights_class = 'ifttt'; - - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' - // It is used to group modules in module setup page - $this->family = "interface"; - // 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) - $this->description = "IFTTT interface"; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version - $this->version = 'development'; - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Can be enabled / disabled only in the main company with superadmin account - $this->core_enabled = 1; - // 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='technic'; - - $this->module_parts = array(); - - // Data directories to create when module is enabled. - // Example: this->dirs = array("/api/temp"); - $this->dirs = array(); - - // Config pages. Put here list of php page, stored into api/admin directory, to use to setup module. - $this->config_page_url = array("index.php@ifttt"); - - // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array(); // List of modules id that must be enabled if this module is enabled - $this->requiredby = array(); // List of modules id to disable if this one is disabled - $this->conflictwith = array(); // List of modules id this module is in conflict with - $this->phpmin = array(5,4); // Minimum version of PHP required by module - $this->langfiles = array("other"); - - // Constants - // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) - // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), - // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) - // ); - $this->const = array(); - - // Array to add new pages in new tabs - // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@api:$user->rights->ifttt->read:/api/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 - // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@api:$user->rights->othermodule->read:/api/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. - // '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 - $this->tabs = array(); - - // Dictionaries - if (! isset($conf->ifttt->enabled)) - { - $conf->ifttt=new stdClass(); - $conf->ifttt->enabled=0; - } - $this->dictionaries=array(); - - // Boxes - // Add here list of php file(s) stored in core/boxes that contains class to show a box. - $this->boxes = array(); // List of boxes - // Example: - //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); - - // Permissions - $this->rights = array(); // Permission array used by this module - $r=0; - - // Add here list of permission defined by an id, a label, a boolean and two constant strings. - // Example: - // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $r++; - - - // Main menu entries - $this->menu = array(); // List of menus to add - $r=0; - - // Add here entries to declare new menus - // - // Example to declare a new Top Menu entry and its Left menu entry: - // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu - // 'type'=>'top', // This is a Top menu entry - // 'titre'=>'Api top menu', - // 'mainmenu'=>'api', - // 'leftmenu'=>'api', - // 'url'=>'/api/pagetop.php', - // 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'position'=>100, - // 'enabled'=>'$conf->ifttt->enabled', // Define condition to show or hide menu entry. Use '$conf->ifttt->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->ifttt->level1->level2' if you want your menu with a permission rules - // 'target'=>'', - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - // $r++; - // - // Example to declare a Left Menu entry into an existing Top menu entry: - // $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // 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'=>'Api left menu', - // 'mainmenu'=>'xxx', - // 'leftmenu'=>'api', - // 'url'=>'/api/pagelevel2.php', - // 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'position'=>100, - // 'enabled'=>'$conf->ifttt->enabled', // Define condition to show or hide menu entry. Use '$conf->ifttt->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->ifttt->level1->level2' if you want your menu with a permission rules - // 'target'=>'', - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - // $r++; - - - // Exports - $r=1; - - // Example: - // $this->export_code[$r]=$this->rights_class.'_'.$r; - // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. - // $this->export_permission[$r]=array(array("facture","facture","export")); - // $this->export_fields_array[$r]=array( - // 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone', - // 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation", - // 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus', - // 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate", - // 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart", - // 'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef' - //); - // $this->export_entities_array[$r]=array( - // 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company', - // 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - // 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice", - // 'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line", - // 'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line", - // 'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product' - //); - // $this->export_sql_start[$r]='SELECT DISTINCT '; - // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; - // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; - // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; - // $this->export_sql_order[$r] .=' ORDER BY s.nom'; - // $r++; - } - - /** - * 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 = '') - { - $sql = array(); - - $result=$this->_load_tables('/ifttt/sql/'); - - 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 = '') - { - // Remove old constants with entity fields different of 0 - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('MAIN_MODULE_IFTTT', 1), - "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('IFTTT_PRODUCTION_MODE', 1) - ); - - return $this->_remove($sql, $options); - } -} diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 10a2ce752d8..dfbe97c3fd5 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -301,7 +301,7 @@ class pdf_beluga extends ModelePDFProjects 'table'=>'commande', 'datefieldname'=>'date_commande', 'test'=>$conf->commande->enabled && $user->rights->commande->lire, - 'lang'=>'order'), + 'lang'=>'orders'), 'invoice'=>array( 'name'=>"CustomersInvoices", 'title'=>"ListInvoicesAssociatedProject", 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 cf71d691715..612595b8c44 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php @@ -1810,7 +1810,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders global $hookmanager; $parameters=array( - 'object' => $object, 'curY' =>& $curY, 'columnText' => $columnText, 'colKey' => $colKey diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php deleted file mode 100644 index f3d34c4a9cd..00000000000 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ /dev/null @@ -1,174 +0,0 @@ -isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php'); - } - - /** - * Is the module active ? - * - * @return int -1 if not active, 0 if active but lib/path not found, 1 if OK - */ - public function isActive() - { - global $conf; - try - { - if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { - $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'; - } - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - - $res = @include_once 'ChromePhp.php'; - if (! $res) $res=@include_once 'ChromePhp.class.php'; - - restore_include_path(); - - if ($res) - { - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler - } - else - { - return 0; - } - } - catch(Exception $e) - { - print ''."\n"; - } - - return -1; - } - - /** - * Return array of configuration data - * - * @return array Return array of configuration data - */ - public function configure() - { - global $langs; - - return array( - array( - 'name' => $langs->trans('IncludePath', 'SYSLOG_CHROMEPHP_INCLUDEPATH'), - 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', - 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', - 'attr' => 'size="60"', - 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' - ) - ); - } - - /** - * Return if configuration is valid - * - * @return array Array of errors. Empty array if ok. - */ - public function checkConfiguration() - { - global $langs,$conf; - - $errors = array(); - - if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) - { - $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop - if (is_object($langs)) // $langs may not be defined yet. - { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); - } - else - { - $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; - } - } - - return $errors; - } - - /** - * Output log content. We also start output buffering at first log write. - * - * @param array $content Content to log - * @return null|false - */ - public function export($content) - { - global $conf; - - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler - - //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration()) > 0) return false; - - try - { - // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from - // database or config file because we must be able to log data before database or config file read. - $oldinclude=get_include_path(); - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - $res = @include_once 'ChromePhp.php'; - if (! $res) $res=@include_once 'ChromePhp.class.php'; - set_include_path($oldinclude); - - ob_start(); // To be sure headers are not flushed until all page is completely processed - if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); - elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); - elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); - else ChromePhp::log($content['message']); - } - catch (Exception $e) - { - // Do not use dol_syslog here to avoid infinite loop - } - } -} diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php deleted file mode 100644 index abc341f9a30..00000000000 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ /dev/null @@ -1,175 +0,0 @@ - - * Copyright (C) 2015 Raphaël Doursenaud - * - * 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 . - */ - -require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; - -/** - * Class to manage logging to a FirePHP - */ -class mod_syslog_firephp extends LogHandler implements LogHandlerInterface -{ - public $code = 'firephp'; - private static $firephp_include_path = '/includes/firephp/firephp-core/lib/'; - private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php'; - - /** - * Return name of logger - * - * @return string Name of logger - */ - public function getName() - { - return 'FirePHP'; - } - - /** - * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') - * - * @return string - */ - public function getVersion() - { - return 'dolibarr'; - } - - /** - * Content of the info tooltip. - * - * @return false|string - */ - public function getInfo() - { - global $langs; - - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); - } - - /** - * Is the module active ? - * - * @return int - */ - public function isActive() - { - global $conf; - try - { - if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) { - $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path; - } - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); - $res = @include_once self::$firephp_class_path; - restore_include_path(); - if ($res) { - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler - } else { - return 0; - } - } - catch(Exception $e) - { - print ''."\n"; - } - - return -1; - } - - /** - * Return array of configuration data - * - * @return array Return array of configuration data - */ - public function configure() - { - global $langs; - - return array( - array( - 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'), - 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', - 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path, - 'attr' => 'size="60"', - 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path - ) - ); - } - - /** - * Return if configuration is valid - * - * @return array Array of errors. Empty array if ok. - */ - public function checkConfiguration() - { - global $conf, $langs; - - $errors = array(); - - if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) - { - $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop - if (is_object($langs)) // $langs may not be defined yet. - { - $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); - } - else - { - $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; - } - } - - return $errors; - } - - /** - * Output log content - * - * @param array $content Content to log - * @return null|false - */ - public function export($content) - { - global $conf; - - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler - - //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration())) return false; - - try - { - // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from - // database or config file because we must be able to log data before database or config file read. - $oldinclude=get_include_path(); - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); - include_once self::$firephp_class_path; - set_include_path($oldinclude); - ob_start(); // To be sure headers are not flushed until all page is completely processed - $firephp = FirePHP::getInstance(true); - if ($content['level'] == LOG_ERR) $firephp->error($content['message']); - elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); - elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']); - else $firephp->log($content['message']); - } - catch (Exception $e) - { - // Do not use dol_syslog here to avoid infinite loop - return false; - } - } -} diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 6c473b83691..2ecb127f3b2 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -488,7 +488,7 @@ jQuery(document).ready(function() { console.log("We click on submitcrop"); var idClicked = e.target.id; if (parseInt(jQuery(\'#w\').val())) return true; - alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->trans("Dimension"))).'\'); + alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Dimension"))).'\'); return false; }); }); diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 129c1a70575..49b234c651c 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -48,7 +48,7 @@ foreach($object->fields as $key => $val) $value=$object->$key; print '
'; + +// We close div and reopen for second column print '
'; print '
'; -print '
'; + print '
'; -print ''; +print '
'; $alreadyoutput = 1; foreach($object->fields as $key => $val) @@ -87,11 +89,11 @@ foreach($object->fields as $key => $val) $value=$object->$key; print ' 0) print ' fieldrequired'; // No fieldrequired inthe view output if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; print ' - - global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> - - global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> - - + if (!empty($user->rights->margins->creer)) { ?> + + + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> + + global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> + + special_code == 3) { ?> @@ -300,51 +298,51 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?> - + + + - - + if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> + + + + 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> - - - - - - - + + - - + + if($action == 'selectlines'){ ?> + diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 34246bcf0b6..4e5967b30b4 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -14,7 +14,7 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; $form = new Form($db); $formresources = new FormResource($db); -$out = '
'; +$out = '
'; $out .= '
'; $out .= ''; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 76a565cf7d6..d2e0441b60b 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -13,7 +13,7 @@ $form= new Form($db); print '
'; -print ''; +print ''; print '
'; print '
'.$langs->trans('Resource').'
'; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 4345385f16d..7934a628880 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -159,11 +159,11 @@ class Cronjob extends CommonObject // Check parameters // Put here code to add a control on parameters values if (dol_strlen($this->datestart)==0) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronDtStart')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart')); $error++; } if (empty($this->label)) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronLabel')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronLabel')); $error++; } if ((dol_strlen($this->datestart)!=0) && (dol_strlen($this->dateend)!=0) && ($this->dateend<$this->datestart)) { @@ -171,28 +171,27 @@ class Cronjob extends CommonObject $error++; } if (empty($this->unitfrequency)) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronFrequency')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronFrequency')); $error++; } if (($this->jobtype=='command') && (empty($this->command))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronCommand')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronCommand')); $error++; } if (($this->jobtype=='method') && (empty($this->classesname))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronClass')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronClass')); $error++; } if (($this->jobtype=='method' || $this->jobtype == 'function') && (empty($this->methodename))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronMethod')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronMethod')); $error++; } if (($this->jobtype=='method') && (empty($this->objectname))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronObject')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronObject')); $error++; } - if (($this->jobtype=='function') && (empty($this->libname))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronLib')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronLib')); $error++; } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index de321443a6c..7273640e77e 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -55,7 +55,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.status,t.priority'; if (! $sortorder) $sortorder='DESC,ASC'; -$search_status=GETPOST('search_status', 'int')?GETPOST('search_status', 'int'):GETPOST('status', 'int'); +$search_status=(GETPOSTISSET('search_status')?GETPOST('search_status', 'int'):GETPOST('status', 'int')); //Search criteria $search_label=GETPOST("search_label", 'alpha'); @@ -251,7 +251,7 @@ $sql.= " t.libname,"; $sql.= " t.test"; $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; -if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); +if ($search_status >= 0 && $search_status < 2 && $search_status != '') $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); //Manage filter if (is_array($filter) && count($filter)>0) { foreach($filter as $key => $value) { @@ -337,23 +337,10 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -// Line with explanation and button new job -$newcardbutton=''; -if ($user->rights->cron->create) -{ - $newcardbutton.=''.$langs->trans("CronCreateJob").''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} -else -{ - $newcardbutton.=''.$langs->trans("CronCreateJob").''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} +// Line with explanation and button new +$newcardbutton = dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->cron->create); + print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_setup', 0, $newcardbutton, '', $limit); diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index ba41de80a72..ab737f679ca 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -122,7 +122,7 @@ llxHeader('', $langs->trans($page_name)); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans($page_name), $linkback, 'object_datapolicy@datapolicy'); +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_generic'); // Configuration header $head = datapolicyAdminPrepareHead(); diff --git a/htdocs/datapolicy/img/datapolicy.png b/htdocs/datapolicy/img/datapolicy.png deleted file mode 100644 index 2681ccc1d3a..00000000000 Binary files a/htdocs/datapolicy/img/datapolicy.png and /dev/null differ diff --git a/htdocs/datapolicy/img/gfdl.png b/htdocs/datapolicy/img/gfdl.png deleted file mode 100644 index f2bacfd179a..00000000000 Binary files a/htdocs/datapolicy/img/gfdl.png and /dev/null differ diff --git a/htdocs/datapolicy/img/gplv3.png b/htdocs/datapolicy/img/gplv3.png deleted file mode 100644 index ba78d4c4941..00000000000 Binary files a/htdocs/datapolicy/img/gplv3.png and /dev/null differ diff --git a/htdocs/datapolicy/img/object_datapolicy.png b/htdocs/datapolicy/img/object_datapolicy.png deleted file mode 100644 index 5d65c309cca..00000000000 Binary files a/htdocs/datapolicy/img/object_datapolicy.png and /dev/null differ diff --git a/htdocs/datapolicy/img/object_inoveaconseil.png b/htdocs/datapolicy/img/object_inoveaconseil.png deleted file mode 100644 index 292a9c75ef2..00000000000 Binary files a/htdocs/datapolicy/img/object_inoveaconseil.png and /dev/null differ diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php index d36583d9852..8882b5f4f1e 100644 --- a/htdocs/debugbar/class/DebugBar.php +++ b/htdocs/debugbar/class/DebugBar.php @@ -33,7 +33,7 @@ class DolibarrDebugBar extends DebugBar //$this->addCollector(new PhpInfoCollector()); //$this->addCollector(new DolMessagesCollector()); $this->addCollector(new DolRequestDataCollector()); - $this->addCollector(new DolConfigCollector()); + //$this->addCollector(new DolConfigCollector()); // Disabled for security purpose $this->addCollector(new DolTimeDataCollector()); $this->addCollector(new DolMemoryCollector()); //$this->addCollector(new DolExceptionsCollector()); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 5662b3272f0..cd92d8d02f5 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -84,14 +84,14 @@ if ($action == 'update') if (empty($donation_date)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = "create"; $error++; } if (empty($amount)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; } @@ -140,14 +140,14 @@ if ($action == 'add') if (empty($donation_date)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = "create"; $error++; } if (empty($amount)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index de360d8cc3b..d75e658a191 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -271,32 +271,32 @@ class Don extends CommonObject { if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Company').'/'.$langs->transnoentitiesnoconv('Firstname').'-'.$langs->transnoentitiesnoconv('Lastname')); $err++; } } if (dol_strlen(trim($this->address)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Address')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Address')); $err++; } if (dol_strlen(trim($this->zip)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Zip')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Zip')); $err++; } if (dol_strlen(trim($this->town)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Town')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Town')); $err++; } if (dol_strlen(trim($this->email)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('EMail')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMail')); $err++; } @@ -308,7 +308,7 @@ class Don extends CommonObject { if (!isset($map[substr($this->amount, $i, 1)])) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount')); $err++; $amount_invalid = 1; break; @@ -319,14 +319,14 @@ class Don extends CommonObject { if ($this->amount == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount')); $err++; } else { if ($this->amount < $minimum && $minimum > 0) { - $error_string[] = $langs->trans('MinimumAmount', $langs->trans('$minimum')); + $error_string[] = $langs->trans('MinimumAmount', $langs->transnoentitiesnoconv('$minimum')); $err++; } } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index e68b4e46399..1af11afca24 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -142,9 +142,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->don->creer) { - $newcardbutton=''.$langs->trans('NewDonation').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create'); } print ''."\n"; @@ -195,7 +193,7 @@ if ($resql) } print '
'; print ''; - print ''; diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index cc25ea8ae7b..34c505cf849 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -64,7 +64,7 @@ print load_fiche_titre($langs->trans("StatisticsOfSendings"), $mesg); dol_mkdir($dir); -$stats = new DonationStats($db, $socid, $mode, ($userid>0?$userid:0)); +$stats = new DonationStats($db, $socid, '', ($userid>0?$userid:0)); // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); @@ -75,14 +75,10 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; } else { $filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$year.'.png'; } $px1 = new DolGraph(); @@ -121,14 +117,10 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; } else { $filenameamount = $dir.'/shipmentsamountinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsamountinyear-'.$year.'.png'; } $px2 = new DolGraph(); @@ -164,14 +156,10 @@ $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsaverage-'.$user->id.'-'.$year.'.png'; } else { $filename_avg = $dir.'/shipmentsaverage-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsaverage-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsaverage-'.$year.'.png'; } $px3 = new DolGraph(); @@ -214,7 +202,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/don/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT . '/don/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; @@ -233,14 +221,13 @@ print '
'; //{ // Show filter box print ''; - print ''; + print ''; + print '
'; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 316e85a3ac6..3830e2bc31a 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -129,7 +129,7 @@ if ($permission) { selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
- select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 0, 'minwidth100imp'); ?> + select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp'); ?>
attributes[$object->table_element] print ''; print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); - print ''; print ''; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index fa972d38c71..7cf5f6ba5df 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -77,7 +77,7 @@ print ''."\n"; print '
'."\n"; if ($module != 'product') { // No public note yet on products - print '
'."\n"; + print '
'."\n"; print '
'."\n"; print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); print '
'."\n"; @@ -87,7 +87,7 @@ if ($module != 'product') { print '
'."\n"; } if (empty($user->societe_id)) { - print '
'."\n"; + print '
'."\n"; print '
'."\n"; print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); print '
'."\n"; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4a4febe65d3..bf46ecb9890 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -40,7 +40,7 @@ if (empty($object) || ! is_object($object)) { $usemargins=0; -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande'))) +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) { $usemargins=1; } @@ -55,7 +55,7 @@ if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; -// Define colspan for button Add +// Define colspan for the button 'Add' $colspan = 3; // Columns: total ht + col edit + col delete if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index f4e5634fbc9..ddb737bbdd6 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -40,7 +40,7 @@ if (empty($object) || ! is_object($object)) $usemargins=0; -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande'))) $usemargins=1; +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) $usemargins=1; global $forceall, $senderissupplier, $inputalsopricewithtax; if (empty($dateSelector)) $dateSelector=0; @@ -49,11 +49,10 @@ if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; -// Define colspan for button Add +// Define colspan for the button 'Add' $colspan = 3; // Col total ht + col edit + col delete if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc -if (in_array($object->element, array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button -if (empty($user->rights->margins->creer)) $colspan++; +if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; ?> @@ -252,7 +251,7 @@ $coldisplay=0; } ?> - +
">
"> diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 09bedf2ec53..53c55a8163b 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -48,7 +48,7 @@ if (empty($object) || ! is_object($object)) global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; $usemargins=0; -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande'))) $usemargins=1; +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) $usemargins=1; if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; @@ -253,19 +253,17 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) { - ?> - - rights->margins->creer)) { ?> -
pa_ht); ?>pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>marque_tx, null, null, null, null, $rounding).'%'; ?>pa_ht); ?>pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>marque_tx, null, null, null, null, $rounding).'%'; ?> trans('Option'); ?> - info_bits & 2) == 2 || ! empty($disableedit)) { ?> - - id.'#line_'.$line->id; ?>"> - - - - + info_bits & 2) == 2 || ! empty($disableedit)) { ?> + + id.'#line_'.$line->id; ?>"> + + + + + 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 ''; + } + ?> + 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 ''; - } - ?> - + 0) { ?> + id; ?>"> + + + + + id; ?>"> + + + + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>> - 0) { ?> - id; ?>"> - - - - - id; ?>"> - - - - browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>>
'; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; print ''; // Company print ''; // User print ''; - print ''; + print ''; print ''; /*print ''; @@ -285,7 +272,7 @@ foreach ($data as $val) } print ''; - print ''; + print ''; print ''; /*print ''; print '';*/ diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e52b1bf156e..f60051df970 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1287,13 +1287,14 @@ class EmailCollector extends CommonObject if (empty($contactid)) // Try to find contact using email { $result = $contactstatic->fetch(0, null, '', $from); + if ($result > 0) { $contactid = $contactstatic->id; $contactfoundby = 'email of contact ('.$from.')'; - if ($contactstatic->fk_soc > 0) + if ($contactstatic->socid > 0) { - $result = $thirdpartystatic->fetch($contactstatic->fk_soc); + $result = $thirdpartystatic->fetch($contactstatic->socid); if ($result > 0) { $thirdpartyid = $thirdpartystatic->id; @@ -1309,7 +1310,6 @@ class EmailCollector extends CommonObject if ($result > 0) $thirdpartyfoundby = 'email ('.$from.')'; } - // Do operations foreach($this->actions as $operation) { @@ -1492,7 +1492,6 @@ class EmailCollector extends CommonObject // Insert record of emails sent $actioncomm = new ActionComm($this->db); - $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->code = 'AC_'.$actioncode; $actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from; @@ -1503,6 +1502,7 @@ class EmailCollector extends CommonObject $actioncomm->percentage = -1; // Not applicable $actioncomm->socid = $thirdpartystatic->id; $actioncomm->contactid = $contactstatic->id; + $actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array()); $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action // Fields when action is an email (content should be added into note) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index b60852f205b..f5c111f2268 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -280,10 +280,8 @@ if ($resql) $newcardbutton=''; if ($user->rights->expedition->creer) { - $newcardbutton=''.$langs->trans('NewSending').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2'); + } $i = 0; print ''."\n"; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 812d1b9eccf..84681f049c4 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -324,7 +324,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; - if ($mode == 'customer') $filter='s.client in (1,2,3)'; - if ($mode == 'supplier') $filter='s.fournisseur = 1'; - print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); + print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
'.$langs->trans("CreatedBy").''; @@ -276,7 +263,7 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print '
'.$oldyear.''.$oldyear.'00
'.$year.''.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; + print '
'; // Discounts for third party if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -549,7 +549,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print '
'; + print '
'; if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index c678c6d934d..7fb7f647258 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -63,7 +63,7 @@ print load_fiche_titre($langs->trans("StatisticsOfSendings"), $mesg); dol_mkdir($dir); -$stats = new ExpeditionStats($db, $socid, $mode, ($userid>0?$userid:0)); +$stats = new ExpeditionStats($db, $socid, '', ($userid>0?$userid:0)); // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); @@ -74,14 +74,10 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; } else { $filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$year.'.png'; } $px1 = new DolGraph(); @@ -120,14 +116,10 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; } else { $filenameamount = $dir.'/shipmentsamountinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsamountinyear-'.$year.'.png'; } $px2 = new DolGraph(); @@ -163,14 +155,10 @@ $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsaverage-'.$user->id.'-'.$year.'.png'; } else { $filename_avg = $dir.'/shipmentsaverage-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsaverage-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsaverage-'.$year.'.png'; } $px3 = new DolGraph(); @@ -213,7 +201,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/expedition/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT . '/expedition/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; @@ -232,15 +220,13 @@ print '
'; //{ // Show filter box print ''; - print ''; + print ''; print '
'; print ''; // Company print ''; // User print ''; - print ''; + print ''; print ''; /*print ''; @@ -289,7 +275,7 @@ foreach ($data as $val) print ''; print ''; print ''; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e6354c01105..0d008cea93d 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2076,17 +2076,13 @@ else if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { print ''; - + // Num print ''; - - /*print '';*/ - + // Date print ''; + // Project if (! empty($conf->projet->enabled)) { print ''; } + // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; } + // Type of fee print ''; + // Comment print ''; + // VAT rate print ''; // Unit price HT print ''; */ // User diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 9663806fdc2..b6dfc23cf48 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -1009,7 +1009,7 @@ if ($step == 4 && $datatoexport) print ''; diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 83208ffa020..755c9bc4773 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -50,14 +50,7 @@ print '
'; print '
'; if (count($export->array_export_code)) { - if ($user->rights->export->creer) - { - print ''.$langs->trans("NewExport").''; - } - else - { - print ''.$langs->trans("NewExport").''; - } + print dolGetButtonTitle($langs->trans('NewExport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/exports/export.php?leftmenu=export', '', $user->rights->export->creer); } print '
'; print '
'; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 20d9d786354..31db9d0c2b4 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -427,7 +427,7 @@ if (empty($reshook)) } else { - $mesg='
'.$langs->trans("ErrorFieldRequired", $langs->trans("ThirdParty")).'
'; + $mesg='
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")).'
'; $action = 'create'; } } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index b893f6e6511..f8697fb52fc 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -314,12 +314,7 @@ if ($resql) $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; - if ($user->rights->ficheinter->creer) - { - $newcardbutton=''.$langs->trans('NewIntervention').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $morehtmlcenter.= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fichinter/card.php?action=create', '', $user->rights->ficheinter->creer); // Lines of title fields print ''."\n"; @@ -438,7 +433,7 @@ if ($resql) { print ''; } - print ''; diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 824dfff8c84..9b0ceb754ee 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -234,7 +234,7 @@ print '
'; print '
'; // Company print ''; // User diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e876d5caee2..bf0a3da62b3 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1540,7 +1540,7 @@ class CommandeFournisseur extends CommonOrder // Check parameters if ($qty < 1 && ! $fk_product) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Product")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")); return -1; } if ($type < 0) return -1; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 98048552911..da2930ed667 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1545,7 +1545,7 @@ if ($action=='create') } else { - print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { @@ -1895,7 +1895,7 @@ elseif (! empty($object->id)) $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $form->select_company($object->thirdparty->id, 'new_socid', 's.fournisseur = 1', '', 0, 0, array(), 0, 'minwidth300'); + $morehtmlref .= $form->select_company($object->thirdparty->id, 'new_socid', 's.fournisseur=1', '', 0, 0, array(), 0, 'minwidth300'); $morehtmlref .= ''; $morehtmlref .= ''; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e4b71768456..80645e2a486 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -632,10 +632,8 @@ if ($resql) $newcardbutton=''; if($user->rights->fournisseur->commande->creer) { - $newcardbutton=''.$langs->trans('NewOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/commande/card.php?action=create'); + } // Lignes des champs de filtre print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f7a1c800443..5ec65444746 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1741,7 +1741,7 @@ if ($action == 'create') } else { - print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve supplier informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 27a659300cc..02c8af6ebc6 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -213,7 +213,7 @@ if ($user->rights->fournisseur->facture->lire) print ''; - print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 2415167f8ae..fe3deb6459b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -466,9 +466,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->fournisseur->facture->creer) { - $newcardbutton=''.$langs->trans('NewBill').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/facture/card.php?action=create'); } $i = 0; @@ -730,7 +728,7 @@ if ($resql) } if (! empty($arrayfields['rtp']['checked'])) { - print ''; } // Extra fields diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index a84acde6e04..f45d4009d05 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -944,7 +944,7 @@ if (empty($action) || $action == 'list') print ''; - print ''; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 218379ce7b8..7b319490815 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -243,7 +243,7 @@ if ($resql) print ''; print ''; print ''; - print ''; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index fc90f8a3ed5..6c4cb05a17e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -71,6 +71,11 @@ $error = 0; * Actions */ +if (GETPOST('cancel', 'alpha')) +{ + $action = ''; +} + // If create a request if ($action == 'create') { @@ -193,7 +198,35 @@ if ($action == 'create') } } -if ($action == 'update') +if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->rights->holiday->approve)) +{ + $object = new Holiday($db); + $object->fetch($id); + + $object->oldcopy = dol_clone($object); + + $object->fk_validator = GETPOST('valideur', 'int'); + + if ($object->fk_validator != $object->oldcopy->fk_validator) + { + $verif = $object->update($user); + + if ($verif <= 0) + { + setEventMessages($object->error, $object->errors, 'warnings'); + $action='editvalidator'; + } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + } + + $action = ''; +} + +if ($action == 'update' && ! GETPOSTISSET('savevalidator')) { $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); @@ -877,6 +910,7 @@ if ((empty($id) && empty($ref)) || $action == 'add' || $action == 'request' || $ // Formulaire de demande print ''."\n"; + print ''."\n"; print ''."\n"; if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) @@ -1086,9 +1120,10 @@ else { $head=holiday_prepare_head($object); - if ($action == 'edit' && $object->statut == 1) + if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { - $edit = true; + if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) $edit = true; + print ''."\n"; print ''."\n"; print ''."\n"; @@ -1128,7 +1163,7 @@ else $starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning'; $endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon'; - if(!$edit) + if (!$edit) { print ''; print ''; @@ -1177,7 +1212,7 @@ else print ''; print ''; - if ($object->statut == 5) + if ($object->statut == Holiday::STATUS_REFUSED) { print ''; print ''; @@ -1227,25 +1262,40 @@ else } // Validator - if (!$edit) { + if (!$edit && $action != 'editvalidator') { print ''; print ''; - print ''; + print ''; print ''; } else { print ''; print ''; print ''; print ''; } @@ -1254,19 +1304,19 @@ else print ''; print ''; print ''; - if ($object->statut == 3 || $object->statut == 4) { + if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { print ''; print ''; print ''; // warning: date_valid is approval date on holiday module print ''; } - if ($object->statut == 4) { + if ($object->statut == Holiday::STATUS_CANCELED) { print ''; print ''; print ''; print ''; } - if ($object->statut == 5) { + if ($object->statut == Holiday::STATUS_REFUSED) { print ''; print ''; print ''; @@ -1324,20 +1374,21 @@ else print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleSetToDraft"), $langs->trans("ConfirmSetToDraft"), "confirm_draft", '', 1, 1); } - - if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) + if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { - print '
'; - if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) + if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { - print ''; + print '
'; + if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) + { + print ''; + } + print '
'; } - print '
'; print ''; } - if (! $edit) { print '
'; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index b05e94cccfa..05083877b32 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2177,4 +2177,91 @@ class Holiday extends CommonObject $this->fk_type=1; $this->statut=Holiday::STATUS_VALIDATED; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load this->nb for dashboard + * + * @return int <0 if KO, >0 if OK + */ + public function load_state_board() + { + // phpcs:enable + $this->nb=array(); + + $sql = "SELECT count(h.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as h"; + $sql.= " WHERE h.statut > 1"; + $sql.= " AND h.entity IN (".getEntity('holiday').")"; + + $resql=$this->db->query($sql); + if ($resql) { + while ($obj=$this->db->fetch_object($resql)) { + $this->nb["holidays"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @param User $user Objet user + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK + */ + public function load_board($user) + { + // phpcs:enable + global $conf, $langs; + + if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + + $now=dol_now(); + + $userchildids = $user->getAllChildIds(1); + + $sql = "SELECT h.rowid, h.date_debut"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as h"; + $sql.= " WHERE h.statut = 2"; + $sql.= " AND h.entity IN (".getEntity('holiday').")"; + $sql.= " AND (h.fk_user IN (".join(',', $userchildids).")"; + $sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))"; + + $resql=$this->db->query($sql); + if ($resql) + { + $langs->load("members"); + + $response = new WorkboardResponse(); + $response->warning_delay=$conf->holiday->approve->warning_delay/60/60/24; + $response->label=$langs->trans("HolidaysToApprove"); + $response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday'; + $response->img=img_object('', "holiday"); + + while ($obj=$this->db->fetch_object($resql)) + { + $response->nbtodo++; + + if ($this->db->jdate($obj->date_debut) < ($now - $conf->holiday->approve->warning_delay)) { + $response->nbtodolate++; + } + } + + return $response; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 1404391f521..c0b25e57769 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -271,7 +271,7 @@ else print '
'; // Action column - print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 5497d66e698..84e7b36c239 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -340,10 +340,8 @@ else $newcardbutton=''; if ($user->rights->holiday->write) { - $newcardbutton=''.$langs->trans('MenuAddCP').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=request'); + } print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit); @@ -462,7 +460,7 @@ $holiday->selectStatutCP($search_statut, 'search_statut'); print ''; // Actions -print ''; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index f27f1a5f10b..a37d3490c97 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -193,7 +193,7 @@ print ''; print ''; print ''; // Action column -print ''; diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 37a3d7f538b..071277bd501 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -127,7 +127,7 @@ elseif ($action == 'update') $name = GETPOST('name', 'alpha'); if (empty($name)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('Name')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Name')), null, 'errors'); $error ++; } @@ -291,7 +291,7 @@ if (($id || $ref) && $action == 'edit') print ''; - + // Parent print ''; print ''; print ''; print ''; - + // Parent print ''; print ''; diff --git a/htdocs/ifttt/README.md b/htdocs/ifttt/README.md deleted file mode 100644 index 581853f80c6..00000000000 --- a/htdocs/ifttt/README.md +++ /dev/null @@ -1,7 +0,0 @@ -API REST -======== - -## Integrate your ERP with any other applications using IFTTT - -This module provides the triggers and services to make Dolibarr compatible with IFTTT Services. - diff --git a/htdocs/ifttt/admin/index.php b/htdocs/ifttt/admin/index.php deleted file mode 100644 index 30ed2ef0a86..00000000000 --- a/htdocs/ifttt/admin/index.php +++ /dev/null @@ -1,126 +0,0 @@ - - * Copyright (C) 2005-2016 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012-2018 Regis Houssin - * Copyright (C) 2015 Jean-François Ferry - * - * 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/ifttt/admin/index.php - * \ingroup api - * \brief Page to setup IFTTT module - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - -// Load translation files required by the page -$langs->load("admin"); - -if (! $user->admin) - accessforbidden(); - -$action=GETPOST('action', 'aZ09'); - - -if ($action == 'set') -{ - $res1 = dolibarr_set_const($db, 'IFTTT_SERVICE_KEY', GETPOST('IFTTT_SERVICE_KEY', 'alpha'), 'chaine', 0, '', 0); - $res2 = dolibarr_set_const($db, 'IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', GETPOST('IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', 'alpha'), 'chaine', 0, '', 0); - - if ($res1 > 0 && $res2) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - - -/* - * View - */ - -llxHeader(); - -$linkback=''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("IFTTTSetup"), $linkback, 'title_setup'); - -print ''.$langs->trans("IFTTTDesc")."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; -print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; - if ($mode == 'customer') $filter='s.client in (1,2,3)'; - if ($mode == 'supplier') $filter='s.fournisseur = 1'; - print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); + print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
'.$langs->trans("CreatedBy").''; @@ -279,7 +265,7 @@ foreach ($data as $val) print '
'.$oldyear.''.$oldyear.'00
'; - if ($year) print ''.$year.''; + if ($year) print ''.$year.''; else print $langs->trans("ValidationDateNotDefinedEvenIfShipmentValidated"); print ''.$val['nb'].'
'; print $numline; print ''; - print img_picto($langs->trans("Document"), "object_generic"); - print ' '.$piece_comptable.''; - print ''.dol_print_date($db->jdate($line->date), 'day').''; @@ -2094,21 +2090,26 @@ else { $projecttmp->id=$line->fk_project; $projecttmp->ref=$line->projet_ref; + $projecttmp->title=$line->projet_title; print $projecttmp->getNomUrl(1); } print ''; print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); print ''; $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); print $labeltype; print ''.dol_nl2br($line->comments).''.vatrate($line->vatrate, true).''; @@ -2716,9 +2717,6 @@ if ($action != 'create' && $action != 'edit') print ''; -//$conf->global->DOL_URL_ROOT_DOCUMENT_PHP=dol_buildpath('/expensereport/documentwrapper.php',1); - - // Select mail models is same action as presend if (GETPOST('modelselected', 'alpha')) { $action = 'presend'; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 520972a23e6..94033912a69 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -456,9 +456,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->expensereport->creer) { - $newcardbutton=''.$langs->trans('NewTrip').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expensereport/card.php?action=create'); } print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 2be1409bd45..d79dd624e4f 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -221,8 +221,7 @@ print '
'.$langs->tra // Company /* print '
'.$langs->trans("ThirdParty").''; -$filter=''; -print $form->select_company($socid,'socid',$filter,1,1,0,array(),0,'','style="width: 95%"'); +print $form->select_company($socid,'socid','',1,1,0,array(),0,'','style="width: 95%"'); print '
'; print $value.' '; - print ''; + print ''; if ($value < count($array_selected)) print ''.img_down().''; if ($value > 1) print ''.img_up().''; print ' '; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; - $filter = 's.client in (1,2,3)'; + $filter = 's.client IN (1,2,3)'; print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
'; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'
'.$langs->trans('DetailRefusCP').'
'; - if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); + if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) print $langs->trans('ApprovedBy'); else print $langs->trans('ReviewedByCP'); print ''.$valideur->getNomUrl(-1).''.$valideur->getNomUrl(-1); + $include_users = $object->fetch_users_approver_holiday(); + if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) + { + print ''.img_edit($langs->trans("Edit")).''; + } + print '
'.$langs->trans('ReviewedByCP').''; $include_users = $object->fetch_users_approver_holiday(); + if (! in_array($object->fk_validator, $include_users)) // Add the current validator to the list to not lose it when editing. + { + $include_users[]=$object->fk_validator; + } if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); else { - $s=$form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id)), 0, $include_users); + $s=$form->select_dolusers($object->fk_validator, "valideur", (($action == 'editvalidator') ? 0 : 1), ($user->admin ? '' : array($user->id)), 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } + if ($action == 'editvalidator') + { + print ''; + print ''; + } print '
'.$langs->trans('DateCreateCP').''.dol_print_date($object->date_create, 'dayhour').'
'.$langs->trans('DateValidCP').''.dol_print_date($object->date_valid, 'dayhour').'
'.$langs->trans('DateCancelCP').''.dol_print_date($object->date_cancel, 'dayhour').'
'.$langs->trans('DateRefusCP').''.dol_print_date($object->date_refuse, 'dayhour').''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; print ''; print '
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; @@ -380,7 +380,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Name").''.$object->name.'
'.$langs->trans("Parent").'
'; - -print ''; -print ""; -print '"; -print ""; -print ""; - -print ''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; -print ''; - -print '
".$langs->trans("Parameter")."'.$langs->trans("Value")." 
'.$langs->trans("IFTTT_SERVICE_KEY").''; -print ''; -print ''.$langs->trans("YouWillFindItOnYourIFTTTAccount").'
'.$langs->trans("IFTTT_DOLIBARR_ENDPOINT_SECUREKEY").''; -print ''; -print '
'; - -print '
'; -print ''; -print '
'; - -print ''; - -print '

'; - - - -// Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - -// Show message -$message=''; -$url=$urlwithroot.'/public/ifttt/index.php?securekey='.$conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY; -$message.=$langs->trans("UrlForIFTTT").':
'; -$message.=img_picto('', 'object_globe.png').' '; -print $message; -print ajax_autoselect("endpointforifttt"); -print '
'; -print '
'; - - -llxFooter(); -$db->close(); diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index 6ccb0adcf44..8175dd1ca83 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -92,7 +92,7 @@ if (count($import->array_import_code)) { //if ($user->rights->import->run) //{ - print ''.$langs->trans("NewImport").''; + print dolGetButtonTitle($langs->trans('NewImport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/imports/import.php?leftmenu=import'); //} //else //{ diff --git a/htdocs/includes/ccampbell/chromephp/ChromePhp.php b/htdocs/includes/ccampbell/chromephp/ChromePhp.php deleted file mode 100644 index 577b1cecb9d..00000000000 --- a/htdocs/includes/ccampbell/chromephp/ChromePhp.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class ChromePhp -{ - /** - * @var string - */ - const VERSION = '4.1.0'; - - /** - * @var string - */ - const HEADER_NAME = 'X-ChromeLogger-Data'; - - /** - * @var string - */ - const BACKTRACE_LEVEL = 'backtrace_level'; - - /** - * @var string - */ - const LOG = 'log'; - - /** - * @var string - */ - const WARN = 'warn'; - - /** - * @var string - */ - const ERROR = 'error'; - - /** - * @var string - */ - const GROUP = 'group'; - - /** - * @var string - */ - const INFO = 'info'; - - /** - * @var string - */ - const GROUP_END = 'groupEnd'; - - /** - * @var string - */ - const GROUP_COLLAPSED = 'groupCollapsed'; - - /** - * @var string - */ - const TABLE = 'table'; - - /** - * @var string - */ - protected $_php_version; - - /** - * @var int - */ - protected $_timestamp; - - /** - * @var array - */ - protected $_json = array( - 'version' => self::VERSION, - 'columns' => array('log', 'backtrace', 'type'), - 'rows' => array() - ); - - /** - * @var array - */ - protected $_backtraces = array(); - - /** - * @var bool - */ - protected $_error_triggered = false; - - /** - * @var array - */ - protected $_settings = array( - self::BACKTRACE_LEVEL => 1 - ); - - /** - * @var ChromePhp - */ - protected static $_instance; - - /** - * Prevent recursion when working with objects referring to each other - * - * @var array - */ - protected $_processed = array(); - - /** - * constructor - */ - private function __construct() - { - $this->_php_version = phpversion(); - $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time(); - $this->_json['request_uri'] = $_SERVER['REQUEST_URI']; - } - - /** - * gets instance of this class - * - * @return ChromePhp - */ - public static function getInstance() - { - if (self::$_instance === null) { - self::$_instance = new self(); - } - return self::$_instance; - } - - /** - * logs a variable to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function log() - { - $args = func_get_args(); - return self::_log('', $args); - } - - /** - * logs a warning to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function warn() - { - $args = func_get_args(); - return self::_log(self::WARN, $args); - } - - /** - * logs an error to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function error() - { - $args = func_get_args(); - return self::_log(self::ERROR, $args); - } - - /** - * sends a group log - * - * @param string value - */ - public static function group() - { - $args = func_get_args(); - return self::_log(self::GROUP, $args); - } - - /** - * sends an info log - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function info() - { - $args = func_get_args(); - return self::_log(self::INFO, $args); - } - - /** - * sends a collapsed group log - * - * @param string value - */ - public static function groupCollapsed() - { - $args = func_get_args(); - return self::_log(self::GROUP_COLLAPSED, $args); - } - - /** - * ends a group log - * - * @param string value - */ - public static function groupEnd() - { - $args = func_get_args(); - return self::_log(self::GROUP_END, $args); - } - - /** - * sends a table log - * - * @param string value - */ - public static function table() - { - $args = func_get_args(); - return self::_log(self::TABLE, $args); - } - - /** - * internal logging call - * - * @param string $type - * @return void - */ - protected static function _log($type, array $args) - { - // nothing passed in, don't do anything - if (count($args) == 0 && $type != self::GROUP_END) { - return; - } - - $logger = self::getInstance(); - - $logger->_processed = array(); - - $logs = array(); - foreach ($args as $arg) { - $logs[] = $logger->_convert($arg); - } - - $backtrace = debug_backtrace(false); - $level = $logger->getSetting(self::BACKTRACE_LEVEL); - - $backtrace_message = 'unknown'; - if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) { - $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line']; - } - - $logger->_addRow($logs, $backtrace_message, $type); - } - - /** - * converts an object to a better format for logging - * - * @param Object - * @return array - */ - protected function _convert($object) - { - // if this isn't an object then just return it - if (!is_object($object)) { - return $object; - } - - //Mark this object as processed so we don't convert it twice and it - //Also avoid recursion when objects refer to each other - $this->_processed[] = $object; - - $object_as_array = array(); - - // first add the class name - $object_as_array['___class_name'] = get_class($object); - - // loop through object vars - $object_vars = get_object_vars($object); - foreach ($object_vars as $key => $value) { - - // same instance as parent object - if ($value === $object || in_array($value, $this->_processed, true)) { - $value = 'recursion - parent object [' . get_class($value) . ']'; - } - $object_as_array[$key] = $this->_convert($value); - } - - $reflection = new ReflectionClass($object); - - // loop through the properties and add those - foreach ($reflection->getProperties() as $property) { - - // if one of these properties was already added above then ignore it - if (array_key_exists($property->getName(), $object_vars)) { - continue; - } - $type = $this->_getPropertyKey($property); - - if ($this->_php_version >= 5.3) { - $property->setAccessible(true); - } - - try { - $value = $property->getValue($object); - } catch (ReflectionException $e) { - $value = 'only PHP 5.3 can access private/protected properties'; - } - - // same instance as parent object - if ($value === $object || in_array($value, $this->_processed, true)) { - $value = 'recursion - parent object [' . get_class($value) . ']'; - } - - $object_as_array[$type] = $this->_convert($value); - } - return $object_as_array; - } - - /** - * takes a reflection property and returns a nicely formatted key of the property name - * - * @param ReflectionProperty - * @return string - */ - protected function _getPropertyKey(ReflectionProperty $property) - { - $static = $property->isStatic() ? ' static' : ''; - if ($property->isPublic()) { - return 'public' . $static . ' ' . $property->getName(); - } - - if ($property->isProtected()) { - return 'protected' . $static . ' ' . $property->getName(); - } - - if ($property->isPrivate()) { - return 'private' . $static . ' ' . $property->getName(); - } - } - - /** - * adds a value to the data array - * - * @var mixed - * @return void - */ - protected function _addRow(array $logs, $backtrace, $type) - { - // if this is logged on the same line for example in a loop, set it to null to save space - if (in_array($backtrace, $this->_backtraces)) { - $backtrace = null; - } - - // for group, groupEnd, and groupCollapsed - // take out the backtrace since it is not useful - if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) { - $backtrace = null; - } - - if ($backtrace !== null) { - $this->_backtraces[] = $backtrace; - } - - $row = array($logs, $backtrace, $type); - - $this->_json['rows'][] = $row; - $this->_writeHeader($this->_json); - } - - protected function _writeHeader($data) - { - header(self::HEADER_NAME . ': ' . $this->_encode($data)); - } - - /** - * encodes the data to be sent along with the request - * - * @param array $data - * @return string - */ - protected function _encode($data) - { - return base64_encode(utf8_encode(json_encode($data))); - } - - /** - * adds a setting - * - * @param string key - * @param mixed value - * @return void - */ - public function addSetting($key, $value) - { - $this->_settings[$key] = $value; - } - - /** - * add ability to set multiple settings in one call - * - * @param array $settings - * @return void - */ - public function addSettings(array $settings) - { - foreach ($settings as $key => $value) { - $this->addSetting($key, $value); - } - } - - /** - * gets a setting - * - * @param string key - * @return mixed - */ - public function getSetting($key) - { - if (!isset($this->_settings[$key])) { - return null; - } - return $this->_settings[$key]; - } -} diff --git a/htdocs/includes/ccampbell/chromephp/README.md b/htdocs/includes/ccampbell/chromephp/README.md deleted file mode 100644 index 3dd7dbe19dd..00000000000 --- a/htdocs/includes/ccampbell/chromephp/README.md +++ /dev/null @@ -1,23 +0,0 @@ -## Overview -ChromePhp is a PHP library for the Chrome Logger Google Chrome extension. - -This library allows you to log variables to the Chrome console. - -## Requirements -- PHP 5 or later - -## Installation -1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd -2. Click the extension icon in the browser to enable it for the current tab's domain -3. Put ChromePhp.php somewhere in your PHP include path -4. Log some data - - ```php - include 'ChromePhp.php'; - ChromePhp::log('Hello console!'); - ChromePhp::log($_SERVER); - ChromePhp::warn('something went wrong!'); - ``` - -More information can be found here: -http://www.chromelogger.com diff --git a/htdocs/includes/ccampbell/chromephp/composer.json b/htdocs/includes/ccampbell/chromephp/composer.json deleted file mode 100644 index dc16853d3ec..00000000000 --- a/htdocs/includes/ccampbell/chromephp/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ccampbell/chromephp", - "type": "library", - "description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).", - "keywords": ["log","logging"], - "homepage": "http://github.com/ccampbell/chromephp", - "license": "Apache-2.0", - "authors": [ - { - "name": "Craig Campbell", - "email": "iamcraigcampbell@gmail.com", - "homepage": "http://craig.is", - "role": "Developer" - } - ], - "require": { - "php": ">=5.0.0" - }, - "autoload": { - "psr-0": { - "ChromePhp": "" - } - } -} diff --git a/htdocs/index.php b/htdocs/index.php index 3d813c35118..d6ce8c90067 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -151,6 +151,7 @@ if (empty($user->societe_id)) ! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), ! empty($conf->projet->enabled) && $user->rights->projet->lire, ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + ! empty($conf->holiday->enabled) && $user->rights->holiday->read, ! empty($conf->don->enabled) && $user->rights->don->lire ); // Class file containing the method load_state_board for each line @@ -173,6 +174,7 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", DOL_DOCUMENT_ROOT."/projet/class/project.class.php", DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", DOL_DOCUMENT_ROOT."/don/class/don.class.php" ); // Name class containing the method load_state_board for each line @@ -194,6 +196,7 @@ if (empty($user->societe_id)) 'SupplierProposal', 'Project', 'ExpenseReport', + 'Holiday', 'Don' ); // Cle array returned by the method load_state_board for each line @@ -204,7 +207,7 @@ if (empty($user->societe_id)) 'contacts', 'members', 'products', - 'services', + 'services', 'proposals', 'orders', 'invoices', @@ -215,6 +218,7 @@ if (empty($user->societe_id)) 'askprice', 'projects', 'expensereports', + 'holidays', 'donations' ); // Dashboard Icon lines @@ -236,6 +240,7 @@ if (empty($user->societe_id)) 'propal', 'projectpub', 'trip', + 'holiday', 'generic' ); // Translation keyword @@ -257,6 +262,7 @@ if (empty($user->societe_id)) "SupplierProposalShort", "Projects", "ExpenseReports", + "Holidays", "Donations" ); // Dashboard Link lines @@ -279,6 +285,7 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=', DOL_URL_ROOT.'/projet/list.php?mainmenu=project', DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', + DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', DOL_URL_ROOT.'/don/list.php?leftmenu=donations' ); // Translation lang files @@ -300,6 +307,7 @@ if (empty($user->societe_id)) "supplier_proposal", "projects", "trips", + "holidays", "donations" ); @@ -497,6 +505,14 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_p $dashboardlines[] = $board->load_board($user, 'topay'); } +// Number of holidays to approve +if (! empty($conf->holiday->enabled) && $user->rights->holiday->approve) +{ + include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; + $board=new Holiday($db); + $dashboardlines[] = $board->load_board($user); +} + $object=new stdClass(); $parameters=array(); $action=''; diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql index b1dcdb64c35..54ae1d6e466 100644 --- a/htdocs/install/mysql/data/llx_accounting_abc.sql +++ b/htdocs/install/mysql/data/llx_accounting_abc.sql @@ -129,3 +129,6 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE -- Description of chart of account DZ NSCF INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 13, 'NSCF', 'Nouveau système comptable financier', 1); + +-- Description of chart of account NL NL-VERKORT +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 17, 'NL-VERKORT', 'Verkort rekeningschema', 1); diff --git a/htdocs/install/mysql/data/llx_accounting_account_nl.sql b/htdocs/install/mysql/data/llx_accounting_account_nl.sql new file mode 100644 index 00000000000..8cd08eb474d --- /dev/null +++ b/htdocs/install/mysql/data/llx_accounting_account_nl.sql @@ -0,0 +1,117 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011-2017 Alexandre Spangaro +-- +-- 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 . +-- + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +-- Description of the accounts in NL-VERKORT +-- ID 0100-9999 +-- ADD 7006000 to rowid # Do no remove this comment -- +-- + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1000, 'NL_VERKORT', 'BALANS', 'XXXXXX', '0050', '', 'Bedrijfspand en woning', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1001, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0055', '', 'Afschrijving bedrijfspand en woning', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1002, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0100', '', 'Inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1003, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0105', '', 'Afschrijving inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1004, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0150', '', 'Kantoor-inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1005, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0155', '', 'Afschrijving kantoor-inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1006, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0200', '', 'Transportmiddelen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1007, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0205', '', 'Afschrijving transportmiddelen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1008, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1100', '', 'Kas', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1009, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1200', '', 'Bank', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1010, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1300', '', 'Debiteuren', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1011, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1310', '', 'Oninbare debiteuren', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1012, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1500', '', 'Privé', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1013, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1520', '', 'Privé IB/ZORGVERZ', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1014, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1600', '', 'Crediteuren', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1015, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1700', '', 'Ingehouden loonbelasing', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1016, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1710', '', 'Afdracht loonbelasting', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1017, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1720', '', 'Ingehouden pensioenlasten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1018, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1730', '', 'Reservering vakantiegeld', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1019, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1820', '', 'BTW te betalen hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1020, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1825', '', 'BTW te betalen laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1021, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1828', '', 'BTW te betalen auto privé', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1022, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1829', '', 'BTW te betalen telefoon privé', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1023, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1830', '', 'BTW te vorderen hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1024, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1835', '', 'BTW te vorderen laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1025, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1890', '', 'Betaalde BTW', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1026, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2200', '', 'Te betalen netto lonen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1027, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2500', '', 'Kruisposten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1028, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2900', '', 'Vraagposten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1029, 'NL-VERKORT', 'BALANS', 'XXXXXX', '3000', '', 'Voorraad', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1030, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4000', '', 'Kantoorbenodigdheden', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1031, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4010', '', 'Porti', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1032, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4020', '', 'Telefoon/Internet', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1033, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4030', '', 'Onderhoud gebouwen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1034, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4040', '', 'Overige huisvestingskosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1035, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4050', '', 'Belastingen en heffingen onroerend goed', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1036, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4060', '', 'Onderhoud inventaris e.d.', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1037, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4070', '', 'Kleine aanschaffingen < 500', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1038, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4080', '', 'Kosten automatisering', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1039, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4090', '', 'Abonnementen en contributies', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1040, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4100', '', 'Autokosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1041, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4110', '', 'Boetes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1042, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4120', '', 'Auto brandstof', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1043, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4130', '', 'Auto belasting en verzekering', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1044, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4140', '', 'BTW privé gebruik', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1045, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4150', '', 'Bijtelling auto', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1046, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4200', '', 'Reiskosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1047, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4210', '', 'Reiskosten/eten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1048, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4220', '', 'Representatiekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1049, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4230', '', 'Werkkleding', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1050, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4300', '', 'Magazijnkosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1051, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4310', '', 'Stroom, gas en water', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1052, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4320', '', 'Huur', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1053, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4330', '', 'Reclamekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1054, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4340', '', 'Sponsoring', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1055, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4350', '', 'Vertegenwoordigers/provisie', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1056, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4400', '', 'Bruto lonen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1057, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4410', '', 'Sociale lasten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1058, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4500', '', 'Afschr. kosten gebouwen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1059, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4510', '', 'Afschr. kosten bedrijfsinventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1060, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4520', '', 'Afschr. kosten kantoorinventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1061, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4530', '', 'Afschr. kosten transportmiddelen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4600', '', 'Administratiekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4610', '', 'Kantinekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4620', '', 'Provisie ass. tussenpersoon', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4630', '', 'Vraagposten (V&W)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4640', '', 'Diverse verzekeringen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4700', '', 'Overige kosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4750', '', 'Nog te verdelen posten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4800', '', 'Rente hypotheek', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4810', '', 'Rente overige leningen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4820', '', 'Rente en kosten RC', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7000', '', 'Inkoop hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1073, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7010', '', 'Inkoop laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1074, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7020', '', 'Inkoop nul BTW', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1075, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7030', '', 'Inkoop binnen EU', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1076, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7040', '', 'Inkoop buiten EU', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1077, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8000', '', 'Omzet hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1078, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8010', '', 'Omzet laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1079, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8020', '', 'Omzet nul BTW', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1080, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8090', '', 'Onderhanden omzet', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1081, 'NL-VERKORT', 'INCOME', 'XXXXXX', '9000', '', 'Bijzondere baten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1082, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '9010', '', 'Bijzondere lasten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1083, 'NL-VERKORT', 'BALANS', 'XXXXXX', '9900', '', 'Kapitaal', 1); diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index 62107525ff9..006a65d2641 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -92,3 +92,10 @@ INSERT INTO llx_c_type_contact (rowid, element, source, code, libelle, active, m INSERT INTO llx_c_type_contact (rowid, element, source, code, libelle, active, module) VALUES(157, 'ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1, NULL); INSERT INTO llx_c_type_contact (rowid, element, source, code, libelle, active, module) VALUES(158, 'ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1, NULL); +-- Supplier proposal + +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110, 'supplier_proposal', 'internal', 'SALESREPFOLL', 'Responsable suivi de la demande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (111, 'supplier_proposal', 'external', 'BILLING', 'Contact fournisseur facturation', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (112, 'supplier_proposal', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (113, 'supplier_proposal', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); + diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index c0ab1631d8c..f639db56ab5 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -270,8 +270,8 @@ CREATE TABLE llx_pos_cash_fence( -- Withdrawals / Prelevements -UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; -UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; +UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_END_TO_END')__ where name = __ENCRYPT('END_TO_END')__; +UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_USTRD')__ where name = __ENCRYPT('USTRD')__; -- Delete duplicate accounting account, but only if not used diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index c85c1ff9167..81a1e315751 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -212,19 +212,22 @@ CREATE TABLE llx_bom_bom( description text, note_public text, note_private text, + fk_product integer, + qty double(24,8), + efficiency double(8,4), date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, date_valid datetime, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, import_key varchar(14), - status integer NOT NULL, - fk_product integer, - qty double(24,8) + status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(8,4) DEFAULT 1; + create table llx_bom_bom_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -236,15 +239,21 @@ create table llx_bom_bom_extrafields CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - fk_product integer, - fk_bom integer, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1; +ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL; + + create table llx_bom_bomline_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -295,8 +304,8 @@ ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer; ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN datelastok datetime; ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN maxemailpercollect integer DEFAULT 100; -DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_HOVER' AND value = '0'; -DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_CHECKED' AND value = '0'; +DELETE FROM llx_const WHERE name = __ENCRYPT('THEME_ELDY_USE_HOVER')__ AND value = __ENCRYPT('0')__; +DELETE FROM llx_const WHERE name = __ENCRYPT('THEME_ELDY_USE_CHECKED')__ AND value = __ENCRYPT('0')__; ALTER TABLE llx_inventorydet DROP COLUMN pmp; ALTER TABLE llx_inventorydet DROP COLUMN pa; @@ -368,4 +377,11 @@ ALTER TABLE llx_reception_extrafields ADD INDEX idx_reception_extrafields (fk_ob ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_projet integer DEFAULT NULL; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_reception integer DEFAULT NULL; - \ No newline at end of file + + +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110, 'supplier_proposal', 'internal', 'SALESREPFOLL', 'Responsable suivi de la demande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (111, 'supplier_proposal', 'external', 'BILLING', 'Contact fournisseur facturation', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (112, 'supplier_proposal', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (113, 'supplier_proposal', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); + +ALTER TABLE llx_ticket_extrafields ADD INDEX idx_ticket_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_asset.sql b/htdocs/install/mysql/tables/llx_asset.sql index a0891ef4b0e..b6b2de3fcb3 100644 --- a/htdocs/install/mysql/tables/llx_asset.sql +++ b/htdocs/install/mysql/tables/llx_asset.sql @@ -26,7 +26,7 @@ CREATE TABLE llx_asset( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index 89a2f8e8bab..4e559566817 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -23,15 +23,16 @@ CREATE TABLE llx_bom_bom( description text, note_public text, note_private text, + fk_product integer, + qty double(24,8), + efficiency double(8,4) DEFAULT 1, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, date_valid datetime, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, import_key varchar(14), - status integer NOT NULL, - fk_product integer, - qty double(24,8) + status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index d1a958e9633..bafaaf73694 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -13,15 +13,16 @@ -- 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_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - fk_product integer, - fk_bom integer, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS -) ENGINE=innodb; \ No newline at end of file +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index 2a7bc6a4693..df4640a14f4 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -34,7 +34,7 @@ CREATE TABLE llx_emailcollector_emailcollector( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql index e0239cf98f6..011f2d827ce 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_emailcollector_emailcollectoraction( type varchar(128) NOT NULL, actionparam varchar(255) NULL, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, fk_user_creat integer NOT NULL, fk_user_modif integer, position integer DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql index e4071e5500a..8ecccedb6d5 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_emailcollector_emailcollectorfilter( type varchar(128) NOT NULL, rulevalue varchar(128) NULL, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_pos_cash_fence.sql b/htdocs/install/mysql/tables/llx_pos_cash_fence.sql index 607060adab6..f9967ec968b 100644 --- a/htdocs/install/mysql/tables/llx_pos_cash_fence.sql +++ b/htdocs/install/mysql/tables/llx_pos_cash_fence.sql @@ -33,6 +33,6 @@ CREATE TABLE llx_pos_cash_fence( posnumber VARCHAR(30), fk_user_creat integer, fk_user_valid integer, - tms TIMESTAMP NOT NULL, + tms TIMESTAMP, import_key VARCHAR(14) ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_societe_account.sql b/htdocs/install/mysql/tables/llx_societe_account.sql index 4123a3b05e2..b307613ba6e 100644 --- a/htdocs/install/mysql/tables/llx_societe_account.sql +++ b/htdocs/install/mysql/tables/llx_societe_account.sql @@ -32,7 +32,7 @@ CREATE TABLE llx_societe_account( date_last_login datetime, date_previous_login datetime, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql new file mode 100644 index 00000000000..3baba56d9d4 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql @@ -0,0 +1,23 @@ +-- =================================================================== +-- Copyright (C) 2002-2003 Rodolphe Quiedeville +-- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2011 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- 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 . +-- +-- =================================================================== + + +ALTER TABLE llx_ticket_extrafields ADD INDEX idx_ticket_extrafields (fk_object); diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index de6d98edf04..66b1fbaf370 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -69,6 +69,12 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extraf CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_blockedlog FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_blockedlog_authority FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bom_bom FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bom_bom_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bom_bomline FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bom_bomline_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bordereau_cheque FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_boxes_def FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_c_email_templates FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -96,6 +102,9 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollector FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectoraction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectorfilter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expedition FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index fa1b070cc40..d55cdd7d01f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -67,17 +67,17 @@ $actiondone=1; print '

'.$langs->trans("Repair").'

'; -print 'Option standard (0 or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'0').'
'."\n"; -print 'Option restore_thirdparties_logos (0 or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'0').'
'."\n"; -print 'Option clean_linked_elements (0 or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'0').'
'."\n"; -print 'Option clean_menus (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'0').'
'."\n"; -print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'0').'
'."\n"; -print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'0').'
'."\n"; -print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'0').'
'."\n"; -print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'0').'
'."\n"; -print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'0').'
'."\n"; -print 'Option clean_perm_table (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'0').'
'."\n"; -print 'Option force_utf8_on_tables, for mysql/mariadb only (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'0').'
'."\n"; +print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'undefined').'
'."\n"; +print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'undefined').'
'."\n"; +print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'
'."\n"; +print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'
'."\n"; +print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'
'."\n"; +print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; print '
'; print ''; @@ -302,14 +302,23 @@ if ($ok && GETPOST('standard', 'alpha')) ); //var_dump($field_desc);exit; - $result=$db->DDLAddField($tableextra, $code, $field_desc, ""); - if ($result < 0) + $result = 0; + if (GETPOST('standard', 'alpha') == 'confirmed') { - print "KO ".$db->lasterror."
\n"; + $result=$db->DDLAddField($tableextra, $code, $field_desc, ""); + + if ($result < 0) + { + print "KO ".$db->lasterror."
\n"; + } + else + { + print "OK
\n"; + } } else { - print "OK
\n"; + print ' - Mode test, no column added.'; } } } @@ -324,7 +333,6 @@ if ($ok && GETPOST('standard', 'alpha')) } - // clean_data_ecm_dir: Clean data into ecm_directories table if ($ok && GETPOST('standard', 'alpha')) { @@ -332,10 +340,76 @@ if ($ok && GETPOST('standard', 'alpha')) } +// clean declaration constants +if ($ok && GETPOST('standard', 'alpha')) +{ + print ''; + $sql ="SELECT name, entity, value"; + $sql.=" FROM ".MAIN_DB_PREFIX."const as c"; + $sql.=" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE'"; + $sql.=" ORDER BY name, entity"; -/* From here, actions need a parameter */ + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num) + { + $db->begin(); + + $i = 0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + + $reg = array(); + if (preg_match('/MAIN_MODULE_(.*)_(.*)/i', $obj->name, $reg)) + { + $name=$reg[1]; + $type=$reg[2]; + + $sql2 ="SELECT COUNT(*) as nb"; + $sql2.=" FROM ".MAIN_DB_PREFIX."const as c"; + $sql2.=" WHERE name LIKE 'MAIN_MODULE_".$name."'"; + $sql2.=" AND entity = ".$obj->entity; + $resql2 = $db->query($sql2); + if ($resql2) + { + $obj2 = $db->fetch_object($resql2); + if ($obj2 && $obj2->nb == 0) + { + // Module not found, so we canremove entry + $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$db->escape($obj->name)."' AND entity = ".$obj->entity; + + if (GETPOST('standard', 'alpha') == 'confirmed') + { + $db->query($sqldelete); + + print ''; + } + else + { + print ''; + } + } + else + { + //print ''; + } + } + } + + $i++; + } + + $db->commit(); + } + } +} // restore_thirdparties_logos: Move logos to correct new directory. @@ -903,7 +977,7 @@ if ($ok && GETPOST('set_empty_time_spent_amount', 'alpha')) // force_disable_of_modules_not_found if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) { - print ''; + print ''; $arraylistofkey=array('hooks','js','css'); @@ -931,12 +1005,16 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) $db->begin(); + $reg = array(); if (preg_match('/MAIN_MODULE_(.*)_'.strtoupper($key).'/i', $constantname, $reg)) { $name=strtolower($reg[1]); - if ($name) // And entry for key $key and module $name was found in database. + if ($name) // An entry for key $key and module $name was found in database. { + $reloffile = ''; + $result = 'found'; + if ($key == 'hooks') $reloffile=$name.'/class/actions_'.$name.'.class.php'; if ($key == 'js') { @@ -953,13 +1031,17 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) $reloffile=preg_replace('/^\//', '', $valuearray[0]); } - //var_dump($key.' - '.$value.' - '.$reloffile); - try { - $result = dol_buildpath($reloffile, 0, 2); - } - catch(Exception $e) + if ($reloffile) { - // No catch yet + //var_dump($key.' - '.$value.' - '.$reloffile); + try { + $result = dol_buildpath($reloffile, 0, 2); + } + catch(Exception $e) + { + // No catch yet + $result = 'found'; // If error, we force lke if we found to avoid any deletion + } } if (! $result) @@ -967,7 +1049,7 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) print ' - File of '.$key.' ('.$reloffile.') NOT found, we disable the module.'; if (GETPOST('force_disable_of_modules_not_found') == 'confirmed') { - $sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'MAIN_MODULE_".strtoupper($name)."_".strtoupper($key)."'"; + $sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name 'MAIN_MODULE_".strtoupper($name)."_".strtoupper($key)."'"; $resql2=$db->query($sql2); if (! $resql2) { diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 0cb8fe68c5a..c37dee6570a 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -366,7 +366,7 @@ if (! $error && $db->connected && $action == "set") print "'; - // insurance amount + // Insurance amount print ''; // Project @@ -707,7 +707,9 @@ if ($id > 0) $total_insurance = 0; $total_interest = 0; $total_capital = 0; - print '

*** Clean module_parts entries of modules not enabled
Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we delete record
Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)
Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record

*** Force modules not found to be disabled (only modules adding js, css or hooks can be detected as removed)

*** Force modules not found physicaly to be disabled (only modules adding js, css or hooks can be detected as removed physicaly)
"; print $langs->trans("ErrorDirDoesNotExists", $main_dir).'
'; - print $langs->trans("ErrorWrongValueForParameter", $langs->trans("WebPagesDirectory")).'
'; + print $langs->trans("ErrorWrongValueForParameter", $langs->transnoentitiesnoconv("WebPagesDirectory")).'
'; print $langs->trans("ErrorGoBackAndCorrectParameters").'

'; print '
'; print $langs->trans("Error"); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 25b8f8d11aa..20b9862e187 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -292,6 +292,7 @@ Modelcsv_agiris=Export for Agiris Modelcsv_openconcerto=Export for OpenConcerto (Test) Modelcsv_configurable=Export CSV Configurable Modelcsv_FEC=Export FEC (Art. L47 A) +Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland ChartofaccountsId=Chart of accounts Id ## Tools - Init accounting account on product / service diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e0c2afd7e34..5fc1994247c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1889,4 +1889,5 @@ IFTTT_SERVICE_KEY=IFTTT Service key IFTTT_DOLIBARR_ENDPOINT_SECUREKEY=Security key to secure the endpoint URL used by IFTTT to send messages to your Dolibarr. IFTTTDesc=This module is designed to trigger events on IFTTT and/or to execute some action on external IFTTT triggers. UrlForIFTTT=URL endpoint for IFTTT -YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account \ No newline at end of file +YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account +EndPointFor=End point for %s : %s \ No newline at end of file diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index b3084a7557c..1367e721ce8 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -126,4 +126,5 @@ HolidaySetup=Setup of module Holiday HolidaysNumberingModules=Leave requests numbering models TemplatePDFHolidays=Template for leave requests PDF FreeLegalTextOnHolidays=Free text on PDF -WatermarkOnDraftHolidayCards=Watermarks on draft leave requests \ No newline at end of file +WatermarkOnDraftHolidayCards=Watermarks on draft leave requests +HolidaysToApprove=Holidays to approve \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index f91cbd8f1eb..fd74d0cae07 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -970,3 +970,6 @@ TMenuMRP=MRP ShowMoreInfos=Show More Infos NoFilesUploadedYet=Please upload a document first SeePrivateNote=See private note +PaymentInformation=Payment information +ValidFrom=Valid from +ValidUntil=Valid until \ No newline at end of file diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 299edcbb714..8b33117cc66 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -196,4 +196,5 @@ EmailSentToMember=Email sent to member at %s SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subscription SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5') MembershipPaid=Membership paid for current period (until %s) -YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email \ No newline at end of file +YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email +XMembersClosed=%s member(s) closed \ No newline at end of file diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index c3f75301f67..cc55c7ba10a 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -68,6 +68,7 @@ PageForLib=File for PHP library PageForObjLib=File for PHP library dedicated to object SqlFileExtraFields=Sql file for complementary attributes SqlFileKey=Sql file for keys +SqlFileKeyExtraFields=Sql file for keys of complementary attributes AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case UseAsciiDocFormat=You can use Markdown format, but it is recommended to use Asciidoc format (omparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown) IsAMeasure=Is a measure diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 0d57c7ed4a7..c4bb9193a33 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -11,3 +11,5 @@ BOMsModelModule=BOMS document templates FreeLegalTextOnBOMs=Free text on document of BOM WatermarkOnDraftBOMs=Watermark on draft BOM ConfirmCloneBillOfMaterials=Are you sure you want to clone this bill of material ? +ManufacturingEfficiency=Manufacturing efficiency +ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang index 269242b910b..d3c26c8e65a 100644 --- a/htdocs/langs/en_US/paybox.lang +++ b/htdocs/langs/en_US/paybox.lang @@ -37,3 +37,4 @@ PAYBOX_PAYONLINE_SENDEMAIL=Email notification after payment attempt (success or PAYBOX_PBX_SITE=Value for PBX SITE PAYBOX_PBX_RANG=Value for PBX Rang PAYBOX_PBX_IDENTIFIANT=Value for PBX ID +PAYBOX_HMAC_KEY=HMAC key \ No newline at end of file diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 9d70262a519..6a2d7e89cb7 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -268,7 +268,8 @@ TicketPublicInterfaceForbidden=The public interface for the tickets was not enab ErrorEmailOrTrackingInvalid=Bad value for tracking ID or email OldUser=Old user NewUser=New user - +NumberOfTicketsByMonth=Number of tickets per month +NbOfTickets=Number of tickets # notifications TicketNotificationEmailSubject=Ticket %s updated TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 4655bf3493a..43f82e9f1fb 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -97,4 +97,7 @@ ThisPageHasTranslationPages=This page/container has translation NoWebSiteCreateOneFirst=No website has been created yet. Create one first. GoTo=Go to DynamicPHPCodeContainsAForbiddenInstruction=You add dynamic PHP code that contains the PHP instruction '%s' that is forbidden by default as dynamic content (see hidden options WEBSITE_PHP_ALLOW_xxx to increase list of allowed commands). -NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified. \ No newline at end of file +NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified. +ReplaceWebsiteContent=Replace website content +DeleteAlsoJs=Delete also all javascript files specific to this website? +DeleteAlsoMedias=Delete also all medias files specific to this website? \ No newline at end of file diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index bb2b69f63f2..e826e86ea57 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -302,7 +302,7 @@ if ($action == 'create') // Rate print '
'.$langs->trans("Rate").' %
'.$langs->trans("Insurance").'
'; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; print ''; print ''; print ''; @@ -748,6 +750,8 @@ if ($id > 0) print ''; } print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").'
"; + print '
'; + $db->free($resql); } else diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index e4b51c2429a..80d8645293b 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -116,9 +116,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->loan->write) { - $newcardbutton=''.$langs->trans('NewLoan').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/loan/card.php?action=create'); } print '
'."\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4f7776a3150..b0d34db43eb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -91,7 +91,7 @@ function testSqlAndScriptInject($val, $type) } if ($type == 3) { - $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val); + $inj += preg_match('/select|update|delete|truncate|replace|group\s+by|concat|count|from|union/i', $val); } if ($type != 2) // Not common key strings, so we can check them both on GET and POST { @@ -1740,8 +1740,8 @@ function top_menu_user(User $user, Translate $langs) } else{ $nophoto='/public/theme/common/user_anonymous.png'; - if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png'; - if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; + if ($user->gender == 'man') $nophoto='/public/theme/common/user_man.png'; + if ($user->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; $userImage = 'No photo'; $userDropDownImage = 'No photo'; @@ -1811,11 +1811,11 @@ function top_menu_user(User $user, Translate $langs) $btnUser = '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f270167bce9..34dd5547f7b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -451,9 +451,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->projet->creer) { - $newcardbutton = ''.$langs->trans('NewProject').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create'); } print ''; @@ -657,7 +655,7 @@ if (! empty($arrayfields['p.fk_statut']['checked'])) print ''; } // Action column -print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index e7e06e93352..cfacde6566b 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -264,7 +264,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/projet/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT . '/projet/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; @@ -282,9 +282,7 @@ print ''; print ''; // Company print ''; // User /*print ''; - print ''; + print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print ''; @@ -336,7 +334,7 @@ foreach ($data_all_year as $val) } print ''; - print ''; + print ''; print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 1375a7a4844..ccc8a0548c8 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -642,23 +642,18 @@ elseif ($id > 0 || ! empty($ref)) print '
'; - // Link to create task - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($object->public || $userWrite > 0) - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } - else - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } - } - else - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } +// Link to create task + $linktocreatetaskParam = array(); + $linktocreatetaskUserRight = false; + if ($user->rights->projet->all->creer || $user->rights->projet->creer) { + if ($object->public || $userWrite > 0){ + $linktocreatetaskUserRight = true; + }else{ + $linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject"); + } + } + $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); print ''; @@ -672,7 +667,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; $title=$langs->trans("ListOfTasks"); - $linktotasks=''.$langs->trans("GoToGanttView").''; + $linktotasks = dolGetButtonTitle($langs->trans('GoToGanttView'), '', 'fa fa-calendar-minus-o', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1'); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'title_generic.png'); @@ -767,7 +762,7 @@ elseif ($id > 0 || ! empty($ref)) if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; // Action column - print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 94ca4d436d5..b97710ba7b6 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -425,9 +425,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->projet->creer) { - $newcardbutton = ''.$langs->trans('NewTask').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'); } print ''; @@ -590,7 +588,7 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; } // Action column -print ''; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index 6a715f5030e..3cae0571e6a 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -146,9 +146,7 @@ print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; -if ($mode == 'customer') $filter='s.client in (1,2,3)'; -if ($mode == 'supplier') $filter='s.fournisseur = 1'; -print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); +print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
'.$langs->trans("ProjectCommercial").''; @@ -324,7 +322,7 @@ foreach ($data_all_year as $val) $oldyear--; print '
0?'&userid='.$userid:'').'">'.$oldyear.'0?'&userid='.$userid:'').'">'.$oldyear.'0
0?'&userid='.$userid:'').'">'.$year.'0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; print ''; // Company /*print ''; */ // User diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e8d7506c313..f3da816fabd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -579,31 +579,35 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } // Link to create time + $linktocreatetimeBtnStatus = 0; + $linktocreatetimeUrl = ''; + $linktocreatetimeHelpText = ''; if ($user->rights->projet->all->creer || $user->rights->projet->creer) { if ($projectstatic->public || $userWrite > 0) { + $linktocreatetimeBtnStatus = 1; + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project { $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); } else // We are on tab 'Time Spent' of task { $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); } } else { - $linktocreatetime = ''.$langs->trans('AddTime').''; + $linktocreatetimeBtnStatus = -2; + $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); } } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } + + $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); + } $massactionbutton = ''; if ($projectstatic->bill_time) diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index de928a95c50..7f3e3c947c5 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -51,7 +51,8 @@ dol_include_once("/cron/class/cronjob.class.php"); global $langs, $conf; // Language Management -$langs->loadLangs(array("admin", "cron")); +$langs->loadLangs(array("admin", "cron", "dict")); + @@ -59,6 +60,9 @@ $langs->loadLangs(array("admin", "cron")); * View */ +// current date +$now=dol_now(); + // Check the key, avoid that a stranger starts cron $key = GETPOST('securitykey', 'alpha'); if (empty($key)) @@ -84,15 +88,15 @@ $result=$user->fetch('', $userlogin); if ($result < 0) { echo "User Error:".$user->error; - dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_WARNING); + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); exit; } else { if (empty($user->id)) { - echo " User user login:".$userlogin." do not exists"; - dol_syslog(" User user login:".$userlogin." do not exists", LOG_WARNING); + echo " User login:".$userlogin." do not exists"; + dol_syslog(" User login:".$userlogin." do not exists", LOG_ERR); exit; } } @@ -103,8 +107,7 @@ $id = GETPOST('id', 'alpha'); // We accept non numeric id. We will filter later. $object = new Cronjob($db); $filter=array(); -if (! empty($id)) -{ +if (! empty($id)) { if (! is_numeric($id)) { echo "Error: Bad value for parameter job id"; @@ -118,7 +121,7 @@ $result = $object->fetch_all('ASC,ASC,ASC', 't.priority,t.entity,t.rowid', 0, 0, if ($result<0) { echo "Error: ".$object->error; - dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_WARNING); + dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_ERR); exit; } @@ -132,37 +135,76 @@ foreach($object->lines as $val) // TODO Duplicate code. This sequence of code must be shared with code into cron_run_jobs.php script. // current date -$now=dol_now(); $nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; $nbofjobslaunchedko=0; if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { - // Loop over job + $savconf = dol_clone($conf); + + // Loop over job foreach($qualifiedjobs as $line) { - dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_WARNING); + dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); + echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; - //If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database + // Force reload of setup for the current entity + if ($line->entity != $conf->entity) + { + dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG); + echo " -> we change entity so we reload user and conf"; + + $conf->entity = (empty($line->entity)?1:$line->entity); + $conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings + + // Force recheck that user is ok for the entity to process and reload permission for entity + if ($conf->entity != $user->entity && $user->entity != 0) + { + $result=$user->fetch('', $userlogin, '', 0, $conf->entity); + if ($result < 0) + { + echo "\nUser Error: ".$user->error."\n"; + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); + exit(-1); + } + else + { + if ($result == 0) + { + echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); + exit(-1); + } + } + $user->getrights(); + } + } + + //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { - dol_syslog("cron_run_jobs.php:: torun line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourtext')." line->dateend:".dol_print_date($line->dateend, 'dayhourtext')." now:".dol_print_date($now, 'dayhourtext')); + echo " - qualified"; + + dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); $cronjob=new Cronjob($db); $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error cronjob->fetch: ".$cronjob->error."
\n"; + echo "Error cronjobid: ".$line->id." cronjob->fetch: ".$cronjob->error."\n"; + echo "Failed to fetch job ".$line->id."\n"; dol_syslog("cron_run_jobs.php::fetch Error".$cronjob->error, LOG_ERR); exit; } - // Execut job + // Execute job $result=$cronjob->run_jobs($userlogin); if ($result < 0) { - echo "Error cronjob->run_job: ".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjobid: ".$line->id." cronjob->run_job: ".$cronjob->error."\n"; + echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; + echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); $nbofjobslaunchedko++; } else @@ -170,16 +212,30 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) $nbofjobslaunchedok++; } + echo " - result of run_jobs = ".$result; + // We re-program the next execution and stores the last execution time for this job $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error cronjob->reprogram_job: ".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n"; + echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); exit; } + + echo " - reprogrammed\n"; + } + else + { + echo " - not qualified\n"; + + dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); } } + + $conf = $savconf; + echo "Result: ".($nbofjobs)." jobs - ".($nbofjobslaunchedok+$nbofjobslaunchedko)." launched = ".$nbofjobslaunchedok." OK + ".$nbofjobslaunchedko." KO"; } else diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 6bdaa92f508..145df4f9e94 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -355,7 +355,7 @@ if ($action == 'dopayment') if ($paymentmethod == 'paybox') { $PRICE=price2num(GETPOST("newamount"), 'MT'); - $email=GETPOST("email", 'alpha'); + $email=$conf->global->ONLINE_PAYMENT_SENDEMAIL; $thirdparty_id=GETPOST('thirdparty_id', 'int'); $origfulltag=GETPOST("fulltag", 'alpha'); @@ -754,7 +754,7 @@ if (! empty($conf->paypal->enabled)) } if (! empty($conf->paybox->enabled)) { - + print ''."\n"; } if (! empty($conf->stripe->enabled)) { @@ -1943,241 +1943,249 @@ if (preg_match('/^dopayment/', $action)) print ''."\n"; - print ''."\n"; - - // Code to ask the credit card. This use the default "API version". No way to force API version when using JS code. - print ''."\n"; + + // Code to ask the credit card. This use the default "API version". No way to force API version when using JS code. + print ''; } - - '; } } diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index 94e77c3c4b5..cbffa3ef177 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -52,6 +52,7 @@ $langs->load("other"); $langs->load("companies"); + /* * View */ @@ -65,7 +66,7 @@ print load_fiche_titre($langs->trans("StatisticsOfReceptions"), $mesg); dol_mkdir($dir); -$stats = new ReceptionStats($db, $socid, $mode, ($userid>0?$userid:0)); +$stats = new ReceptionStats($db, $socid, '', ($userid>0?$userid:0)); // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); @@ -76,14 +77,10 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=receptionsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstatssupplier&file=receptionsnbinyear-'.$user->id.'-'.$year.'.png'; } else { $filenamenb = $dir.'/receptionsnbinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=receptionsnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstatssupplier&file=receptionsnbinyear-'.$year.'.png'; } $px1 = new DolGraph(); @@ -122,14 +119,10 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenameamount = $dir.'/receptionsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=receptionsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstatssupplier&file=receptionsamountinyear-'.$user->id.'-'.$year.'.png'; } else { $filenameamount = $dir.'/receptionsamountinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=receptionsamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstatssupplier&file=receptionsamountinyear-'.$year.'.png'; } $px2 = new DolGraph(); @@ -165,14 +158,10 @@ $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filename_avg = $dir.'/receptionsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=receptionsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstatssupplier&file=receptionsaverage-'.$user->id.'-'.$year.'.png'; } else { $filename_avg = $dir.'/receptionsaverage-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=receptionsaverage-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstatssupplier&file=receptionsaverage-'.$year.'.png'; } $px3 = new DolGraph(); @@ -215,7 +204,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; @@ -234,15 +223,13 @@ print '
'; //{ // Show filter box print '
'; - print ''; + print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; -if ($mode == 'customer') $filter='s.client in (1,2,3)'; -if ($mode == 'supplier') $filter='s.fournisseur = 1'; -print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"'); +print $form->select_company($socid,'socid','',1,0,0,array(),0,'','style="width: 95%"'); print '
'; print ''; // Company print ''; // User print ''; - print ''; + print ''; print ''; /*print ''; @@ -289,7 +276,7 @@ foreach ($data as $val) print ''; print ''; print ''; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 290d07ab857..7adec8e6009 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -408,6 +408,7 @@ class Dolresource extends CommonObject public function delete($rowid, $notrigger = 0) { global $user,$langs,$conf; + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $error=0; @@ -841,6 +842,8 @@ class Dolresource extends CommonObject */ public function getElementResources($element, $element_id, $resource_type = '') { + $resources=array(); + // Links beetween objects are stored in this table $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources'; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 45cf1e9d997..6765d2d7147 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -197,10 +197,8 @@ if($ret == -1) { $newcardbutton=''; if ($user->rights->resource->write) { - $newcardbutton=''.$langs->trans('MenuResourceAdd').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('MenuResourceAdd'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/resource/card.php?action=create'); + } print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); } @@ -226,7 +224,7 @@ if (! empty($arrayfields['ty.label']['checked'])) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Action column -print ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 4a614c02312..d07ddfc2b4f 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -404,7 +404,7 @@ foreach ($dirsociete as $dirroot) $disabled = false; if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); print ''; @@ -478,7 +478,7 @@ foreach ($dirsociete as $dirroot) } else { - print ''; } @@ -813,12 +813,12 @@ print ''; print ''; @@ -830,12 +830,12 @@ print ''; print ''; @@ -849,12 +849,12 @@ print ''; print ''; @@ -867,12 +867,12 @@ print ''; print ''; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 18e1890c485..a9283f6e236 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -127,7 +127,7 @@ if ($socid > 0) print '
'; $object->info($socid); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; @@ -162,9 +162,7 @@ if ($socid > 0) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - $newcardbutton.=''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index 4323a4c57ac..acf10428717 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -81,7 +81,7 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) if (! empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql.=" OR rowid = '" . $db->escape($socid) . "'"; $sql.=")"; } - if (GETPOST("filter")) $sql.= " AND ".GETPOST("filter", "alpha"); // Add other filters + //if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters $sql.= " ORDER BY nom ASC"; //dol_syslog("ajaxcompanies", LOG_DEBUG); diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index a4a3d71a4a9..27aeca883cc 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -131,7 +131,7 @@ class ActionsCardCompany extends ActionsCardCommon if ($conf->use_javascript_ajax) { $s.=''.$langs->trans("VATIntraCheck").''; - $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { @@ -170,7 +170,7 @@ class ActionsCardCompany extends ActionsCardCommon if ($conf->use_javascript_ajax) { $s.=''.$langs->trans("VATIntraCheck").''; - $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 292d109fd74..d55ea537297 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -126,7 +126,7 @@ if (empty($reshook)) { $langs->load('errors'); $langs->load('companies'); - setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); + setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv('MergeOriginThirdparty')), null, 'errors'); } else { @@ -1207,7 +1207,7 @@ else { // Supplier print ''; - print '\n"; print ''; print ''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 37676f1b1e1..83f4aefb5f5 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -84,7 +84,7 @@ if ($resql) { if ($paycode == 'CB') $paycode = 'CB'; if ($paycode == 'CHQ') $paycode = 'CHEQUE'; - $accountname="CASHDESK_ID_BANKACCOUNT_".$paycode; + $accountname="CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"]; if (! empty($conf->global->$accountname) && $conf->global->$accountname > 0) array_push($paiements, $obj); } } diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 9601c6d0f36..c0a37881cf9 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -573,8 +573,12 @@ $( document ).ready(function() { LoadProducts(0); Refresh(); global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="") print "TerminalsDialog();"; + //IF NO TERMINAL SELECTED + if ($_SESSION["takeposterminal"]=="") + { + if ($conf->global->TAKEPOS_NUM_TERMINALS=="1") $_SESSION["takeposterminal"]=1; + else print "TerminalsDialog();"; + } ?> }); @@ -624,7 +628,7 @@ if ($resql){ if ($paycode == 'CB') $paycode = 'CARD'; if ($paycode == 'CHQ') $paycode = 'CHEQUE'; - $accountname="CASHDESK_ID_BANKACCOUNT_".$paycode; + $accountname="CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"]; if (! empty($conf->global->$accountname) && $conf->global->$accountname > 0) array_push($paiementsModes, $obj); } } diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index ab4be871d7c..984315b0bde 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -23,8 +23,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> } .badge-pill, .tabs .badge { - padding-right: .6em; - padding-left: .6em; + padding-right: .5em; + padding-left: .5em; border-radius: 0.25rem; } diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php new file mode 100644 index 00000000000..c0cd029126d --- /dev/null +++ b/htdocs/theme/eldy/btn.inc.php @@ -0,0 +1,219 @@ + +/*
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; - if ($mode == 'customer') $filter='s.client in (1,2,3)'; - if ($mode == 'supplier') $filter='s.fournisseur = 1'; - print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); + print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print '
'.$langs->trans("CreatedBy").''; @@ -279,7 +266,7 @@ foreach ($data as $val) print '
'.$oldyear.''.$oldyear.'00
'; - if ($year) print ''.$year.''; + if ($year) print ''.$year.''; else print $langs->trans("ValidationDateNotDefinedEvenIfReceptionValidated"); print ''.$val['nb'].''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; - if (! $disabled) print ''; + if (! $disabled) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); if (! $disabled) print ''; print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ' '; if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print ' '; if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print ' '; if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print ' '; if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; + print ''.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).''; $default = -1; if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1; print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int')!=''?GETPOST('fournisseur', 'int'):(GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0)); @@ -1367,10 +1367,13 @@ else if (! empty($conf->use_javascript_ajax)) { + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; @@ -2028,15 +2031,18 @@ else if ($conf->use_javascript_ajax) { - print "\n"; + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; + print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { @@ -2213,7 +2219,7 @@ else 'name' => 'soc_origin', 'label' => $langs->trans('MergeOriginThirdparty'), 'type' => 'other', - 'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth200') + 'value' => $form->select_company('', 'soc_origin', 's.rowid <> '.$object->id, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth200') ) ); @@ -2437,15 +2443,18 @@ else if ($conf->use_javascript_ajax) { + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { @@ -2709,9 +2718,7 @@ else $MAXEVENT = 10; - $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; + $morehtmlright.= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id); // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index f5202d87b96..aaafc334e9e 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -54,6 +54,7 @@ if (! $vatNumber) else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); + $vatNumber = str_replace(array(' ', '.'), '', $vatNumber); $countryCode=substr($vatNumber, 0, 2); $vatNumber=substr($vatNumber, 2); @@ -162,7 +163,7 @@ else } print '
'; -print $langs->trans("VATIntraManualCheck", $langs->trans("VATIntraCheckURL"), $langs->trans("VATIntraCheckURL")).'
'; +print $langs->trans("VATIntraManualCheck", $langs->trans("VATIntraCheckURL"), $langs->transnoentitiesnoconv("VATIntraCheckURL")).'
'; print '
'; print '
'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4bec5fc6f49..84bda8abd54 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1642,7 +1642,7 @@ class Societe extends CommonObject $note=trim($note); if (! $note) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("NoteReason")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); return -2; } @@ -1705,7 +1705,7 @@ class Societe extends CommonObject $note=trim($note); if (! $note) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("NoteReason")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); return -2; } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index c16ef378bd0..afd3a51ec8e 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -114,7 +114,7 @@ dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'n print '
'; print '
'; -print ''; +print '
'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { @@ -396,7 +396,7 @@ if ($sql_select) print ''; print ''; - print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 42584c5621b..b0653c83962 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -35,6 +35,7 @@ require_once '../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; @@ -373,7 +374,7 @@ $sql.= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; $sql.= " s2.nom as name2,"; $sql.= " typent.code as typent_code,"; $sql.= " staff.code as staff_code,"; -$sql.= " country.code as country_code,"; +$sql.= " country.code as country_code, country.label as country_label,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " region.code_region as region_code, region.nom as region_name"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) @@ -581,9 +582,7 @@ if ($user->rights->societe->creer && $contextpage != 'poslist') if($type == 'f') $label='NewSupplier'; } - $newcardbutton = ''.$langs->trans($label).''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter); } print ''; @@ -991,6 +990,8 @@ while ($i < min($num, $limit)) $companystatic->fournisseur=$obj->fournisseur; $companystatic->code_client=$obj->code_client; $companystatic->code_fournisseur=$obj->code_fournisseur; + $companystatic->tva_intra=$obj->tva_intra; + $companystatic->country_code=$obj->country_code; $companystatic->code_compta_client=$obj->code_compta; $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; @@ -1093,8 +1094,8 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['country.code_iso']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -1168,7 +1169,13 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['s.tva_intra']['checked'])) { - print "\n"; + print "\n"; if (! $i) $totalarray['nbfield']++; } // Type diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index e2175142dd4..e37d7caf91f 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -800,7 +800,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $morehtmlright=''; if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { - $morehtmlright=''.$langs->trans("Add").''; + $morehtmlright.= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=createcard'); } print load_fiche_titre($langs->trans('StripePaymentModes').($stripeacc?' (Stripe connection with StripeConnect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); @@ -1162,7 +1162,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // List of bank accounts print '
'; - $morehtmlright=''.$langs->trans("Add").''; + $morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create'); print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, ''); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 76824ca0140..1476bb8ce75 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -545,7 +545,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; // Print the search button - print ''; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 08783fa16ad..0a345fc6369 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -87,7 +87,7 @@ if ($socid) print '
'; print '
'; - print '
'; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; - $tmparray=getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + $labelcountry=($obj->country_code && ($langs->trans("Country".$obj->country_code)!="Country".$obj->country_code))?$langs->trans("Country".$obj->country_code):$obj->country_label; + print $labelcountry; print '".$obj->tva_intra.""; + print $obj->tva_intra; + if ($obj->tva_intra && ! isValidVATID($companystatic)) + { + print img_warning("BadVATNumber", '', ''); + } + print " '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print '
'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 8f7c83dcef5..fa868de6e42 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -230,13 +230,9 @@ dol_fiche_end(); $newcardbutton = ''; if (! empty($conf->website->enabled)) { if (! empty($user->rights->societe->lire)) { - $newcardbutton .= '' . $langs->trans("AddWebsiteAccount").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } else { - $newcardbutton .= ''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $morehtmlright.= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id)); + } else { + $morehtmlright.= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); } } @@ -395,7 +391,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; @@ -445,7 +441,7 @@ while ($i < min($num, $limit)) $objectwebsiteaccount->id = $obj->rowid; foreach($objectwebsiteaccount->fields as $key => $val) { - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 2bc257e1f77..3966a3f439f 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -225,12 +225,12 @@ if (empty($conf->stripeconnect->enabled)) $endpoint->save(); if ($endpoint->status == 'enabled') { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; @@ -298,12 +298,12 @@ if (empty($conf->stripeconnect->enabled)) $endpoint->save(); if ($endpoint->status == 'enabled') { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index f52a846f4c2..56473959a39 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1083,7 +1083,7 @@ if ($action == 'create') print ''; } else { print ''; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d8e47dcb040..fe010c95e9c 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -388,10 +388,8 @@ if ($resql) $newcardbutton=''; if($user->rights->supplier_proposal->creer) { - $newcardbutton=''.$langs->trans('NewAskPrice').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create'); + } // Lignes des champs de filtre print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index b685d9e97d2..f331587723b 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -64,21 +64,6 @@ if (GETPOST('action', 'alpha') == 'set') $db->begin(); if (GETPOST('socid', 'int') < 0) $_POST["socid"]=''; - /* - $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity); - - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE", (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB", (GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - foreach($paiements as $modep) { - if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; - $name="CASHDESK_ID_BANKACCOUNT_".$modep->code; - $res = dolibarr_set_const($db, $name, (GETPOST($name, 'alpha') > 0 ? GETPOST($name, 'alpha') : ''), 'chaine', 0, '', $conf->entity); - } - $res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE", (GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", GETPOST('CASHDESK_NO_DECREASE_STOCK', 'alpha'), 'chaine', 0, '', $conf->entity); - */ - $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -270,82 +255,6 @@ print '
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; - print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); print ' '.$langs->trans("AddThirdParty").''; print '
'; print '
'; -/* -print ''; -print ''; -if (!$conf->global->TAKEPOS_NUM_TERMINALS || $conf->global->TAKEPOS_NUM_TERMINALS=="1") print ''; -else print ''; -print "\n"; - -print ''; -print ''; -if (! empty($conf->banque->enabled)) -{ - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - foreach($paiements as $modep) { - if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; - $name="CASHDESK_ID_BANKACCOUNT_".$modep->code; - print ''; - print ''; - } -} - -if (! empty($conf->stock->enabled)) -{ - - print ''; // Force warehouse (this is not a default value) - print ''; - - $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; - - - print ''; // Force warehouse (this is not a default value) - print ''; -} - -print '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Terminal").' 1'.$langs->trans("Value").'
'.$langs->trans("CashDeskThirdPartyForSell").''; -print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1, 3) AND s.status = 1', 1, 0, 0, array(), 0); -print '
'.$langs->trans("CashDeskBankAccountForSell").''; - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1); - print '
'.$langs->trans("CashDeskBankAccountForCheque").''; - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE, 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", 1); - print '
'.$langs->trans("CashDeskBankAccountForCB").''; - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1); - print '
'.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->libelle).''; - $cour=preg_match('|^LIQ.*|', $modep->code)?2:1; - $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1); - print '
'.$langs->trans("CashDeskDoNotDecreaseStock").''; - if (empty($conf->productbatch->enabled)) { - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1); - } - else - { - if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { - $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity); - } - print $langs->trans("Yes").'
'; - print ''.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').''; - } - print '
'.$langs->trans("CashDeskIdWareHouse").''; - if (! $disabled) - { - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled); - print ' ('.$langs->trans("Create").')'; - } - else - { - print ''.$langs->trans("StockDecreaseForPointOfSaleDisabled").''; - } - print '
'; -print '
'; -*/ - print '
'; print "\n"; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 66a8a90f528..2b29f46120d 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -127,7 +127,7 @@ print "
'.$langs->trans("CashDeskThirdPartyForSell").''; -print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', 's.client in (1, 3) AND s.status = 1', 1, 0, 0, array(), 0); +print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0); print '