diff --git a/ChangeLog b/ChangeLog index 06f749cbc34..54244427b81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -176,7 +176,8 @@ Following changes may create regressions for some external modules, but were nec * 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 f007d4f8299..0193d9c1f75 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -297,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 ''; @@ -389,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/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/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index b9339a8150b..1ef500fcf6b 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; @@ -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,157 @@ 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 +928,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 trucate 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..0a0943fe13d 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 $limittochartaccount '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 5b2c3e912dd..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 ''; 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/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 1a5c368f177..650a466140c 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -281,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/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..160e8b079e8 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")); 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 d67936edfb5..14cb63cd923 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -384,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 ''; @@ -439,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 574f061b25d..8e8482d4398 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -306,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/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/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index a1db711dd3e..a4bf134e3ce 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -23,25 +23,12 @@ */ // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/bom/lib/bom.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 @@ -196,7 +183,7 @@ if ($object->id > 0) print '
'; $object->info($object->id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print '
'; 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..a2aabaeb81b --- /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/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 'trans('ManufacturingEfficiency'); ?> 
+ + 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 ''; print ''; $client = true; @@ -111,8 +110,7 @@ if ($socid > 0) { else { print ''; print ''; } diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 78d0716f9bf..09db1c0362d 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -135,9 +135,9 @@ if ($id > 0 || ! empty($ref)) $sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,"; $sql.= " sum(d.total_ht) as selling_price,"; // may be negative or positive - $sql.= " IF(f.type = 2, -1, 1) * sum(d.qty) as qty,"; // not always positive in case of Credit note - $sql.= " IF(f.type = 2, -1, 1) * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note - $sql.= " IF(f.type = 2, -1, 1) * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note + $sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty) as qty,"; // not always positive in case of Credit note + $sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note + $sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 21fb23f017c..e2ab8d964a3 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -163,7 +163,10 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); + dol_delete_file($destdir.'/test/phpunit/MyObjectFunctionnalTest.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); + dol_delete_file($destdir.'/test/phpunit'); + dol_delete_file($destdir.'/test'); dol_delete_file($destdir.'/sql/llx'.strtolower($modulename).'_myobject.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql'); @@ -223,6 +226,9 @@ if ($dirins && $action == 'initmodule' && $modulename) if ($dirins && $action == 'initapi' && !empty($module)) { + $modulename = ucfirst($module); // Force first letter in uppercase + $objectname = $tabobj; + dol_mkdir($dirins.'/'.strtolower($module).'/class'); $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $srcfile = $srcdir.'/class/api_mymodule.class.php'; @@ -232,9 +238,6 @@ if ($dirins && $action == 'initapi' && !empty($module)) if ($result > 0) { - $modulename = ucfirst($module); // Force first letter in uppercase - $objectname = $tabobj; - //var_dump($phpfileval['fullname']); $arrayreplacement=array( 'mymodule'=>strtolower($modulename), @@ -254,6 +257,46 @@ if ($dirins && $action == 'initapi' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } } + +if ($dirins && $action == 'initphpunit' && !empty($module)) +{ + $modulename = ucfirst($module); // Force first letter in uppercase + $objectname = $tabobj; + + dol_mkdir($dirins.'/'.strtolower($module).'/class'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/test/phpunit/MyObjectTest.php'; + $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php'; + $result = dol_copy($srcfile, $destfile, 0, 0); + /*$srcfile = $srcdir.'/test/phpunit/MyModuleFunctionnalTest.class.php'; + $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($module).'FunctionnalTest.class.php'; + $result = dol_copy($srcfile, $destfile, 0, 0);*/ + if ($result > 0) + { + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + 'myobject'=>strtolower($objectname), + 'MyObject'=>$objectname, + 'MYOBJECT'=>strtoupper($objectname), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); + + dolReplaceInFile($destfile, $arrayreplacement); + } + else + { + + } +} + if ($dirins && $action == 'inithook' && !empty($module)) { dol_mkdir($dirins.'/'.strtolower($module).'/class'); @@ -518,7 +561,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) dol_mkdir($destdir.'/lib'); dol_mkdir($destdir.'/scripts'); dol_mkdir($destdir.'/sql'); - dol_mkdir($destdir.'/test/phpunit'); // Scan dir class to find if an object with same name already exists. if (! $error) @@ -548,7 +590,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', 'myobject_list.php'=>strtolower($objectname).'_list.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', + //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', @@ -912,7 +954,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) 'myobject_list.php'=>strtolower($objectname).'_list.php', 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', @@ -1161,9 +1203,11 @@ print load_fiche_titre($text, '', 'title_setup'); print ''.$langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').'
'; $dirsrootforscan=array($dirread); -if ($dirread != DOL_DOCUMENT_ROOT && $conf->global->MAIN_FEATURES_LEVEL >=2) { $dirsrootforscan[]=DOL_DOCUMENT_ROOT; } +// Add also the core modules into the list of modules to show/edit +if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >=2 || ! empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) { $dirsrootforscan[]=DOL_DOCUMENT_ROOT; } // Search modules to edit +print ''."\n"; $listofmodules=array(); foreach($dirsrootforscan as $dirread) { @@ -1803,17 +1847,17 @@ elseif (! empty($module)) $pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php'; $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; $pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php'; - $pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php'; + $pathtophpunit = strtolower($module).'/test/phpunit/'.strtolower($tabobj).'Test.php'; $pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql'; $pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'_extrafields.sql'; $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.key.sql'; + $pathtosqlextrakey = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'_extrafields.key.sql'; $pathtolib = strtolower($module).'/lib/'.strtolower($module).'.lib.php'; $pathtoobjlib = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php'; $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; $pathtoscript = strtolower($module).'/scripts/'.strtolower($tabobj).'.php'; //var_dump($pathtolib); - $realpathtoclass = dol_buildpath($pathtoclass, 0, 2); $realpathtoapi = dol_buildpath($pathtoapi, 0, 2); $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 2); @@ -1825,11 +1869,18 @@ elseif (! empty($module)) $realpathtosql = dol_buildpath($pathtosql, 0, 2); $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 2); $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 2); + $realpathtosqlextrakey = dol_buildpath($pathtosqlextrakey, 0, 2); $realpathtolib = dol_buildpath($pathtolib, 0, 2); $realpathtoobjlib = dol_buildpath($pathtoobjlib, 0, 2); $realpathtopicto = dol_buildpath($pathtopicto, 0, 2); $realpathtoscript = dol_buildpath($pathtoscript, 0, 2); + if (empty($realpathtoapi)) // For compatibility with some old modules + { + $pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'s.class.php'; + $realpathtoapi = dol_buildpath($pathtoapi, 0, 2); + } + print '
'; print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass?'':'').$pathtoclass.($realpathtoclass?'':'').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; @@ -1855,9 +1906,21 @@ elseif (! empty($module)) //print ''.$langs->trans("FileNotYetGenerated").' '; print ''; } + // PHPUnit print '
'; print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit?'':'').$pathtophpunit.($realpathtophpunit?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + + if ($realpathtophpunit) + { + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '   '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + } + else + { + //print ''.$langs->trans("FileNotYetGenerated").' '; + print ''; + } print '
'; print '
'; @@ -1887,6 +1950,10 @@ elseif (! empty($module)) print ' '.img_picto($langs->trans("Edit"), 'edit').''; //print '   '.$langs->trans("RunSql").''; print '
'; + print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.($realpathtosqlextrakey?'':'').$pathtosqlextrakey.($realpathtosqlextrakey?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + //print '   '.$langs->trans("RunSql").''; + print '
'; print '
'; print '
'; @@ -1903,12 +1970,27 @@ elseif (! empty($module)) print '
'; print ' '.$langs->trans("PageForAgendaTab").' : '.($realpathtoagenda?'':'').$pathtoagenda.($realpathtoagenda?'':'').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; + if ($realpathtoagenda) + { + print '   '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + } print '
'; print ' '.$langs->trans("PageForDocumentTab").' : '.($realpathtodocument?'':'').$pathtodocument.($realpathtodocument?'':'').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; + if ($realpathtodocument) + { + print '   '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + } print '
'; print ' '.$langs->trans("PageForNoteTab").' : '.($realpathtonote?'':'').$pathtonote.($realpathtonote?'':'').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; + if ($realpathtonote) + { + print '   '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + } print '
'; /* This is already on Tab CLI diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index a434833c792..fea88479abf 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -119,7 +119,7 @@ else { if (! empty($arrayofparameters)) { - 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/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d2012870a31..6a5f333492e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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/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/card.php b/htdocs/comm/mailing/card.php index 34ed7708e9e..9f31e8f64c1 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -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 ''; @@ -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 7e058819771..da74efaaf98 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -191,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/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 '
'; print ''; // Company print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 68c0ada46df..cf059f1cdf1 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -877,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'])) @@ -906,7 +906,7 @@ if ($resql) } if (! empty($arrayfields['balance']['checked'])) { - print ''; @@ -940,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); @@ -1337,7 +1337,7 @@ if ($resql) // Bank account if (! empty($arrayfields['ba.ref']['checked'])) { - print '\n"; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 8be0b075e40..537bd6aee66 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -223,7 +223,7 @@ if ($result) // Credit print ''; - print ''; 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 ''; @@ -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 ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 85b4e3bb728..722976890c0 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 = ''; + } } } @@ -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 ''; - 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 ''; diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 9fcb77d9b42..2b67b73c95b 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -134,7 +134,7 @@ if ($result) print ''; print ''; print ''; - print ''; 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 ''; 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 ''; 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 ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 1d6b08735a0..d735edd5840 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -187,7 +187,7 @@ if ($result) print ''; } print ''; - 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 6e093a934dd..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 ''; 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 ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 6749ac0a7f5..fa26c5ed30b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -693,8 +693,8 @@ if (! empty($arrayfields['p.import_key']['checked'])) print ''; } // Action column -print ''; @@ -783,7 +783,7 @@ while ($i < min($num, $limit)) // Name if (! empty($arrayfields['p.lastname']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -791,7 +791,7 @@ while ($i < min($num, $limit)) // Firstname if (! empty($arrayfields['p.firstname']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Job position 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 '
'.$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 "'; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; // print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; 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/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..28483dfbf2c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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(); } /** @@ -4627,7 +4632,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/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 401d12aec4b..11de8aa48a2 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -175,7 +175,7 @@ if ($resql) print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '  '; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '  '; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; -$searchpicto=$form->showFilterButtons(); +print ''; +$searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; print $contactstatic->getNomUrl(1, '', 0); print ''.$obj->firstname.''.$obj->firstname.'
'; + 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..a58a768eace 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 (! 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..ede8070405a 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,7 +3875,7 @@ 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')); + $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach($dirtpls as $reldir) { $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); @@ -3913,7 +3914,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); 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..22e9dbf663c 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) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e7d8742a3f5..f0b116a06fe 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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 =''; } } @@ -3649,9 +3649,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 +3675,7 @@ class Form $i = 0; if ($num) { - print ''; if ($useempty == 1 || ($useempty == 2 && $num > 1)) { print ''; @@ -5704,7 +5705,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.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 576aff4db66..f6efc4ec093 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -801,9 +801,10 @@ class FormFile // Show file name with link to download $out.= ''; 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 ''; $out.= 'trans("File").': '.$file["name"]); $out.= dol_trunc($file["name"], 150); $out.= ''."\n"; @@ -1830,7 +1831,7 @@ class FormFile print '' . 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/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/company.lib.php b/htdocs/core/lib/company.lib.php index e080cc89796..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; 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 f6e530ba8de..bce137d1e11 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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): '')); } /** @@ -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:'') ); @@ -8118,7 +8118,6 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $attr['aria-label'] = $label; } - if(empty($userRight)){ $attr['class'] = 'butActionRefused'; $attr['href'] = ''; @@ -8156,8 +8155,6 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = return '
<'.$tag.' '.$compiledAttributes.'>'.$html.'
'; } - - /** * Function dolGetButtonTitle : this kind of buttons are used in title in list * @@ -8269,3 +8266,18 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u 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)$/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/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/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..4728ec00dc2 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -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/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/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/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/don/list.php b/htdocs/don/list.php index f5cf23bceb7..1af11afca24 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -193,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/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index f8370efefaf..c2c4934c832 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -31,6 +31,7 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text + if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string $sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search); } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index db0d6a4897d..a34308432e4 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -155,7 +155,6 @@ if (empty($reshook) && is_array($extrafields->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/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/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 ''; */ // 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/fichinter/list.php b/htdocs/fichinter/list.php index bff598873ce..f8697fb52fc 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -433,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/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/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 fa13e329b0e..fe3deb6459b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -728,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..8028dff3855 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -877,6 +877,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)) 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 a93be6e096d..84e7b36c239 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -460,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/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'].'
'.$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 '
'; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; - -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/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/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 27449c9e9e9..075e95fb0bd 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, @@ -374,4 +383,5 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v 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); - \ No newline at end of file + +ALTER TABLE llx_ticket_extrafields ADD INDEX idx_ticket_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index a406229a0e4..4e559566817 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -23,6 +23,9 @@ 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, date_valid datetime, @@ -30,8 +33,6 @@ CREATE TABLE llx_bom_bom( 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_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/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/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/main.inc.php b/htdocs/main.inc.php index b0036b01ed4..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 { @@ -1811,11 +1811,11 @@ function top_menu_user(User $user, Translate $langs) $btnUser = '
'.$langs->trans('ThirdPartyName').''; - print $form->select_company($socid, 'socid', 'client=1 OR client=3', 1, 0, 0); - //$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid','client=1 OR client=3',1,0,1); + print $form->select_company($socid, 'socid', '(client=1 OR client=3)', 1, 0, 0); print '
'.$langs->trans('ThirdPartyName').''; - print $form->select_company(null, 'socid', 'client=1 OR client=3', 1, 0, 0); - //$form->form_thirdparty($_SERVER['PHP_SELF'],null,'socid','client=1 OR client=3',1,0,1); + print $form->select_company(null, 'socid', '(client=1 OR client=3)', 1, 0, 0); print '
'; + print '
'; print ''; foreach($arrayofparameters as $key => $val) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 27cda79aa84..c36debb9a12 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -60,7 +60,7 @@ class MyObject extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; - const STATUS_DISABLED = -1; + const STATUS_DISABLED = 9; /** @@ -99,13 +99,13 @@ class MyObject extends CommonObject 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>501), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501), //'date_validation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Canceled')), + 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', 9=>'Canceled')), ); /** @@ -541,8 +541,9 @@ class MyObject extends CommonObject { global $langs; //$langs->load("mymodule"); - $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) @@ -555,28 +556,23 @@ class MyObject 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'); } } @@ -644,6 +640,30 @@ class MyObject extends CommonObject $this->initAsSpecimenCommon(); } + /** + * Create an array of lines + * + * @return array|int array of lines if OK, <0 if KO + */ + public function getLinesArray() + { + $this->lines=array(); + + $objectline = new BOMLine($this->db); + $result = $objectline->fetchAll('', '', 0, 0, array('fk_myobject'=>$this->id)); + + if (is_numeric($result)) + { + $this->error = $this->error; + $this->errors = $this->errors; + return $result; + } + else + { + $this->lines = $result; + return $this->lines(); + } + } /** * Action executed by scheduler diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 924db3b8632..b536b264952 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -196,7 +196,7 @@ if ($object->id > 0) print '
'; $object->info($object->id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 212e86ca93c..3543722670d 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -223,7 +223,7 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; @@ -356,11 +356,66 @@ 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)) + { + // printObjectLines return void + $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); + + $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"; diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index d9542daf64f..55fcdc6f9eb 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -81,8 +81,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject'); // 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] . "/myobject/" . dol_sanitizeFileName($object->id); -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->ref); +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->ref); /* diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index e8efedcf075..d1e69a18cc4 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -413,12 +413,18 @@ 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', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -428,7 +434,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 ''; @@ -440,11 +446,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', 'price'))) $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', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; @@ -485,14 +491,14 @@ 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=''; + $cssforfield=(empty($val['css'])?'':$val['css']); if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; @@ -503,13 +509,7 @@ while ($i < min($num, $limit)) 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/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 3c761b930e3..abad76ce228 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -73,7 +73,7 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; - + if (! $error) { @@ -151,7 +151,7 @@ print ''; print ''; print ''; @@ -181,7 +181,8 @@ print ''; print ''; diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 7dca957e489..2d9eceb4a5f 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -78,15 +78,15 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) return -1; } + $conf->global->PAYBOX_HASH = 'sha512'; + // Definition des parametres vente produit pour paybox - $IBS_CMD=$TAG; + $IBS_CMD=$TAG; $IBS_TOTAL=$PRICE*100; // En centimes $IBS_MODE=1; // Mode formulaire $IBS_PORTEUR=$EMAIL; $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; // Format des parametres du get de validation en reponse (url a definir sous paybox) $IBS_TXT=' '; // Use a space - $IBS_BOUTPI=$langs->trans("Wait"); - //$IBS_BOUTPI=''; $IBS_EFFECTUE=$urlok; $IBS_ANNULE=$urlko; $IBS_REFUSE=$urlko; @@ -102,7 +102,9 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) $IBS_OUTPUT='E'; $PBX_SOURCE='HTML'; $PBX_TYPEPAIEMENT='CARTE'; - + $PBX_HASH = $conf->global->PAYBOX_HASH; + $PBX_TIME = dol_print_date(dol_now(), 'dayhourrfc', 'gmt'); + $msg = "PBX_IDENTIFIANT=".$PBX_IDENTIFIANT. "&PBX_MODE=".$IBS_MODE. "&PBX_SITE=".$IBS_SITE. @@ -122,11 +124,13 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) "&PBX_OUTPUT=".$IBS_OUTPUT. "&PBX_SOURCE=".$PBX_SOURCE. "&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT; - + "&PBX_HASH=".$PBX_HASH; + "&PBX_TIME=".$PBX_TIME; + $binKey = pack("H*", dol_decode($conf->global->PAYBOX_HMAC_KEY)); - - $hmac = strtoupper(hash_hmac('sha512', $msg, $binKey)); - + + $hmac = strtoupper(hash_hmac($PBX_HASH, $msg, $binKey)); + dol_syslog("Soumission Paybox", LOG_DEBUG); dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG); @@ -147,10 +151,12 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) dol_syslog("PBX_IDENTIFIANT: $PBX_IDENTIFIANT", LOG_DEBUG); dol_syslog("PBX_SOURCE: $PBX_SOURCE", LOG_DEBUG); dol_syslog("PBX_TYPEPAIEMENT: $PBX_TYPEPAIEMENT", LOG_DEBUG); + dol_syslog("PBX_HASH: $PBX_HASH", LOG_DEBUG); + dol_syslog("PBX_TIME: $PBX_TIME", LOG_DEBUG); header("Content-type: text/html; charset=".$conf->file->character_set_client); header("X-Content-Type-Options: nosniff"); - + print ''."\n"; print ''."\n"; print "\n"; @@ -182,6 +188,9 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) print ''."\n"; print ''."\n"; print ''."\n"; + print ''."\n"; + print ''."\n"; + // Footprint of parameters print ''."\n"; print ''."\n"; diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index b2491b74b72..aefcb50369a 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -149,12 +149,12 @@ print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 2efd3ab14f1..888863e5e66 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -143,7 +143,7 @@ if ($action == 'other') $value = GETPOST('activate_usesearchtoselectproduct', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value, 'chaine', 0, '', $conf->entity); - + $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); if ($value) { @@ -354,7 +354,7 @@ foreach ($dirproduct as $dirroot) $disabled = false; if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); print ''; diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 28b3c06ffa1..2ec5345009e 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -141,7 +141,7 @@ if ($id > 0 || $ref) print '
'; $object->info($object->id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2c8b70efbd1..847c6325b50 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -497,7 +497,7 @@ if (empty($reshook)) $originalId = $id; if ($object->id > 0) { - $object->ref = GETPOST('clone_ref'); + $object->ref = GETPOST('clone_ref', 'alphanohtml'); $object->status = 0; $object->status_buy = 0; $object->id = null; @@ -505,7 +505,8 @@ if (empty($reshook)) if ($object->check()) { - $id = $object->create($user); + $object->context['createfromclone'] = 'createfromclone'; + $id = $object->create($user); if ($id > 0) { if (GETPOST('clone_composition')) @@ -546,7 +547,7 @@ if (empty($reshook)) $object->fetch($id); } else - { + { $db->rollback(); if (count($object->errors)) { @@ -560,6 +561,8 @@ if (empty($reshook)) } } } + + unset($object->context['createfromclone']); } } else @@ -1966,7 +1969,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 260, 600); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 350, 600); } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index f27aac68eb4..a3b444db6b7 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - 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 '
'; print ''.$langs->trans("PAYBOX_HMAC_KEY").''; print ''; -print '
'.$langs->trans("Example").': 2 ('.$langs->trans("Test").')'; +print '
'.$langs->trans("Example").': 1A2B3C4D5E6F'; print '
'; print ''.$langs->trans("PAYBOX_CGI_URL_V2").''; print ''; -print '
'.$langs->trans("Example").': http://mysite/cgi-bin/modulev2_redhat72.cgi'; +print '
'.$langs->trans("Example").' (preprod): https://preprod-tpeweb.paybox.com/php/'; +print '
'.$langs->trans("Example").' (prod): https://tpeweb.paybox.com/php/'; print '
'; print $langs->trans("PaypalLiveEnabled").''; if (empty($conf->global->PAYPAL_API_SANDBOX)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'; - if (! $disabled) print ''; + if (! $disabled) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); if (! $disabled) print ''; print '
'; + print '
'; // Nature if ($object->type!=Product::TYPE_SERVICE) @@ -268,236 +268,223 @@ if ($id > 0 || ! empty($ref)) $nbofsubproducts=count($prodschild); // This include only first level of childs - // Number of parent virtual products - //print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct')); + print '
'; - //if (count($prodsfather) > 0) - //{ - print load_fiche_titre($langs->trans("ProductParentList"), '', ''); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (count($prodsfather) > 0) + print load_fiche_titre($langs->trans("ProductParentList"), '', ''); + + print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + if (count($prodsfather) > 0) + { + foreach($prodsfather as $value) { - $class='pair'; + $idprod= $value["id"]; + $productstatic->id=$idprod;// $value["id"]; + $productstatic->type=$value["fk_product_type"]; + $productstatic->ref=$value['ref']; + $productstatic->label=$value['label']; + $productstatic->entity=$value['entity']; - foreach($prodsfather as $value) - { - $idprod= $value["id"]; - $productstatic->id=$idprod;// $value["id"]; - $productstatic->type=$value["fk_product_type"]; - $productstatic->ref=$value['ref']; - $productstatic->label=$value['label']; - $productstatic->entity=$value['entity']; - - $class=($class=='impair')?'pair':'impair'; - print ''; - - print ''; - print ''; - print ''; - print ''; - } - } - else - { - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } - print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'.$langs->trans("None").'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'; - //} - + } + else + { + print ''; + print ''.$langs->trans("None").''; + print ''; + } + print ''; + print '
'; print '
'."\n"; - // Number of subproducts - //print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct')); + print '
'; - // List of subproducts - //if (count($prods_arbo) > 0) - //{ - $atleastonenotdefined=0; - print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); + $atleastonenotdefined=0; + print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); - print '
'; - print ''; - print ''; + print ''; + print ''; + print ''; - print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->stock->enabled)) print ''; - print ''; - print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->stock->enabled)) print ''; + print ''; + print ''; + print ''."\n"; - $class='pair'; - - $totalsell=0; - if (count($prods_arbo)) + $totalsell=0; + if (count($prods_arbo)) + { + foreach($prods_arbo as $value) { - foreach($prods_arbo as $value) + $productstatic->fetch($value['id']); + + if ($value['level'] <= 1) { - $productstatic->fetch($value['id']); + print ''; - if ($value['level'] <= 1) + $notdefined=0; + $nb_of_subproduct = $value['nb']; + + print ''; + print ''; + + // Best buying price + print ''; + print $langs->trans("BuyingPriceMinShort").': '; + if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0); + else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; } + } + print ''; - $notdefined=0; - $nb_of_subproduct = $value['nb']; + // For avoid a non-numeric value + $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); + $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); + $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - print ''; - print ''; + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $total+=$totalline; - // Best buying price - print ''; + print ''; - // For avoid a non-numeric value - $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); - $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); - $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - - $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); - $total+=$totalline; - - print ''; - - // Best selling price - $pricesell=$productstatic->price; - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - { - $pricesell='Variable'; - } - else - { - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; - } - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; // Real stock - - // Qty + IncDec - if ($user->rights->produit->creer || $user->rights->service->creer) - { - print ''; - print ''; - } - else{ - print ''; - print ''; - } - - print ''."\n"; + // Best selling price + $pricesell=$productstatic->price; + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + $pricesell='Variable'; } else { - $hide=''; - if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand - - $class=($class=='impair')?'pair':'impair'; - print ''; - - //$productstatic->ref=$value['label']; - $productstatic->ref=$value['ref']; - print ''; - print ''; - - // Best buying price - print ''; - print ''; - // Best selling price - print ''; - print ''; - - if (! empty($conf->stock->enabled)) print ''; // Real stock - print ''; - print ''; - - print ''."\n"; + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; } + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; // Real stock + + // Qty + IncDec + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''; + print ''; + } + else{ + print ''; + print ''; + } + + print ''."\n"; } - - print ''; - print ''; - print ''; - - // Minimum buying price - print ''; - - print ''; - - // Minimum selling price - print ''; - - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; - - print ''; + + //$productstatic->ref=$value['label']; + $productstatic->ref=$value['ref']; + print ''; + print ''; + + // Best buying price + print ''; + print ''; + // Best selling price + print ''; + print ''; + + if (! empty($conf->stock->enabled)) print ''; // Real stock + print ''; + print ''; + + print ''."\n"; } - print ''; - print ''."\n"; } - else + + print ''; + print ''; + print ''; + + // Minimum buying price + print ''; + + print ''; + + // Minimum selling price + print ''; + + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; + + print ''; - print ''; - print ''; - } - - print '
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; + if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) { - $class=($class=='impair')?'pair':'impair'; - print '
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; - if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) - { - print $langs->trans("BuyingPriceMinShort").': '; - if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0); - else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; } - } - print ''; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); + print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); - print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); - if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency); - else print $langs->trans($pricesell); - print ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation - print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); + if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency); + else print $langs->trans($pricesell); + print ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - print $langs->trans("TotalBuyingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); - print ''; - print $langs->trans("TotalSellingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); - print ' '; - if ($user->rights->produit->creer || $user->rights->service->creer) + else { - print ''; + $hide=''; + if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand + + print '
'; + for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation + print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print $langs->trans("TotalBuyingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); + print ''; + print $langs->trans("TotalSellingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); + print ' '; + if ($user->rights->produit->creer || $user->rights->service->creer) { - $colspan=8; - if (! empty($conf->stock->enabled)) $colspan++; - - print '
'.$langs->trans("None").'
'; - - /*if($user->rights->produit->creer || $user->rights->service->creer) { print ''; - }*/ + } + print ''; + print ''."\n"; + } + else + { + $colspan=8; + if (! empty($conf->stock->enabled)) $colspan++; + + print ''; + print ''.$langs->trans("None").''; + print ''; + } + + print ''; + + /*if($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + }*/ + + print '
'; + print '
'; + - print ''; - //} // Form with product to add if ((empty($action) || $action == 'view' || $action == 'edit' || $action == 'search' || $action == 're-edit') && ($user->rights->produit->creer || $user->rights->service->creer)) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 6d43e4d4a3f..dbcdec666e3 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -440,7 +440,7 @@ if ($id > 0 || $ref) { $events=array(); $events[]=array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php', 1), 'htmlname' => 'tva_tx', 'params' => array()); - print $form->select_company(GETPOST("id_fourn"), 'id_fourn', 'fournisseur=1', 'SelectThirdParty', 0, 0, $events); + print $form->select_company(GETPOST("id_fourn", 'alpha'), 'id_fourn', 'fournisseur=1', 'SelectThirdParty', 0, 0, $events); $parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$object->id); $reshook=$hookmanager->executeHooks('formCreateThirdpartyOptions', $parameters, $object, $action); diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 58b34b6e8ea..7d097b6ecac 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -380,7 +380,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 ''; @@ -430,7 +430,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/product/list.php b/htdocs/product/list.php index 688fef19654..93bcb936e98 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -676,7 +676,7 @@ if ($resql) print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1); print ''; } - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f6efc0296b1..5b5b9ad48fa 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1666,7 +1666,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print '' . $langs->trans('ThirdParty') . ''; print ''; - print $form->select_company('', 'socid', 's.client in (1,2,3)', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); + print $form->select_company('', 'socid', 's.client IN (1,2,3)', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); print ''; print ''; @@ -1989,7 +1989,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ' '; // Print the search button - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f8800aabc38..476fec36c2a 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -297,7 +297,7 @@ if ($resql) print ' '; print ' '; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 5142b05b4c4..faf91184dd1 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -293,7 +293,7 @@ if ($resql) print ' '; print ' '; print ' '; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -388,7 +388,7 @@ if ($resql) //print ''.$objp->desiredstock.''; // Warehouse - print ''; + print ''; if ($objp->fk_entrepot > 0) { print $warehousetmp->getNomUrl(1); @@ -396,7 +396,7 @@ if ($resql) print ''; // Lot - print ''; + print ''; if ($product_lot_static->batch) { print $product_lot_static->getNomUrl(1); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index e36312e196c..b9876bdf36a 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -177,7 +177,7 @@ if ($result) print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 7983c1d2547..b75042c7cca 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -904,7 +904,7 @@ if ($resql) print ''; } // Actions - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 183927af207..836bb97e50c 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -880,7 +880,7 @@ if ($resql) print ''; } // Actions - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index ae127bb03b6..d0d7b5da8e6 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -368,7 +368,7 @@ if ($resql) print ''; }*/ // Action column - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ''; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 0de9fa76786..069be8aca96 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -562,12 +562,12 @@ print ' '; print '' . $langs->trans('AlertOnly') . ' '; print '' . $langs->trans('IncludeAlsoDraftOrders') . ' '; print ' '; -print ''; // Fields from hook $parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index ca4663bd43e..4e76f954717 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -405,7 +405,7 @@ foreach ($dirmodels as $reldir) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -506,7 +506,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8ebe6f71425..fc0a52e4f62 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -582,7 +582,7 @@ class Project extends CommonObject } elseif ($type == 'project_task') { - $sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet IN (". $ids .")"; + $sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt WHERE pt.fk_projet IN (". $ids .")"; } elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user { diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 1e8efc15581..34dd5547f7b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -655,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 c7053bc7079..ccc8a0548c8 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -762,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 4a6d2633354..b97710ba7b6 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -588,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/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 7eea7e45df6..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)) { 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/list.php b/htdocs/resource/list.php index 3e613c3d99c..6765d2d7147 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -224,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 2bf407ec88d..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 ''; 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/card.php b/htdocs/societe/card.php index 0cf2ae21790..9c688c19c99 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -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,10 +2031,13 @@ 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"; @@ -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,10 +2443,13 @@ else if ($conf->use_javascript_ajax) { + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index f5202d87b96..021a932f388 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); 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 '
'.$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 '
'; +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 13f179b99cc..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) @@ -989,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; @@ -1091,8 +1094,8 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['country.code_iso']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -1166,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/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 6b4a85f28c8..fa868de6e42 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -391,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 ''; @@ -441,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/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 "\n"; print ''.$langs->trans("CashDeskThirdPartyForSell").''; print ''; -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 ''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index dd2d6524f46..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();"; + } ?> }); 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 index 927c92c5f41..f95940a61a0 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -70,6 +70,8 @@ border-bottom-left-radius: 0 !important;*/ } a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } +a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } +a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } .butAction:hover { -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index 50a042d1390..b20db935154 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -1,9 +1,9 @@ -/*