diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index b6d526bf8e1..881b5b1a6a4 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -191,6 +191,7 @@ 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 32c6e50018e..74d6bf700bb 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -271,6 +271,7 @@ 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 dbb8e0d1310..181bdb4ded4 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -188,6 +188,7 @@ 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 aa810a737b9..1410e5097cf 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -199,6 +199,7 @@ 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/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index e9641ac6816..e261895b617 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -48,7 +48,7 @@ if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.i if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only -if (! $res) die ("Failed to include master.inc.php file\n"); +if (! $res) die("Failed to include master.inc.php file\n"); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 606bdbe6f56..53ae2251f35 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -43,7 +43,7 @@ if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.i if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only -if (! $res) die ("Failed to include master.inc.php file\n"); +if (! $res) die("Failed to include master.inc.php file\n"); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 6098a0e0139..296c6cb9b6f 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -428,5 +428,6 @@ - + + diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php new file mode 100644 index 00000000000..8093a2fa883 --- /dev/null +++ b/htdocs/accountancy/admin/closure.php @@ -0,0 +1,137 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * \file htdocs/accountancy/admin/closure.php + * \ingroup Advanced accountancy + * \brief Setup page to configure accounting expert module + */ +require '../../main.inc.php'; + +// Class +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("compta","admin","accountancy")); + +// Security check +if (empty($user->rights->accounting->chartofaccount)) +{ + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); + + +$list_account_main = array ( + 'ACCOUNTING_RESULT_PROFIT', + 'ACCOUNTING_RESULT_LOSS' +); + +/* + * Actions + */ + +if ($action == 'update') { + $error = 0; + + $defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha'); + + if (! empty($defaultjournal)) { + if (! dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) { + $error ++; + } + } else { + $error ++; + } + + foreach ($list_account_main as $constname) { + $constvalue = GETPOST($constname, 'alpha'); + + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error ++; + } + } + + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$form = new Form($db); +$formaccounting = new FormAccounting($db); + +llxHeader(); + +$linkback = ''; +print load_fiche_titre($langs->trans('MenuClosureAccounts'), $linkback, 'title_accountancy'); + +print $langs->trans("DefaultClosureDesc").'
'; +print '
'; + +print '
'; +print ''; +print ''; + +// Define main accounts for closure +print ''; + +foreach ($list_account_main as $key) { + + print ''; + // Param + $label = $langs->trans($key); + $keydesc=$key.'_Desc'; + + $htmltext = $langs->trans($keydesc); + print ''; + // Value + print ''; + print ''; +} + +// Journal +print ''; +print ''; +print ''; + +print "
'; + print $form->textwithpicto($label, $htmltext); + print ''; // Do not force align=right, or it align also the content of the select box + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); + print '
' . $langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL") . ''; +$defaultjournal=$conf->global->ACCOUNTING_CLOSURE_DEFAULT_JOURNAL; +print $formaccounting->select_journal($defaultjournal, "ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0); +print '
\n"; + +print '
'; + +print '
'; + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index b3b8a67241b..965b63ba9b9 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -144,6 +144,18 @@ if ($action == 'setenabledraftexport') { } } +if ($action == 'setenablesubsidiarylist') { + $setenablesubsidiarylist = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View */ @@ -251,6 +263,19 @@ if (! empty($user->admin)) } print ''; + print ''; + print '' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . ''; + if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; + print ''; print '' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 67ae907d9a4..bf2b8d4f948 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -173,17 +173,16 @@ while ($obj = $db->fetch_object($resql)) { $sql.= $db->plimit($limit+1, $offset); -dol_syslog ("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); +dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); $resql = $db->query($sql); -if (! $resql) -{ +if (! $resql) { dol_print_error($db); exit; } $num = $db->num_rows($resql); -dol_syslog ("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); +dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index bf425ffb992..010f452755d 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016-2017 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -661,13 +661,11 @@ class AccountancyCategory // extends CommonObject /** * Function to know all category from accounting account * - * @return array Result in table + * @return array|integer Result in table (array), -1 if KO */ public function getCatsCpts() { - global $mysoc,$conf; - - $sql = ""; + global $mysoc, $conf; if (empty($mysoc->country_id)) { dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); @@ -720,7 +718,7 @@ class AccountancyCategory // extends CommonObject * @param int|array $cpt Accounting account or array of accounting account * @param string $date_start Date start * @param string $date_end Date end - * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit + * @param int $sens Sens of the account: 0: credit - debit (use this by default), 1: debit - credit * @param string $thirdparty_code Thirdparty code * @param int $month Specifig month - Can be empty * @param int $year Specifig year - Can be empty @@ -805,7 +803,7 @@ class AccountancyCategory // extends CommonObject exit(); } - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " WHERE c.active = 1"; $sql .= " AND c.entity = " . $conf->entity; @@ -829,7 +827,8 @@ class AccountancyCategory // extends CommonObject 'label' => $obj->label, 'formula' => $obj->formula, 'position' => $obj->position, - 'category_type' => $obj->category_type + 'category_type' => $obj->category_type, + 'bc' => $obj->sens ); $i++; } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 873018cf6c9..6a7d59a46ce 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -456,7 +456,7 @@ if ($result) { if ($objp->country_sell == '1') { $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; - } elseif ($isinEEC == true) { + } elseif ($isinEEC === true) { $objp->code_sell_p = $objp->code_sell_intra; $objp->aarowid_suggest = $objp->aarowid_intra; } else { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c6434da6388..6bbc4ad9c62 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -633,12 +633,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)). '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -654,12 +654,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '""' . $sep; - print '"' . utf8_decode (dol_trunc($accountingaccount->label, 32)) . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -679,7 +679,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '""' . $sep; @@ -700,12 +700,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)). '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b9a2d15c5cd..9903255e52f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -305,6 +305,7 @@ if (empty($reshook)) $object->skype = trim(GETPOST("skype", 'alpha')); $object->twitter = trim(GETPOST("twitter", 'alpha')); $object->facebook = trim(GETPOST("facebook", 'alpha')); + $object->linkedin = trim(GETPOST("linkedin", 'alpha')); $object->birth = $birthdate; $object->typeid = GETPOST("typeid", 'int'); @@ -450,6 +451,7 @@ if (empty($reshook)) $skype=GETPOST("member_skype", 'alpha'); $twitter=GETPOST("member_twitter", 'alpha'); $facebook=GETPOST("member_facebook", 'alpha'); + $linkedin=GETPOST("member_linkedin", 'alpha'); $email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $login=GETPOST("member_login", 'alpha'); $pass=GETPOST("password", 'alpha'); @@ -479,6 +481,7 @@ if (empty($reshook)) $object->skype = $skype; $object->twitter = $twitter; $object->facebook = $facebook; + $object->linkedin = $linkedin; $object->email = $email; $object->login = $login; @@ -1029,6 +1032,12 @@ else print ''.$langs->trans("Facebook").''; } + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''.$langs->trans("LinkedIn").''; + } + // Birthday print "".$langs->trans("Birthday")."\n"; print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc'); @@ -1281,10 +1290,16 @@ else } // Facebook - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Facebook").'facebook).'">'; - } + if (! empty($conf->socialnetworks->enabled)) + { + print ''.$langs->trans("Facebook").'facebook).'">'; + } + + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''.$langs->trans("LinkedIn").'linkedin).'">'; + } // Birthday print "".$langs->trans("Birthday")."\n"; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 22429de9200..66ee5ee16f2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -137,6 +137,11 @@ class Adherent extends CommonObject */ public $facebook; + /** + * @var string linkedin account + */ + public $linkedin; + /** * @var string Phone number */ @@ -550,6 +555,7 @@ class Adherent extends CommonObject $sql.= ", skype = '".$this->db->escape($this->skype)."'"; $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; + $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); $sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); @@ -660,6 +666,7 @@ class Adherent extends CommonObject $luser->skype=$this->skype; $luser->twitter=$this->twitter; $luser->facebook=$this->facebook; + $luser->linkedin=$this->linkedin; $luser->office_phone=$this->phone; $luser->user_mobile=$this->phone_mobile; @@ -701,6 +708,7 @@ class Adherent extends CommonObject $lthirdparty->skype=$this->skype; $lthirdparty->twitter=$this->twitter; $lthirdparty->facebook=$this->facebook; + $lthirdparty->linkedin=$this->linkedin; $lthirdparty->phone=$this->phone; $lthirdparty->state_id=$this->state_id; $lthirdparty->country_id=$this->country_id; @@ -1189,7 +1197,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.skype, d.twitter, d.facebook, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; + $sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1266,6 +1274,7 @@ class Adherent extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->photo = $obj->photo; $this->statut = $obj->statut; @@ -2362,6 +2371,7 @@ class Adherent extends CommonObject $this->skype = 'skypepseudo'; $this->twitter = 'twitterpseudo'; $this->facebook = 'facebookpseudo'; + $this->linkedin = 'linkedinpseudo'; $this->phone = '0999999999'; $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; @@ -2469,8 +2479,9 @@ class Adherent extends CommonObject if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; if ($this->twitter && ! empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter; - if ($this->facebook && ! empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook; - if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; + if ($this->facebook && ! empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook; + if ($this->linkedin && ! empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin; + if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index c9ba17d2461..4a2d22e176d 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -151,14 +151,14 @@ print ""; print ""; print '"; -print '"; +print '"; print ""; // Show external agenda print ''; print ""; -print '"; print ''; print ""; -print '"; print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index f78cd42034c..ce9db532f21 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -225,10 +225,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; + print ''."\n"; + print ''."\n"; + print ''; + print ''; print ''."\n"; clearstatcache(); @@ -269,7 +269,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if (in_array($name, $def)) { - print '"; } // Default - print ''; - print ''; @@ -330,7 +330,7 @@ print ''; print '
'.$langs->trans("Parameter")."'.$langs->trans("Value")."'.$langs->trans("Value")."
".$langs->trans("ExtSitesEnableThisTool")."'; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1); @@ -181,7 +181,7 @@ print "
".$langs->trans("ExtSitesNbOfAgenda")."'; +print ''; print ''; print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { print 'scandir.'&label='.urlencode($module->name).'&type=action">'; @@ -284,13 +284,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -307,10 +307,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; print ''.img_object($langs->trans("Preview"), 'order').''; print '
'."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; @@ -338,7 +338,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; $htmltext=$langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup")); print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; } @@ -376,8 +376,8 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // AGENDA_DEFAULT_FILTER_TYPE print ''."\n"; print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; @@ -385,7 +385,7 @@ print ''."\n"; // TODO Remove to use the default generic feature print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index d92ce1ee213..3af179ba2e7 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -185,17 +185,17 @@ print ''; print '
'.$langs->trans("Parameters").'  '.$langs->trans("Value").'
'.$langs->trans("AGENDA_USE_EVENT_TYPE").'  '."\n"; //print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) @@ -355,7 +355,7 @@ print '
'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'  '."\n"; $tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); @@ -367,8 +367,8 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; print '
'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' '."\n"; + print ' '."\n"; $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; +print ' '."\n"; $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'  '."\n"; $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA REMINDER EMAIL -if ($conf->global->MAIN_FEATURES_LEVEL > 0) +if ($conf->global->MAIN_FEATURES_LEVEL == 2) { print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; $bankorder[0][0] = $langs->trans("BankOrderGlobal"); @@ -213,12 +213,12 @@ while ($i < $nbofbank) { print "\n"; if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) { - print ''; } else { - print ''; } @@ -263,10 +263,10 @@ print "
'.$langs->trans("Parameters").'  '.$langs->trans("Value").'
'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'  '."\n"; if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { @@ -208,11 +208,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) } // AGENDA REMINDER BROWSER -if ($conf->global->MAIN_FEATURES_LEVEL > 0) +if ($conf->global->MAIN_FEATURES_LEVEL == 2) { print '
'.$langs->trans('AGENDA_REMINDER_BROWSER').'  '."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { @@ -224,7 +224,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '
'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'  '."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 34becb49ada..9fc256540a2 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -183,8 +183,8 @@ print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Example") . '' . $langs->trans("Status") . ' ' . $langs->trans("Status") . ' 
'; + print ''; print img_picto($langs->trans("Activated"), 'on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'off'); print '
\n"; print "\n"; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -315,7 +315,7 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { - print ''; } else { - print '"; } // Default - print ''; // Preview - print ''; } - print '"; - print '"; print "\n"; @@ -444,14 +445,14 @@ function activitytrim($product_type) print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "' . $langs->trans("Default") . "' . $langs->trans("ShortInfo") . '' . $langs->trans("Preview") . '' . $langs->trans("Status") . "' . $langs->trans("Default") . "' . $langs->trans("ShortInfo") . '' . $langs->trans("Preview") . '
' . "\n"; + print '' . "\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); @@ -323,14 +323,14 @@ foreach ($dirmodels as $reldir) { print '' . "\n"; + print '' . "\n"; print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; print "'; + print ''; if ($conf->global->BANKADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -358,13 +358,13 @@ foreach ($dirmodels as $reldir) { // $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); //$htmltooltip .= '
' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print '' . img_object($langs->trans("Preview"), 'bill') . ''; @@ -404,7 +404,7 @@ print "\n"; print "\n"; print ''; print ''; -print '\n"; +print '\n"; print "\n"; print ''; // Active if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { - print '"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 92b1c73060d..e811eaff261 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -199,8 +199,8 @@ print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "' . $langs->trans("Status") . "
'; @@ -414,7 +414,7 @@ print $langs->trans('AutoReportLastAccountStatement'); print '' . "\n"; + print '' . "\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -422,7 +422,7 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { } else { - print '' . "\n"; + print '' . "\n"; print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; print "
'; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; $sql = "SELECT rowid, code as encoding, libelle, coder, example"; @@ -229,7 +229,7 @@ if ($resql) print ''; // Show example - print ''; - print '\n"; @@ -307,7 +307,7 @@ print ""; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("CodeBarGenerator").''.$langs->trans("Example").''.$langs->trans("CodeBarGenerator").'
'; + print ''; if ($obj->coder && $obj->coder != -1) { $result=0; @@ -277,7 +277,7 @@ if ($resql) } print ''; + print ''; print $formbarcode->setBarcodeEncoder($obj->coder, $barcodelist, $obj->rowid, 'form'.$i); print "
'; print ''; print ''; -print ''; +print ''; print ''; print ''; @@ -317,7 +317,7 @@ if (! isset($_SERVER['WINDIR'])) print ''; print ''; - print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; $dirbarcodenum=array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); @@ -406,17 +406,17 @@ if ($conf->produit->enabled) if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { - print ''; } else { - print ''; } - print ''; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 3cee6aa27f4..70672f9b6fb 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -337,7 +337,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; foreach($boxtoadd as $box) @@ -398,9 +398,9 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("GenbarcodeLocation").''; + print ''; print ''; if (! empty($conf->global->GENBARCODE_LOCATION) && ! @file_exists($conf->global->GENBARCODE_LOCATION)) { @@ -369,8 +369,8 @@ if ($conf->produit->enabled) print ''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; $s=$modBarCode->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("SourceFile").''.$langs->trans("ActivateOn").''.$langs->trans("ActivateOn").'
'."\n"; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''."\n"; $box_order=1; @@ -429,15 +429,15 @@ foreach($boxactivated as $key => $box) } else print ($box->note?$box->note:' '); print ''; - print ''; + print ''; $hasnext=($key < (count($boxactivated)-1)); $hasprevious=($key != 0); - print ''; - print ''; + print ''; - print ''; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index 4efa3bc487b..e8e035f8b49 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -116,8 +116,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -177,7 +177,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 3dc59b1b247..1f3e23e05d6 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -267,8 +267,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -393,10 +393,10 @@ print "
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("ActiveOn").''.$langs->trans("PositionByDefault").''.$langs->trans("Disable").''.$langs->trans("ActiveOn").''.$langs->trans("PositionByDefault").''.$langs->trans("Disable").'
' . (empty($pos_name[$box->position])?'':$langs->trans($pos_name[$box->position])) . '' . (empty($pos_name[$box->position])?'':$langs->trans($pos_name[$box->position])) . ''.($key+1).''; + print ''.($key+1).''; print ($hasnext?''.img_down().' ':''); print ($hasprevious?''.img_up().'':''); print ''; + print ''; print ''.img_delete().''; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -206,7 +206,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors @@ -244,7 +244,7 @@ print ''; print '
'.$langs->trans("Parameters").'   
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->COMMANDE_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
\n"; print "\n"; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -449,7 +449,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Default - print ''; // Preview - print '"; } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2f1fdd4184e..c0e4c7fabb2 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Ion Agorria * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -765,20 +766,20 @@ SCRIPT; print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre("Availability", $_SERVER["PHP_SELF"], "pfp.fk_availability", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); if ($conf->multicurrency->enabled) { - print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); } - print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "pfp.unitprice", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "pfp.unitprice", "", $param, '', $sortfield, $sortorder, 'right '); if ($conf->multicurrency->enabled) { - print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } - print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("NbDaysToDelivery", $_SERVER["PHP_SELF"], "pfp.delivery_time_days", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("ReputationForThisProduct", $_SERVER["PHP_SELF"], "pfp.supplier_reputation", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("NbDaysToDelivery", $_SERVER["PHP_SELF"], "pfp.delivery_time_days", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ReputationForThisProduct", $_SERVER["PHP_SELF"], "pfp.supplier_reputation", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre(''); print "\n"; @@ -798,11 +799,11 @@ SCRIPT; // Supplier ref if ($user->rights->produit->creer || $user->rights->service->creer) // change required right here { - print ''; + print ''; } else { - print ''; + print ''; } // Availability @@ -814,57 +815,57 @@ SCRIPT; } // Quantity - print ''; // VAT rate - print ''; // Price for the quantity - print ''; if ($conf->multicurrency->enabled) { // Price for the quantity in currency - print ''; } // Unit price - print ''; if ($conf->multicurrency->enabled) { // Unit price in currency - print ''; // Currency - print ''; } // Discount - print ''; // Delivery delay - print ''; // Reputation - print ''; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; $statProducts.= ''; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; $statProducts.= ''; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; $statProducts.= ''; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; } if (! empty($conf->service->enabled)) { $statServices = ''; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; $statServices.= ''; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; $statServices.= ''; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; $statServices.= ''; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; } $total=0; @@ -185,7 +186,7 @@ else print $statProducts.$statServices; $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3])+round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]); //Calcul du Total des Produits et Services } -print ''; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -457,13 +457,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->COMMANDE_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -491,12 +491,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -528,7 +528,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print "\n"; print "\n"; @@ -580,7 +580,7 @@ Whet is definition of "shippable" according to all different STOCK_CALCULATE_... print ''; print ''; print ''; -print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").''; } // Ask for warehouse during order @@ -628,7 +628,7 @@ if ($conf->stock->enabled) { print ''; + print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").''; } */ @@ -666,7 +666,7 @@ print load_fiche_titre($langs->trans("Notifications"), '', ''); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("ShippableOrderIconInList").' '; +print ''; if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { print ''; print img_picto($langs->trans("Activated"),'switch_on'); @@ -598,7 +598,7 @@ if ($conf->banque->enabled) { print '
'; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); @@ -620,7 +620,7 @@ else { print '
'; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '.$langs->trans('NotAvailable').'
 '.$langs->trans('NotAvailable').'
'; - print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '; + print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER'); @@ -650,7 +650,7 @@ else { print '
'; - print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '.$langs->trans('NotAvailable').'
 '.$langs->trans('NotAvailable').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 720b43a2275..062fcb1d998 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -190,7 +190,7 @@ print ''; print ''; print ''; if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; -print ''; +print ''; print "\n"; @@ -210,11 +210,11 @@ if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; - print ''; - print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -249,7 +249,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -329,10 +329,10 @@ print '
'.$langs->trans("Parameter").' 
'.$langs->trans("Name").''.$langs->trans("Value").''.$langs->trans("Comment").''.$langs->trans("Entity").''.$langs->trans("Action").''.$langs->trans("Action").'
'; print ''; print ''; + print ''; } else { - print ''; + print ''; print ''; } print ''; @@ -273,11 +273,11 @@ if ($result) print ''; print ''; print ''; + print ''; } else { - print ''; + print ''; print ''; } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 7cad76585e2..bf02df80b5b 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -204,8 +204,8 @@ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->CONTRACT_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -280,7 +280,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
'; print ''; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -384,7 +384,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Defaut - print ''; // Preview - print ''."\n"; - } else { //bouton gris + } else { + //bouton gris print ''."\n"; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b56d96e0290..18ea87cb03a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1641,7 +1641,7 @@ else print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -392,13 +392,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->CONTRACT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -424,12 +424,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'contract').''; @@ -466,7 +466,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print "\n"; $substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index a946aeeacfd..c2559e0e2bf 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -322,11 +322,11 @@ if (! empty($conf->multicompany->enabled) && !$user->entity) } else { - print ''; } -print ''; // Actions - print ''; - print '\n"; @@ -1280,7 +1293,7 @@ class FormFile $fulllink=$urlwithroot.'/document.php'.($paramlink?'?'.$paramlink:''); print img_picto($langs->trans("FileSharedViaALink"), 'object_globe.png').' '; - print ''; + print ''; } else { @@ -1551,22 +1564,14 @@ class FormFile $id=0; $ref=''; $label=''; // To show ref or specific information according to view to show (defined by $module) - if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices - if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} - + if ($modulepart == 'company' || $modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices + elseif ($modulepart == 'user' || $modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } + elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport'))) + { + preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); + } + if (! $id && ! $ref) continue; $found=0; if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) @@ -1722,7 +1727,7 @@ class FormFile print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").'
'; + print ''; print ''; print ''; +print ''; $disabled=''; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) $disabled=' disabled="disabled"'; print ''; @@ -385,7 +385,7 @@ if ($result) print ''; + print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { print ''.img_edit().''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 788f600a549..11134f70194 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,37,0,25,0); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0); // Name of SQL tables of dictionaries $tabname=array(); @@ -1180,7 +1180,7 @@ if ($id) } if ($id == 4) print ''; + print ''; if ($action != 'edit') { print ''; diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 205f7e7cb1a..1cb165552f1 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -77,8 +77,8 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''."\n"; +print ''; +print ''."\n"; print ''; $form = new Form($db); @@ -87,9 +87,9 @@ $form = new Form($db); print ''; print ''; -print ''; +print ''; -print ''."\n"; @@ -450,10 +450,10 @@ while ($i < min($num, $limit)) $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'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - + if (! empty($arrayfields['t.'.$key]['checked'])) { print 'executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ' - @@ -159,4 +159,4 @@ echo $this->control->tpl['ajax_selectcountry']; - \ No newline at end of file + diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 697e1038504..dff432690be 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -189,6 +189,7 @@ if (empty($reshook)) $object->skype = GETPOST("skype", 'alpha'); $object->twitter = GETPOST("twitter", 'alpha'); $object->facebook = GETPOST("facebook", 'alpha'); + $object->linkedin = GETPOST("linkedin", 'alpha'); $object->email = GETPOST("email", 'alpha'); $object->phone_pro = GETPOST("phone_pro", 'alpha'); $object->phone_perso = GETPOST("phone_perso", 'alpha'); @@ -362,6 +363,7 @@ if (empty($reshook)) $object->skype = GETPOST("skype", 'alpha'); $object->twitter = GETPOST("twitter", 'alpha'); $object->facebook = GETPOST("facebook", 'alpha'); + $object->linkedin = GETPOST("linkedin", 'alpha'); $object->phone_pro = GETPOST("phone_pro", 'alpha'); $object->phone_perso = GETPOST("phone_perso", 'alpha'); $object->phone_mobile = GETPOST("phone_mobile", 'alpha'); @@ -588,7 +590,7 @@ else $rowspan=3; if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; - print ''; } @@ -698,6 +700,12 @@ else print ''; print ''; } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Visibility @@ -979,11 +987,17 @@ else print ''; } // Facebook - if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - { - print ''; - print ''; - } + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Visibility diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 67b3900ec06..58204ae0c94 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -359,6 +359,7 @@ class Contact extends CommonObject $sql .= ", skype='".$this->db->escape($this->skype)."'"; $sql .= ", twitter='".$this->db->escape($this->twitter)."'"; $sql .= ", facebook='".$this->db->escape($this->facebook)."'"; + $sql .= ", linkedin='".$this->db->escape($this->linkedin)."'"; $sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); @@ -455,6 +456,11 @@ class Contact extends CommonObject $tmpobj->facebook = $this->facebook; $usermustbemodified++; } + if ($tmpobj->linkedin != $this->linkedin) + { + $tmpobj->linkedin = $this->linkedin; + $usermustbemodified++; + } if ($usermustbemodified) { $result=$tmpobj->update($user, 0, 1, 1, 1); @@ -705,7 +711,7 @@ class Contact extends CommonObject $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; - $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook,"; + $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,"; $sql.= " c.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $sql.= " c.import_key,"; @@ -779,6 +785,7 @@ class Contact extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index de8beeb1af5..667965396a6 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -379,16 +379,16 @@ if ($sql_select) print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle'); $formother->select_year($year?$year:-1, 'year', 1, 20, 1); print ''; - print ''; print ''; - print ''; - print ''; - print ''; print ''; print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); - print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre('ContactType', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); @@ -427,10 +427,10 @@ if ($sql_select) print ''; - print ''; + print ''; // Status - print ''; print ''; - //print ''; + //print ''; print ''; print "\n"; @@ -354,10 +354,10 @@ if ($result) print ''; print ''; //print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; $i++; } @@ -432,7 +432,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; @@ -511,7 +511,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; print "\n"; @@ -590,7 +590,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; print "\n"; diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 1170c7e9f9e..7d2b897f761 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -92,11 +92,11 @@ $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2); $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); -$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); +$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); -$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); +$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 24dccaae25d..fb2422b7762 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -559,7 +559,7 @@ if (! empty($arrayfields['lower_planned_end_date']['checked'])) // Status if (! empty($arrayfields['status']['checked'])) { - print '
'; + print ''; } print '\n"; @@ -511,7 +511,7 @@ if (! empty($arrayfields['cd.tms']['checked'])) if (! empty($arrayfields['status']['checked'])) { // Status - print ''; } // Action column -print ''; @@ -589,7 +589,7 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['cd.total_ht']['checked'])) { - print ''; $totalarray['totalht'] += $obj->total_ht; @@ -601,7 +601,7 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['cd.total_tva']['checked'])) { - print ''; $totalarray['totalvat'] += $obj->total_tva; @@ -613,14 +613,14 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['cd.tva_tx']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['cd.subprice']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -698,7 +698,7 @@ while ($i < min($num, $limit)) // Status if (! empty($arrayfields['status']['checked'])) { - print ''; else print ''; } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 7dab385681a..d63df9f87b9 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -51,7 +51,7 @@ foreach($linkedObjectBlock as $key => $objectlink) - - - + + diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 1e5e31b4385..46a5e0e6d7d 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -425,7 +425,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, print '';*/ // Nb of docs - print ''; print ''; // Edit link - print ''; // Add link - //print ''; - //print ''; + //print ''; + //print ''; // Info if ($modulepart == 'ecm') { - print '"; if ($savingdocmask) - { - $out .= ''; - if (! empty($options)) $out .= ''; - $out .= ''; - $out .= ''; - } + { + //add a global variable for disable the auto renaming on upload + if (! empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT)) + { + $rename=''; + } + else { + $rename='checked'; + } + + $out .= ''; + if (! empty($options)) $out .= ''; + $out .= ''; + $out .= ''; + } $out .= "
'.$langs->trans("Description").' '.$langs->trans("Value").' '.$langs->trans("Value").'
'.$langs->trans("ECMAutoTree").'  '; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 755d44d42ba..e8dbc07654c 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -412,7 +412,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print '
'; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index aa0dd0978d9..e284d4b4834 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -154,6 +154,13 @@ if ($mode == 'setup' && $user->admin) $urltodelete=''; $urltocheckperms=''; } + elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME') + { + $OAUTH_SERVICENAME='StripeLive'; + $urltorenew=$urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete=''; + $urltocheckperms=''; + } else { $urltorenew=''; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php index f723d13d540..8b7c061dc64 100644 --- a/htdocs/admin/socialnetworks.php +++ b/htdocs/admin/socialnetworks.php @@ -1,5 +1,6 @@ + * Copyright (C) 2019 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,7 +97,7 @@ dol_fiche_head($head, 'setup', '', 0, 'user'); print '
'; -$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); +$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook', 'linkedin'=>'LinkedIn'); foreach($arrayofsocialnetworks as $snkey => $snlabel) { $consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 4a1fb7eea1a..2e934211970 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -409,12 +409,12 @@ print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print ''; print ''; -print '\n"; print ''; print ''; -print '\n"; print "\n"; if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { - print ''; print ''; - print ''; } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 00aae3a8b08..567f968e3d2 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -423,12 +423,15 @@ class AdvanceTargetingMailing extends CommonObject $this->db->begin(); dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { + $error++; + $this->errors[]="Error ".$this->db->lasterror(); + } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -438,8 +441,8 @@ class AdvanceTargetingMailing extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error) @@ -790,15 +793,15 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])){ $sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')"; } - }elseif ($extrafields->attribute_type[$key] == 'boolean') { + } elseif ($extrafields->attribute_type[$key] == 'boolean') { if ($arrayquery['options_'.$key.'_cnct']!=''){ if ($arrayquery['options_'.$key.'_cnct']==0) { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct']." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))"; - }else { + } else { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct'].")"; } } - }else{ + } else { if (is_array($arrayquery['options_'.$key.'_cnct'])) { $sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key.'_cnct'])."'))"; } elseif (!empty($arrayquery['options_'.$key.'_cnct'])) { @@ -965,12 +968,12 @@ class AdvanceTargetingMailing extends CommonObject } if (count($return_sql_like)>0) { - $return_sql_criteria .= '(' . implode (' OR ', $return_sql_like) .')'; + $return_sql_criteria .= '(' . implode(' OR ', $return_sql_like) .')'; } if (count($return_sql_not_like)>0) { - $return_sql_criteria .= ' AND (' . implode (' AND ', $return_sql_not_like).')'; + $return_sql_criteria .= ' AND (' . implode(' AND ', $return_sql_not_like).')'; } - }else { + } else { $return_sql_criteria .= $column_to_test . ' LIKE \''.$this->db->escape($criteria).'\''; } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 26b16e50d68..66303647dbc 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2014 Florian Henry + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,10 +44,10 @@ class FormAdvTargetEmailing extends Form */ function __construct($db) { - global $langs; + global $langs; - $this->db = $db; - } + $this->db = $db; + } /** * Affiche un champs select contenant une liste @@ -64,7 +65,7 @@ class FormAdvTargetEmailing extends Form $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; $sql .= " WHERE active > 0"; $sql .= " ORDER BY sortorder"; - dol_syslog (get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG); + dol_syslog(get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -83,7 +84,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return combo list of activated countries, into language of user @@ -120,10 +121,10 @@ class FormAdvTargetEmailing extends Form $foundselected = false; while ($i < $num) { - $obj = $this->db->fetch_object ($resql); + $obj = $this->db->fetch_object($resql); $countryArray [$i] ['rowid'] = $obj->rowid; $countryArray [$i] ['code_iso'] = $obj->code_iso; - $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); + $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); $label[$i] = $countryArray[$i]['label']; $i ++; } @@ -143,7 +144,7 @@ class FormAdvTargetEmailing extends Form } return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return select list for categories (to use in form search selectors) @@ -166,26 +167,26 @@ class FormAdvTargetEmailing extends Form $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; $sql_usr .= " AND u2.rowid = sc.fk_user "; - if (! empty ($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) + if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql_usr .= " AND u2.statut<>0 "; $sql_usr .= " ORDER BY name ASC"; // print $sql_usr;exit; - $resql_usr = $this->db->query ($sql_usr); + $resql_usr = $this->db->query($sql_usr); if ($resql_usr) { - while ( $obj_usr = $this->db->fetch_object ($resql_usr) ) { + while ( $obj_usr = $this->db->fetch_object($resql_usr) ) { $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; $options_array [$obj_usr->rowid] = $label; } - $this->db->free ($resql_usr); + $this->db->free($resql_usr); } else { - dol_print_error ($this->db); + dol_print_error($this->db); } - return $this->advMultiselectarray ($htmlname, $options_array, $selected_array); - } + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); + } /** * Return select list for categories (to use in form search selectors) @@ -210,7 +211,7 @@ class FormAdvTargetEmailing extends Form } asort($options_array); return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return multiselect list of entities for extrafeild type sellist @@ -227,8 +228,8 @@ class FormAdvTargetEmailing extends Form if (is_array($sqlqueryparam)) { - $param_list = array_keys ($sqlqueryparam); - $InfoFieldList = explode (":", $param_list [0]); + $param_list = array_keys($sqlqueryparam); + $InfoFieldList = explode(":", $param_list [0]); // 0 1 : tableName // 1 2 : label field name Nom du champ contenant le libelle @@ -237,8 +238,8 @@ class FormAdvTargetEmailing extends Form $keyList = 'rowid'; - if (count ($InfoFieldList) >= 3) { - if (strpos ($InfoFieldList [3], 'extra.') !== false) { + if (count($InfoFieldList) >= 3) { + if (strpos($InfoFieldList [3], 'extra.') !== false) { $keyList = 'main.' . $InfoFieldList [2] . ' as rowid'; } else { $keyList = $InfoFieldList [2] . ' as rowid'; @@ -247,10 +248,10 @@ class FormAdvTargetEmailing extends Form $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; - if (! empty ($InfoFieldList [3])) { + if (! empty($InfoFieldList [3])) { // We have to join on extrafield table - if (strpos ($InfoFieldList [3], 'extra') !== false) { + if (strpos($InfoFieldList [3], 'extra') !== false) { $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; $sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3]; } else { @@ -270,13 +271,13 @@ class FormAdvTargetEmailing extends Form $i = 0; if ($num) { while ( $i < $num ) { - $obj = $this->db->fetch_object ($resql); - $labeltoshow = dol_trunc ($obj->$InfoFieldList [1], 90); + $obj = $this->db->fetch_object($resql); + $labeltoshow = dol_trunc($obj->$InfoFieldList [1], 90); $options_array[$obj->rowid]=$labeltoshow; $i ++; } } - $this->db->free ($resql); + $this->db->free($resql); } } @@ -328,7 +329,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } - return $this->advMultiselectarray ($htmlname, $options_array, $selected_array); + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); } /** @@ -347,7 +348,7 @@ class FormAdvTargetEmailing extends Form $form=new Form($this->db); $return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295); return $return; - } + } /** * Return combo list with customer categories @@ -438,19 +439,19 @@ class FormAdvTargetEmailing extends Form $sql .= " WHERE type_element='$type_element'"; $sql .= " ORDER BY c.name"; - dol_syslog (get_class ($this) . "::".__METHOD__, LOG_DEBUG); - $resql = $this->db->query ($sql); + dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $out .= ''; } else { - dol_print_error ($this->db); + dol_print_error($this->db); } - $this->db->free ($resql); + $this->db->free($resql); return $out; - } + } } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ac64f65381c..46bc16dfa8c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1590,7 +1590,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; @@ -1677,7 +1677,7 @@ if ($action == 'create') print ''; print ''; print ''; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f660fd3c533..37f6b2bd3f5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1357,7 +1357,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise $sql.= ", p.date_livraison as date_livraison"; $sql.= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql.= ", p.note_private, p.note_public"; - $sql.= ", p.fk_projet, p.fk_statut"; + $sql.= ", p.fk_projet as fk_project, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; $sql.= ", p.fk_delivery_address"; $sql.= ", p.fk_availability"; @@ -1412,7 +1412,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total; $this->socid = $obj->fk_soc; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->modelpdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; $this->note = $obj->note_private; // TODO deprecated diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 45c10a3aedd..6afee20b371 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1636,7 +1636,7 @@ if ($action == 'create' && $user->rights->commande->creer) }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; @@ -1727,7 +1727,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8272b2534bf..26151fd8b72 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -203,7 +203,12 @@ class Commande extends CommonOrder public $multicurrency_total_ttc; public $oldcopy; - + + //! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) + public $module_source; + //! key of pos source ('0', '1', ...) + public $pos_source; + /** * ERR Not enough stock */ @@ -820,7 +825,7 @@ class Commande extends CommonOrder $sql.= ", fk_warehouse"; $sql.= ", remise_absolue, remise_percent"; $sql.= ", fk_incoterms, location_incoterms"; - $sql.= ", entity"; + $sql.= ", entity, module_source, pos_source"; $sql.= ", fk_multicurrency"; $sql.= ", multicurrency_code"; $sql.= ", multicurrency_tx"; @@ -849,6 +854,8 @@ class Commande extends CommonOrder $sql.= ", ".(int) $this->fk_incoterms; $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ", ".$conf->entity; + $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); + $sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".(double) $this->multicurrency_tx; @@ -1633,7 +1640,8 @@ class Commande extends CommonOrder $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; $sql.= ', c.fk_incoterms, c.location_incoterms'; $sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; - $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ", c.module_source, c.pos_source"; + $sql.= ", i.libelle as libelle_incoterms"; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', ca.code as availability_code, ca.label as availability_label'; @@ -1680,7 +1688,7 @@ class Commande extends CommonOrder $this->date_commande = $this->db->jdate($obj->date_commande); $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_validation = $this->db->jdate($obj->date_valid); - $this->date_modification = $this->db->jdate($obj->tms); + $this->date_modification = $this->db->jdate($obj->tms); $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; @@ -1707,13 +1715,15 @@ class Commande extends CommonOrder $this->demand_reason_code = $obj->demand_reason_code; $this->date_livraison = $this->db->jdate($obj->date_livraison); $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; - $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null; + $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null; $this->fk_delivery_address = $obj->fk_delivery_address; - + $this->module_source = $obj->module_source; + $this->pos_source = $obj->pos_source; + //Incoterms - $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 19ad1dbe2c2..f525a7b7d88 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -106,7 +106,7 @@ if ($action != 'edit') print ''; print ''; - print ''; + print ''; print ''; } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index b22531a9573..cf355beeb77 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -832,12 +832,12 @@ if ($mode == 'standard') $link="".img_previous('', 'class="valignbottom"')." ".$langs->trans("Month")." ".img_next('', 'class="valignbottom"').""; print ''; - print ''; - print ''; @@ -846,18 +846,18 @@ if ($mode == 'standard') $link="".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"').""; print ''; - print ''; - print ''; } if ($mode == 'showalltime') { - print ''; } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 6aac94532df..b0a7f546297 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -369,7 +369,7 @@ if (! empty($arrayfields['balance']['checked'])) print ''; } // Action column -print ''; @@ -383,19 +383,19 @@ if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titr if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'], $_SERVER["PHP_SELF"], 'b.number', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'], $_SERVER["PHP_SELF"], 'b.account_number', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'], $_SERVER["PHP_SELF"], 'b.fk_accountancy_journal', '', $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['b.currency_code']['checked'])) print_liste_field_titre($arrayfields['b.currency_code']['label'], $_SERVER["PHP_SELF"], 'b.currency_code', '', $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['b.currency_code']['checked'])) print_liste_field_titre($arrayfields['b.currency_code']['label'], $_SERVER["PHP_SELF"], 'b.currency_code', '', $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'], $_SERVER["PHP_SELF"], "b.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'], $_SERVER["PHP_SELF"], 'b.clos', '', $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'], $_SERVER["PHP_SELF"], "b.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'], $_SERVER["PHP_SELF"], 'b.clos', '', $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -492,7 +492,7 @@ foreach ($accounts as $key=>$type) // Currency if (! empty($arrayfields['b.currency_code']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -501,7 +501,7 @@ foreach ($accounts as $key=>$type) // Transactions to reconcile if (! empty($arrayfields['toreconcile']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -534,7 +534,7 @@ foreach ($accounts as $key=>$type) // Date modification if (! empty($arrayfields['b.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -543,7 +543,7 @@ foreach ($accounts as $key=>$type) // Status if (! empty($arrayfields['b.clos']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } @@ -559,7 +559,7 @@ foreach ($accounts as $key=>$type) } // Action column - print ''; - print ''; // Ref - print ''; @@ -195,7 +195,7 @@ if ($result) print ''; // Type - print ''; @@ -233,13 +233,13 @@ if ($result) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'align="left"', $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, 'class="right"', $sortfield, $sortorder); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -300,7 +300,7 @@ if ($result) } // Debit - print ""; // Credit - print "'; } print '' . "\n"; @@ -3092,7 +3092,7 @@ if ($action == 'create') $langs->load('projects'); print ''; } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 3056fc1c7f4..7da45f33920 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -372,7 +372,7 @@ class Invoices extends DolibarrApi throw new RestException(304, $this->invoice->error); } } - + /** * Add a contact type of given invoice * @@ -920,6 +920,123 @@ class Invoices extends DolibarrApi return $this->_cleanObjectDatas($this->invoice); } + /** + * Create a discount (credit available) for a credit note or a deposit. + * + * @param int $id Invoice ID + * @url POST {id}/markAsCreditAvailable + * + * @return array An invoice object + * + * @throws 200 + * @throws 304 + * @throws 401 + * @throws 404 + * @throws 500 + */ + function markAsCreditAvailable($id) + { + if(! DolibarrApiAccess::$user->rights->facture->creer) { + throw new RestException(401); + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->invoice->fetch_thirdparty(); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if (! $this->invoice->paye) // protection against multiple submit + { + $this->db->begin(); + + $this->invoice->fetch_lines(); + + $amount_ht = $amount_tva = $amount_ttc = array(); + + // Loop on each vat rate + $i=0; + $amount_ht = array(); + $amount_tva = array(); + $amount_ttc = array(); + foreach($this->invoice->lines as $line) + { + $amount_ht[$line->tva_tx]+=$line->total_ht; + $amount_tva[$line->tva_tx]+=$line->total_tva; + $amount_ttc[$line->tva_tx]+=$line->total_ttc; + $i++; + } + + // Insert one discount by VAT rate category + $discount = new DiscountAbsolute($this->db); + if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)'; + elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)'; + else { + $this->error="CantConvertToReducAnInvoiceOfThisType"; + return -1; + } + $discount->tva_tx=abs($this->invoice->total_ttc); + $discount->fk_soc=$this->invoice->socid; + $discount->fk_facture_source=$this->invoice->id; + + $error=0; + foreach($amount_ht as $tva_tx => $xxx) + { + $discount->amount_ht=abs($amount_ht[$tva_tx]); + $discount->amount_tva=abs($amount_tva[$tva_tx]); + $discount->amount_ttc=abs($amount_ttc[$tva_tx]); + $discount->tva_tx=abs($tva_tx); + + $result=$discount->create(DolibarrApiAccess::$user); + if ($result < 0) + { + $error++; + break; + } + } + + if (! $error) + { + // Classe facture + $result=$this->invoice->set_paid(DolibarrApiAccess::$user); + if ($result > 0) + { + //$mesg='OK'.$discount->id; + $this->db->commit(); + } + else + { + $this->db->rollback(); + throw new RestException(500, 'Could not set paid'); + } + } + else + { + $this->db->rollback(); + throw new RestException(500, 'Discount creation error'); + } + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->invoice); + } + /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount * diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8233a50aca3..08f75f1e28e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1120,6 +1120,9 @@ class Facture extends CommonInvoice $this->note_private = $object->note_private; $this->note_public = $object->note_public; + $this->module_source = $object->module_source; + $this->pos_source = $object->pos_source; + $this->origin = $object->element; $this->origin_id = $object->id; @@ -1156,30 +1159,6 @@ class Facture extends CommonInvoice else return -1; } - /** - * Return link to download file from a direct external access - * - * @param int $withpicto Add download picto into link - * @return string HTML link to file - */ - function getDirectExternalLink($withpicto = 0) - { - global $dolibarr_main_url_root; - - // 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 - - // TODO Read into ecmfile table to get entry and hash exists (PS: If not found, add it) - include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $ecmfile=new EcmFiles($this->db); - //$result = $ecmfile->get(); - - $hashp='todo'; - return ''.$this->ref.''; - } - /** * Return clicable link of object (with eventually picto) * @@ -1324,6 +1303,7 @@ class Facture extends CommonInvoice $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', f.fk_incoterms, f.location_incoterms'; + $sql.= ', f.module_source, f.pos_source'; $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; @@ -1357,7 +1337,7 @@ class Facture extends CommonInvoice $this->date_pointoftax = $this->db->jdate($obj->date_pointoftax); $this->date_creation = $this->db->jdate($obj->datec); $this->date_validation = $this->db->jdate($obj->datev); - $this->date_modification = $this->db->jdate($obj->datem); + $this->date_modification = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem); $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; @@ -1396,9 +1376,12 @@ class Facture extends CommonInvoice $this->extraparams = (array) json_decode($obj->extraparams, true); //Incoterms - $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + + $this->module_source = $obj->module_source; + $this->pos_source = $obj->pos_source; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; @@ -2650,7 +2633,7 @@ class Facture extends CommonInvoice * @return int <0 if KO, Id of line if OK */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) - { + { // Deprecation warning if ($label) { dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); @@ -3346,10 +3329,10 @@ class Facture extends CommonInvoice $mybool=false; - + $file = $conf->global->FACTURE_ADDON.".php"; $classname = $conf->global->FACTURE_ADDON; - + // Include file with class $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -3382,7 +3365,7 @@ class Facture extends CommonInvoice } } } - + if (! $mybool) { dol_print_error('', "Failed to include file ".$file); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index ee69d8d89f3..f84a805caef 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -771,11 +771,6 @@ else print '
'; -/*if ($user->societe_id == 0 && count($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque) -{ - print ''.$langs->trans('NewCheckReceipt').''; -}*/ - if ($user->societe_id == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) { print ''.$langs->trans('Validate').''; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index fef607ac0dd..f0a01d1ae04 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -301,7 +301,7 @@ if ($modecompta == 'BOOKKEEPING') // Get cpts of category/group $cpts = $AccCat->getCptsCat(0, $tmppredefinedgroupwhere); - foreach($cpts as $i => $cpt) + foreach($cpts as $j => $cpt) { $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']); if ($return < 0) { diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index fcee95b688f..bd9f25bb0b8 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -405,7 +405,7 @@ elseif ($modecompta=="BOOKKEEPING") // N-1 if (! empty($arrayofaccountforfilter)) { - $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cpt['dc']?$cpt['dc']:0); + $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc']?$cat['dc']:0); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); @@ -438,7 +438,7 @@ elseif ($modecompta=="BOOKKEEPING") if (($k+1) < $start_month) $yeartoprocess++; //var_dump($monthtoprocess.'_'.$yeartoprocess); - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']?$cpt['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess); + $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc']?$cat['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultM=0; diff --git a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php index 76ae63d7b7d..c74641876f1 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php @@ -126,11 +126,11 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
- +
".$langs->trans("Other")."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UserWarehouseAutoCreate").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_USERSTOCK_AUTOCREATE'); } else { @@ -428,7 +428,7 @@ print '
'; print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); print ''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_SUPPORTS_SERVICES'); } else { @@ -440,7 +440,7 @@ print "
'.$langs->trans("AllowAddLimitStockByWarehouse").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE'); } else { @@ -451,10 +451,9 @@ print "
'.$langs->trans("UseDispatchStatus").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); } else { diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 8db471855d6..7473bc5db5e 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -355,6 +355,22 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); } + else if ($modulepart == 'produit' || $modulepart == 'product') + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + + if (!DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + $object = new Product($this->db); + $result=$object->fetch($id, $ref); + if ( ! $result ) { + throw new RestException(404, 'Product not found'); + } + + $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product'); + } else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; diff --git a/htdocs/bom/admin/setup.php b/htdocs/bom/admin/setup.php new file mode 100644 index 00000000000..dd16ad92b8e --- /dev/null +++ b/htdocs/bom/admin/setup.php @@ -0,0 +1,146 @@ + + * Copyright (C) 2019 Maxime Kohlhaas + * + * 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 bom/admin/setup.php + * \ingroup bom + * \brief Bom setup page. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +global $langs, $user; + +// Libraries +require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; +require_once '../lib/bom.lib.php'; +//require_once "../class/myclass.class.php"; + +// Translations +$langs->loadLangs(array("admin", "bom@bom")); + +// Access control +if (! $user->admin) accessforbidden(); + +// Parameters +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +$arrayofparameters=array( + 'BILLOFMATERIALS_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1), + 'BILLOFMATERIALS_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1) +); + + +/* + * Actions + */ +if ((float) DOL_VERSION >= 6) +{ + include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +} + + +/* + * View + */ + +$page_name = "BomSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom@bom'); + +// Configuration header +$head = bomAdminPrepareHead(); +dol_fiche_head($head, 'settings', '', -1, "bom@bom"); + +// Setup page goes here +echo $langs->trans("BomSetupPage").'

'; + + +if ($action == 'edit') +{ + print '
'; + print ''; + print ''; + + print ''; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); + print '
'; + + print '
'; + print ''; + print '
'; + + print '
'; + print '
'; +} +else +{ + if (! empty($arrayofparameters)) + { + print ''; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); + print '' . $conf->global->$key . '
'; + + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; + } + else + { + print '
'.$langs->trans("NothingToSetup"); + } +} + + +// Page end +dol_fiche_end(); + +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php new file mode 100644 index 00000000000..ea5ba91c715 --- /dev/null +++ b/htdocs/bom/bom_card.php @@ -0,0 +1,471 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_card.php + * \ingroup bom + * \brief Page to create/edit/view bom + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. +//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies + + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/bom/class/bom.class.php'); +dol_include_once('/bom/lib/bom_bom.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object=new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all", 'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); +} + +if (empty($action) && empty($id) && empty($ref)) $action='view'; + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0); +//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); + + +/* + * Actions + * + * Put here all code to do according to value of "action" parameter + */ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + $error=0; + + $permissiontoadd = $user->rights->bom->write; + $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); + $backurlforlist = dol_buildpath('/bom/bom_list.php', 1); + if (empty($backtopage)) { + if (empty($id)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__'); + } + $triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record + + // Actions cancel, add, update, delete or clone + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + + // Actions to send emails + $trigger_name='BILLOFMATERIALS_SENTBYMAIL'; + $autocopy='MAIN_MAIL_AUTOCOPY_BILLOFMATERIALS_TO'; + $trackid='bom'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; +} + + + + +/* + * View + * + * Put here all code to build page + */ + +$form=new Form($db); +$formfile=new FormFile($db); + +llxHeader('', 'BillOfMaterials', ''); + +// Example : Adding jquery code +print ''; + + +// Part to create +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("BillOfMaterials"))); + + print '
'; + print ''; + print ''; + print ''; + + dol_fiche_head(array(), ''); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + + print '
'."\n"; + + dol_fiche_end(); + + print '
'; + print ''; + print '  '; + print ''; // Cancel for create does not post form if we don't know the backtopage + print '
'; + + print '
'; +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') +{ + print load_fiche_titre($langs->trans("BillOfMaterials")); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head(); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + dol_fiche_end(); + + print '
'; + print '   '; + print '
'; + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = bomPrepareHead($object); + dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1); + } + + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneBillOfMaterials'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx + if ($action == 'xxx') + { + $formquestion=array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref bis + $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->bom->write) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(); + } else { + $morehtmlref.=''; + } + } + } + */ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswithonsecondcolumn'; + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + + print '

'; + + dol_fiche_end(); + + + // Buttons for actions + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + if (empty($reshook)) + { + // Send + print '' . $langs->trans('SendMail') . ''."\n"; + + // Modify + if ($user->rights->bom->write) + { + print ''.$langs->trans("Modify").''."\n"; + } + else + { + print ''.$langs->trans('Modify').''."\n"; + } + + // Clone + if ($user->rights->bom->write) + { + print ''; + } + + /* + if ($user->rights->bom->write) + { + if ($object->status == 1) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + */ + + if ($user->rights->bom->delete) + { + print ''.$langs->trans('Delete').''."\n"; + } + else + { + print ''.$langs->trans('Delete').''."\n"; + } + } + print '
'."\n"; + } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + print ''; // ancre + + // Documents + /*$objref = dol_sanitizeFileName($object->ref); + $relativepath = $comref . '/' . $comref . '.pdf'; + $filedir = $conf->bom->dir_output . '/' . $objref; + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->bom->create; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + */ + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright); + + print '
'; + } + + //Select mail models is same action as presend + /* + if (GETPOST('modelselected')) $action = 'presend'; + + // Presend form + $modelmail='inventory'; + $defaulttopic='InformationMessage'; + $diroutput = $conf->product->dir_output.'/inventory'; + $trackid = 'stockinv'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + */ +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php new file mode 100644 index 00000000000..0b1d55d7584 --- /dev/null +++ b/htdocs/bom/bom_document.php @@ -0,0 +1,166 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_document.php + * \ingroup bom + * \brief Tab for documents linked to BillOfMaterials + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/bom/class/bom.class.php'); +dol_include_once('/bom/lib/bom_bom.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","companies","other","mails")); + + +$action=GETPOST('action', 'aZ09'); +$confirm=GETPOST('confirm', 'alpha'); +$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); +$ref = GETPOST('ref', 'alpha'); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'bom', $id); + +// Get parameters +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="name"; +//if (! $sortfield) $sortfield="position_name"; + +// Initialize technical objects +$object=new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->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); + + +/* + * Actions + */ + +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$title=$langs->trans("BillOfMaterials").' - '.$langs->trans("Files"); +$help_url=''; +//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +if ($object->id) +{ + /* + * Show tabs + */ + $head = bomPrepareHead($object); + + dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); + + + // Build file list + $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); + $totalsize=0; + foreach($filearray as $key => $file) + { + $totalsize+=$file['size']; + } + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + + print '
'; + print ''; + + // Number of files + print ''; + + // Total size + print ''; + + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + + print '
'; + + dol_fiche_end(); + + $modulepart = 'bom'; + //$permission = $user->rights->bom->create; + $permission = 1; + //$permtoedit = $user->rights->bom->create; + $permtoedit = 1; + $param = '&id=' . $object->id; + + //$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/'; + $relativepathwithnofile='bom/' . dol_sanitizeFileName($object->ref).'/'; + + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; +} +else +{ + accessforbidden('', 0, 0); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php new file mode 100644 index 00000000000..4785d0c4598 --- /dev/null +++ b/htdocs/bom/bom_list.php @@ -0,0 +1,596 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_list.php + * \ingroup bom + * \brief List page for bom + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data +//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +dol_include_once('/bom/class/bom.class.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom", "other")); + +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +$id = GETPOST('id', 'int'); + +// Load variable for pagination +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +//if (! $sortfield) $sortfield="p.date_fin"; +//if (! $sortorder) $sortorder="DESC"; + +// Initialize technical objects +$object = new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); // Load $extrafields->attributes['bom'] +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Default sort order (if not yet defined by previous GETPOST) +if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. +if (! $sortorder) $sortorder="ASC"; + +// Security check +$socid=0; +if ($user->societe_id > 0) // Protection if external user +{ + //$socid = $user->societe_id; + accessforbidden(); +} +//$result = restrictedArea($user, 'bom', $id, ''); + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all", 'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); +} + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); +foreach($object->fields as $key => $val) +{ + if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; +} + +// Definition of fields for list +$arrayfields=array(); +foreach($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); +} +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } +} +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); + + + +/* + * Actions + */ + +if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') ||GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers + { + foreach($object->fields as $key => $val) + { + $search[$key]=''; + } + $toselect=''; + $search_array_options=array(); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + $objectclass='BillOfMaterials'; + $objectlabel='BillOfMaterials'; + $permtoread = $user->rights->bom->read; + $permtodelete = $user->rights->bom->delete; + $uploaddir = $conf->bom->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + + + +/* + * View + */ + +$form=new Form($db); + +$now=dol_now(); + +//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials"; +$help_url=''; +$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("BillOfMaterialss")); + + +// Build and execute select +// -------------------------------------------------------------------- +$sql = 'SELECT '; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/', '', $sql); +$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; +else $sql.=" WHERE 1 = 1"; +foreach($search as $key => $val) +{ + if ($key == 'status' && $search[$key] == -1) continue; + $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0); + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); +} +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + +/* If a group by is required +$sql.= " GROUP BY " +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/','', $sql); +*/ + +$sql.=$db->order($sortfield, $sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) +{ + $num = $nbtotalofrecords; +} +else +{ + $sql.= $db->plimit($limit+1, $offset); + + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); +} + +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/bom/bom_card.php', 1).'?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +// Example : Adding jquery code +print ''; + +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +foreach($search as $key => $val) +{ + $param.= '&search_'.$key.'='.urlencode($search[$key]); +} +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$newcardbutton=''; +//if ($user->rights->bom->creer) +//{ + $newcardbutton=''.$langs->trans('New').''; + $newcardbutton.= ''; + $newcardbutton.= ''; +//} +//else +//{ +// $newcardbutton=''.$langs->trans('New'); +// $newcardbutton.= ''; +// $newcardbutton.= ''; +//} + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail="SendBillOfMaterialsRef"; +$modelmail="bom"; +$objecttmp=new BillOfMaterials($db); +$trackid='xxxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; +/*$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
';*/ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + + +// Fields title search +// -------------------------------------------------------------------- +print ''; +foreach($object->fields as $key => $val) +{ + $cssforfield=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) print ''; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print ''; +print ''."\n"; + + +// Fields title label +// -------------------------------------------------------------------- +print ''; +foreach($object->fields as $key => $val) +{ + $cssforfield=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; + } +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print ''."\n"; + + +// Detect if we need a fetch on each output line +$needToFetchEachLine=0; +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } +} + + +// Loop on record +// -------------------------------------------------------------------- +$i=0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + // Store properties in $object + $object->id = $obj->rowid; + foreach($object->fields as $key => $val) + { + if (isset($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'; + elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; + + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + print $object->showOutputField($val, $key, $obj->$key, ''); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; + $totalarray['val']['t.'.$key] += $obj->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; + + $i++; +} + +// Show total line +if (isset($totalarray['pos'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + else print ''; + } + } + print ''; +} + +// If no record found +if ($num == 0) +{ + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; +} + + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; +print '
'; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print '
'."\n"; + +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty=1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&', '&', $param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->bom->read; + $delallowed=$user->rights->bom->create; + + print $formfile->showdocuments('massfilesarea_bom', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php new file mode 100644 index 00000000000..6166b6f23d1 --- /dev/null +++ b/htdocs/bom/bom_note.php @@ -0,0 +1,164 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_note.php + * \ingroup bom + * \brief Car with notes on BillOfMaterials + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +dol_include_once('/bom/class/bom.class.php'); +dol_include_once('/bom/lib/bom_bom.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","companies")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object=new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'bom', $id); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity] . "/" . $object->id; + +$permissionnote=1; +//$permissionnote=$user->rights->bom->creer; // Used by the include of actions_setnotes.inc.php + + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + + +/* + * View + */ + +$form = new Form($db); + +//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$help_url=''; +llxHeader('', $langs->trans('BillOfMaterials'), $help_url); + +if ($id > 0 || ! empty($ref)) +{ + $object->fetch_thirdparty(); + + $head = bomPrepareHead($object); + + dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->bom->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + dol_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/class/api_bom.class.php b/htdocs/bom/class/api_bom.class.php new file mode 100644 index 00000000000..5076a358279 --- /dev/null +++ b/htdocs/bom/class/api_bom.class.php @@ -0,0 +1,324 @@ + + * Copyright (C) 2019 Maxime Kohlhaas + * + * 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 . + */ + +use Luracast\Restler\RestException; + +dol_include_once('/bom/class/bom.class.php'); + + + +/** + * \file bom/class/api_bom.class.php + * \ingroup bom + * \brief File for API management of bom. + */ + +/** + * API class for bom bom + * + * @smart-auto-routing false + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class BillOfMaterialsApi extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'name', + ); + + + /** + * @var BillOfMaterials $bom {@type BillOfMaterials} + */ + public $bom; + + /** + * Constructor + * + * @url GET / + * + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->bom = new BillOfMaterials($this->db); + } + + /** + * Get properties of a bom object + * + * Return an array with bom informations + * + * @param int $id ID of bom + * @return array|mixed data without useless information + * + * @url GET boms/{id} + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->bom->read) { + throw new RestException(401); + } + + $result = $this->bom->fetch($id); + if( ! $result ) { + throw new RestException(404, 'BillOfMaterials not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->bom); + } + + + /** + * List boms + * + * Get a list of boms + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects + * + * @throws RestException + * + * @url GET /boms/ + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + global $db, $conf; + + $obj_ret = array(); + + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + + $restictonsocid = 0; // Set to 1 if there is a field socid in table of object + + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."bom_mytable as t"; + + if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql.= " WHERE 1 = 1"; + + // Example of use $mode + //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; + //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; + + $tmpobject = new BillOfMaterials($db); + if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')'; + if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid; + if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($restictonsocid && $search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); + $bom_static = new BillOfMaterials($db); + if($bom_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($bom_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve bom list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No bom found'); + } + return $obj_ret; + } + + /** + * Create bom object + * + * @param array $request_data Request datas + * @return int ID of bom + * + * @url POST boms/ + */ + function post($request_data = null) + { + if(! DolibarrApiAccess::$user->rights->bom->create) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->bom->$field = $value; + } + if( ! $this->bom->create(DolibarrApiAccess::$user)) { + throw new RestException(500); + } + return $this->bom->id; + } + + /** + * Update bom + * + * @param int $id Id of bom to update + * @param array $request_data Datas + * @return int + * + * @url PUT boms/{id} + */ + function put($id, $request_data = null) + { + if(! DolibarrApiAccess::$user->rights->bom->create) { + throw new RestException(401); + } + + $result = $this->bom->fetch($id); + if( ! $result ) { + throw new RestException(404, 'BillOfMaterials not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->bom->$field = $value; + } + + if($this->bom->update($id, DolibarrApiAccess::$user)) + return $this->get($id); + + return false; + } + + /** + * Delete bom + * + * @param int $id BillOfMaterials ID + * @return array + * + * @url DELETE bom/{id} + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->bom->delete) { + throw new RestException(401); + } + $result = $this->bom->fetch($id); + if( ! $result ) { + throw new RestException(404, 'BillOfMaterials not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( !$this->bom->delete(DolibarrApiAccess::$user, 0)) + { + throw new RestException(500); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'BillOfMaterials deleted' + ) + ); + } + + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) + { + $object = parent::_cleanObjectDatas($object); + + /*unset($object->note); + unset($object->address); + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder);*/ + + return $object; + } + + /** + * Validate fields before create or update object + * + * @param array $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $bom = array(); + foreach (BillOfMaterialsApi::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $bom[$field] = $data[$field]; + } + return $bom; + } +} diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php new file mode 100644 index 00000000000..2221da19567 --- /dev/null +++ b/htdocs/bom/class/bom.class.php @@ -0,0 +1,1207 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/bom.class.php + * \ingroup bom + * \brief This file is a CRUD class file for BillOfMaterials (Create/Read/Update/Delete) + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class for BillOfMaterials + */ +class BillOfMaterials extends CommonObject +{ + /** + * @var string ID to identify managed object + */ + public $element = 'bom'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'bom_bom'; + + /** + * @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var int Does bom support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 1; + + /** + * @var string String with name of icon for bom. Must be the part after the 'object_' into object_bom.png + */ + public $picto = 'bom@bom'; + + + /** + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text", '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,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', '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,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Actif', '-1'=>'Inactif')), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1,), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'isameasure'=>'1',), + ); + public $rowid; + public $ref; + public $label; + public $description; + public $note_public; + public $note_private; + public $date_creation; + public $tms; + public $fk_user_creat; + public $fk_user_modif; + public $import_key; + public $status; + public $fk_product; + public $qty; + // END MODULEBUILDER PROPERTIES + + + + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'bomdet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + //public $fk_element = 'fk_bom'; + + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'BillOfMaterialsline'; + + /** + * @var array Array of child tables (child tables to delete before deleting a record) + */ + //protected $childtables=array('bomdet'); + + /** + * @var BillOfMaterialsLine[] Array of subtable lines + */ + //public $lines = array(); + + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs, $user; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0; + + // Unset fields that are disabled + foreach($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + foreach($this->fields as $key => $val) + { + if (is_array($this->fields['status']['arrayofkeyval'])) + { + foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + { + $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone an object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $langs, $hookmanager, $extrafields; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $object->fetchCommon($fromid); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->element); + foreach($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + /*public function fetchLines() + { + $this->lines=array(); + + // Load lines with object BillOfMaterialsLine + + return count($this->lines)?1:0; + }*/ + + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records=array(); + + $sql = 'SELECT'; + $sql .= ' t.rowid'; + // TODO Get all fields + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + $sql .= ' WHERE t.entity = '.$conf->entity; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key=='t.rowid') { + $sqlwhere[] = $key . '='. $value; + } + elseif (strpos($key, 'date') !== false) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } + elseif ($key=='customsql') { + $sqlwhere[] = $value; + } + else { + $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) + { + $record = new self($this->db); + + $record->id = $obj->rowid; + // TODO Get other fields + + //var_dump($record->id); + $records[$record->id] = $record; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + + $label = '' . $langs->trans("BillOfMaterials") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowBillOfMaterials"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + + /* + $hookmanager->initHooks(array('bomdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action,$hookmanager; + $hookmanager->initHooks(array('bomdao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } + + /** + * Return label of the status + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return the status + * + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + if (empty($this->labelstatus)) + { + global $langs; + //$langs->load("bom"); + $this->labelstatus[1] = $langs->trans('Enabled'); + $this->labelstatus[0] = $langs->trans('Disabled'); + } + + if ($mode == 0) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 1) + { + return $this->labelstatus[$status]; + } + 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]; + } + 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'); + } + 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]; + } + 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'); + } + 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'); + } + } + + /** + * Load the info information in the object + * + * @param int $id Id of object + * @return void + */ + public function info($id) + { + $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; + $sql.= ' fk_user_creat, fk_user_modif'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql.= ' WHERE t.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + } + + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } + + + /** + * Action executed by scheduler + * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + //public function doScheduledJob($param1, $param2, ...) + public function doScheduledJob() + { + global $conf, $langs; + + //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; + + $error = 0; + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $now = dol_now(); + + $this->db->begin(); + + // ... + + $this->db->commit(); + + return $error; + } +} + + +/** + * Class for BillOfMaterialsLine + */ +class BillOfMaterialsLine extends CommonObject +{ + /** + * @var string ID to identify managed object + */ + public $element = 'bomline'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'bom_bomline'; + + /** + * @var int Does bomline support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var int Does bomline support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 1; + + /** + * @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png + */ + public $picto = 'bomline@bom'; + + + /** + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, '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 $rank; + // END MODULEBUILDER PROPERTIES + + + + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'bomlinedet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + //public $fk_element = 'fk_bomline'; + + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'BillOfMaterialsLineline'; + + /** + * @var array Array of child tables (child tables to delete before deleting a record) + */ + //protected $childtables=array('bomlinedet'); + + /** + * @var BillOfMaterialsLineLine[] Array of subtable lines + */ + //public $lines = array(); + + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs, $user; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0; + + // Unset fields that are disabled + foreach($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + foreach($this->fields as $key => $val) + { + if (is_array($this->fields['status']['arrayofkeyval'])) + { + foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + { + $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone an object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $langs, $hookmanager, $extrafields; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $object->fetchCommon($fromid); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->element); + foreach($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + /*public function fetchLines() + { + $this->lines=array(); + + // Load lines with object BillOfMaterialsLineLine + + return count($this->lines)?1:0; + }*/ + + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records=array(); + + $sql = 'SELECT'; + $sql .= ' t.rowid'; + // TODO Get all fields + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + $sql .= ' WHERE t.entity = '.$conf->entity; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key=='t.rowid') { + $sqlwhere[] = $key . '='. $value; + } + elseif (strpos($key, 'date') !== false) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } + elseif ($key=='customsql') { + $sqlwhere[] = $value; + } + else { + $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) + { + $record = new self($this->db); + + $record->id = $obj->rowid; + // TODO Get other fields + + //var_dump($record->id); + $records[$record->id] = $record; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + + $label = '' . $langs->trans("BillOfMaterialsLine") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = dol_buildpath('/bom/bomline_card.php', 1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowBillOfMaterialsLine"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + + /* + $hookmanager->initHooks(array('bomlinedao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action,$hookmanager; + $hookmanager->initHooks(array('bomlinedao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } + + /** + * Return label of the status + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return the status + * + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + if (empty($this->labelstatus)) + { + global $langs; + //$langs->load("bom"); + $this->labelstatus[1] = $langs->trans('Enabled'); + $this->labelstatus[0] = $langs->trans('Disabled'); + } + + if ($mode == 0) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 1) + { + return $this->labelstatus[$status]; + } + 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]; + } + 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'); + } + 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]; + } + 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'); + } + 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'); + } + } + + /** + * Load the info information in the object + * + * @param int $id Id of object + * @return void + */ + public function info($id) + { + $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; + $sql.= ' fk_user_creat, fk_user_modif'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql.= ' WHERE t.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + } + + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } + + + /** + * Action executed by scheduler + * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + //public function doScheduledJob($param1, $param2, ...) + public function doScheduledJob() + { + global $conf, $langs; + + //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; + + $error = 0; + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $now = dol_now(); + + $this->db->begin(); + + // ... + + $this->db->commit(); + + return $error; + } +} diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php new file mode 100644 index 00000000000..d804ec375cd --- /dev/null +++ b/htdocs/bom/lib/bom.lib.php @@ -0,0 +1,124 @@ + + * + * 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 bom/lib/bom.lib.php + * \ingroup bom + * \brief Library files with common functions for BillOfMaterials + */ + +/** + * Prepare admin pages header + * + * @return array + */ +function bomAdminPrepareHead() +{ + global $langs, $conf; + + $langs->load("bom@bom"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/bom/admin/setup.php", 1); + $head[$h][1] = $langs->trans("Settings"); + $head[$h][2] = 'settings'; + $h++; + + /*$head[$h][0] = dol_buildpath("/bom/admin/about.php", 1); + $head[$h][1] = $langs->trans("About"); + $head[$h][2] = 'about'; + $h++; + */ + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom'); + + return $head; +} + + + + +/** + * Prepare array of tabs for BillOfMaterials + * + * @param BillOfMaterials $object BillOfMaterials + * @return array Array of tabs + */ +function bomPrepareHead($object) +{ + global $db, $langs, $conf; + + $langs->load("bom@bom"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/bom/bom_card.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) + { + $nbNote = 0; + if (!empty($object->note_private)) $nbNote++; + if (!empty($object->note_public)) $nbNote++; + $head[$h][0] = dol_buildpath('/bom/bom_note.php', 1).'?id='.$object->id; + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + $head[$h][2] = 'note'; + $h++; + } + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); + $nbLinks=Link::count($db, $object->element, $object->id); + $head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans('Documents'); + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + $head[$h][2] = 'document'; + $h++; + + $head[$h][0] = dol_buildpath("/bom/bom_agenda.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + $head[$h][2] = 'agenda'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom'); + + return $head; +} diff --git a/htdocs/bom/modulebuilder.txt b/htdocs/bom/modulebuilder.txt new file mode 100644 index 00000000000..24ea0d6eac5 --- /dev/null +++ b/htdocs/bom/modulebuilder.txt @@ -0,0 +1,3 @@ +# DO NOT DELETE THIS FILE MANUALLY +# File to flag module built using official module template. +# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module. \ No newline at end of file diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 3c455f102f9..a7aab12b2ef 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $action = GETPOST('action', 'alpha'); $obj_facturation = unserialize($_SESSION['serObjFacturation']); -unset ($_SESSION['serObjFacturation']); +unset($_SESSION['serObjFacturation']); switch($action) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b75878b11bd..9d47c63a75a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -359,7 +359,7 @@ switch ($action) // End of case: valide_facture } -unset ($_SESSION['serObjFacturation']); +unset($_SESSION['serObjFacturation']); $_SESSION['serObjFacturation'] = serialize($obj_facturation); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index f5b13437ba9..2b670ae5286 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -220,7 +220,7 @@ class Categories extends DolibarrApi if ($this->category->update(DolibarrApiAccess::$user) > 0) { - return $this->get ($id); + return $this->get($id); } else { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 20d9a862f33..99433a9b8f0 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1472,8 +1472,7 @@ class Categorie extends CommonObject // We want to reverse lookup $map_type = array_flip($this->MAP_ID); $type = $map_type[$type]; -dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", - LOG_WARNING ); + dol_syslog(get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", LOG_WARNING); } // Generation requete recherche diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 596cc20c9e0..b542cf4dd67 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -895,7 +895,7 @@ if ($action == 'create') $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").' '; $urloption='?action=create'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; @@ -1293,7 +1293,7 @@ if ($id > 0) $numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").' '; } 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 '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
 
'.$link.'
'; + print '
'; $file = "movement".$account."-".$year.$month.".png"; print $show4; print '
'; + print '
'; print $show1; print '
'.$link.'
'; + print '
'; print $show5; print '
'; + print '
'; print $show2; print '
'; + print '
'; print $show3; print '
'; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '
'; + print ''; print $obj->currency_code; print ''; + print ''; if ($obj->rappro) { $result=$obj->load_board($user, $obj->id); @@ -526,7 +526,7 @@ foreach ($accounts as $key=>$type) // Date creation if (! empty($arrayfields['b.datec']['checked'])) { - print ''; + print ''; print dol_print_date($obj->date_creation, 'dayhour'); print ''; + print ''; print dol_print_date($obj->date_update, 'dayhour'); print ''.$obj->getLibStatut(5).''.$obj->getLibStatut(5).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 6c6a8447c5a..ac4d17e4c49 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -496,7 +496,7 @@ if (empty($numref)) } print ''.price(($balancestart[$objp->numr]+$content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).''; + print ''; if ($user->rights->banque->consolidate && $action != 'editbankreceipt') { print 'numr.'">'.img_edit().''; } @@ -540,10 +540,10 @@ else print ''; print '
'; - print ''; + print '
'; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -589,10 +589,10 @@ else print ''; // Date operation - print ''; + print ''; // Date de valeur - print '"; } else { - print ""; + print ""; } print ""; $i++; @@ -793,11 +793,11 @@ else } // Line Total - print "\n".'"; + print "\n".'"; // Line Balance print "\n"; - print ""; + print ""; print '"; print "\n"; print "
'.$langs->trans("DateOperationShort").''.$langs->trans("DateValueShort").''.$langs->trans("DateOperationShort").''.$langs->trans("DateValueShort").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").'
'.dol_print_date($db->jdate($objp->do), "day").''.dol_print_date($db->jdate($objp->do), "day").''; + print ''; print dol_print_date($db->jdate($objp->dv), "day") .' '; print ''; print img_edit_remove() . " "; @@ -778,13 +778,13 @@ else if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print ''; + print ''; print img_edit(); print "  
'.$langs->trans("Total")." :".price($totald)."".price($totalc)."  
'.$langs->trans("Total")." :".price($totald)."".price($totalc)."  
 ".$langs->trans("EndBankBalance")." : ".$langs->trans("EndBankBalance")." :'.price(price2num($total, 'MT'))." 
"; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 2d81facbad2..b3624e274f2 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -180,7 +180,7 @@ if ($result) print '
'; + print ''; print ''; print ''; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); print '
"; + print ""; if ($obj->sens == 0) { print price($obj->amount); @@ -309,7 +309,7 @@ if ($result) print ""; + print ""; if ($obj->sens == 1) { print price($obj->amount); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 518b505efc5..594639e74cd 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -247,7 +247,7 @@ class Deplacement extends CommonObject */ function fetch($id, $ref = '') { - $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams"; + $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " WHERE entity IN (".getEntity('deplacement').")"; if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'"; @@ -269,7 +269,7 @@ class Deplacement extends CommonObject $this->statut = $obj->fk_statut; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->extraparams = (array) json_decode($obj->extraparams, true); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6b633f99309..e3e67f23585 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2696,7 +2696,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print '
' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ''; + print '   id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ' '; print '
">">

- \ No newline at end of file + diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php index 32e6643a53f..f1cc60bffd3 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php @@ -149,7 +149,7 @@ echo $this->control->tpl['ajax_selectcountry'];
+ ">  "> '; + print ''; print ''.$langs->trans('CopyAddressFromSoc').''; print '
facebook).'">
linkedin).'">
twitter).'">
facebook).'">
facebook).'">
linkedin).'">
'; + print ''; print ''; print ''; print ''; // TODO: Add filters ! + print ''; // TODO: Add filters ! print ''; + print ''; print ''; + print ''; print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -399,8 +399,8 @@ if ($sql_select) // Titles with sort buttons print '
'; print $documentstatic->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dateprint), 'day').''.dol_print_date($db->jdate($objp->dateprint), 'day').''; + print ''; if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); @@ -616,17 +616,15 @@ if ($sql_select) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); } $db->free($resql); -} -elseif (empty($type_element) || $type_element == -1) -{ +} elseif (empty($type_element) || $type_element == -1) { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', ''); print ''."\n"; // Titles with sort buttons print ''; print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); - print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; @@ -634,8 +632,7 @@ elseif (empty($type_element) || $type_element == -1) print ''; print "
'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'
"; -} -else { +} else { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', ''); print ''."\n"; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 71d86016fe6..897dfaf557b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -10,6 +10,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,9 +69,11 @@ $search_phone_pro=GETPOST("search_phone_pro", 'alpha'); $search_phone_mobile=GETPOST("search_phone_mobile", 'alpha'); $search_fax=GETPOST("search_fax", 'alpha'); $search_email=GETPOST("search_email", 'alpha'); +$search_no_email=GETPOST("search_no_email", 'int'); $search_skype=GETPOST("search_skype", 'alpha'); $search_twitter=GETPOST("search_twitter", 'alpha'); $search_facebook=GETPOST("search_facebook", 'alpha'); +$search_linkedin=GETPOST("search_linkedin", 'alpha'); $search_priv=GETPOST("search_priv", 'alpha'); $search_categ=GETPOST("search_categ", 'int'); $search_categ_thirdparty=GETPOST("search_categ_thirdparty", 'int'); @@ -159,10 +162,12 @@ $arrayfields=array( 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), 'p.fax'=>array('label'=>"Fax", 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'checked'=>1), + 'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))), 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), + 'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200), 'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), @@ -222,9 +227,11 @@ if (empty($reshook)) $search_phone_mobile=""; $search_fax=""; $search_email=""; + $search_no_email=-1; $search_skype=""; $search_twitter=""; $search_facebook=""; + $search_linkedin=""; $search_priv=""; $search_status=-1; $search_categ=''; @@ -258,7 +265,7 @@ $contactstatic=new Contact($db); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $sql = "SELECT s.rowid as socid, s.nom as name,"; -$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,"; +$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email, p.skype,"; $sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql.= " co.code as country_code"; // Add fields from extrafields @@ -321,10 +328,12 @@ if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); if (strlen($search_twitter)) $sql.= natural_search('p.twitter', $search_twitter); if (strlen($search_facebook)) $sql.= natural_search('p.facebook', $search_facebook); +if (strlen($search_linkedin)) $sql.= natural_search('p.linkedin', $search_linkedin); if (strlen($search_email)) $sql.= natural_search('p.email', $search_email); if (strlen($search_zip)) $sql.= natural_search("p.zip", $search_zip); if (strlen($search_town)) $sql.= natural_search("p.town", $search_town); +if ($search_no_email != '' && $search_no_email >= 0) $sql.= " AND p.no_email = ".$db->escape($search_no_email); if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status); if ($search_import_key) $sql.= natural_search("p.import_key", $search_import_key); if ($type == "o") // filtre sur type @@ -422,6 +431,7 @@ if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($sea if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax); if ($search_email != '') $param.='&search_email='.urlencode($search_email); +if ($search_no_email != '') $param.='&search_no_email='.urlencode($search_no_email); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); @@ -607,6 +617,12 @@ if (! empty($arrayfields['p.email']['checked'])) print ''; print ''; } +if (! empty($arrayfields['p.no_email']['checked'])) +{ + print ''; +} if (! empty($arrayfields['p.skype']['checked'])) { print ''; } +if (! empty($arrayfields['p.linkedin']['checked'])) +{ + print ''; +} if (! empty($arrayfields['p.thirdparty']['checked'])) { print '\n"; @@ -824,7 +863,12 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; } - + // No EMail + if (! empty($arrayfields['p.no_email']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Skype if (! empty($arrayfields['p.skype']['checked'])) { @@ -844,12 +888,18 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['nbfield']++; } // Facebook - if (! empty($arrayfields['p.facebook']['checked'])) - { - if (! empty($conf->socialnetworks->enabled)) { print ''; } - if (! $i) $totalarray['nbfield']++; - } - // Company + if (! empty($arrayfields['p.facebook']['checked'])) + { + if (! empty($conf->socialnetworks->enabled)) { print ''; } + if (! $i) $totalarray['nbfield']++; + } + // LinkedIn + if (! empty($arrayfields['p.linkedin']['checked'])) + { + if (! empty($conf->socialnetworks->enabled)) { print ''; } + if (! $i) $totalarray['nbfield']++; + } + // Company if (! empty($arrayfields['p.thirdparty']['checked'])) { print ''; // Photo - print ''; } print ''."\n"; @@ -1254,7 +1254,7 @@ if ($action == 'create') print '"; } @@ -1563,14 +1563,14 @@ else print ''; print ''; print ''; - print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''; } print ''; - if ($conf->global->PRODUCT_USE_UNITS) print ''; - print ''; - if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''; + if ($conf->global->PRODUCT_USE_UNITS) print ''; + print ''; + if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''; print ''; print "\n"; @@ -1618,10 +1618,10 @@ else print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits); print ''; // Price - print '\n"; + print '\n"; // Price multicurrency if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''; } // Quantite print ''; @@ -1630,7 +1630,7 @@ else // Remise if ($objp->remise_percent > 0) { - print '\n"; + print '\n"; } else { @@ -1641,7 +1641,7 @@ else if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''; // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) - print ''; - print ''; - print ''; + print ''; print ''; if ($conf->global->PRODUCT_USE_UNITS) { @@ -1757,10 +1757,10 @@ else print $form->selectUnits($objp->fk_unit, "unit"); print ''; } - print ''; + print ''; if (! empty($usemargins)) { - print ''; } @@ -1880,7 +1880,7 @@ else print ''; print ''; - print ''; print ''; - print ''; + print ''; print "\n"; } if ($status==4 && ! $bool) $bool=true; @@ -218,15 +218,15 @@ foreach($listofstatus as $status) { print ''; print ''; - print ''; + print ''; if ($status==4 && ! $bool) $bool=true; else $bool=false; print "\n"; } } //if ($totalinprocess != $total) -//print ''; -print ''; +//print ''; +print ''; print "
'; + print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email); + print ''; @@ -625,6 +641,12 @@ if (! empty($arrayfields['p.facebook']['checked'])) print ''; print ''; + print ''; + print ''; @@ -688,28 +710,45 @@ if (! empty($arrayfields['p.zip']['checked'])) print_liste_field if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'], $_SERVER["PHP_SELF"], "p.town", $begin, $param, '', $sortfield, $sortorder); //if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); //if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "co.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) { + print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "co.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); +} if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'], $_SERVER["PHP_SELF"], "p.phone", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'], $_SERVER["PHP_SELF"], "p.phone_perso", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$parameters = array( + 'arrayfields'=>$arrayfields, + 'param'=>$param, + 'sortfield'=>$sortfield, + 'sortorder'=>$sortorder, +); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); -if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); -if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, '', $sortfield, $sortorder, 'center '); -if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center '); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['p.datec']['checked'])) { + print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +} +if (! empty($arrayfields['p.tms']['checked'])) { + print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +} +if (! empty($arrayfields['p.statut']['checked'])) { + print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, '', $sortfield, $sortorder, 'center '); +} +if (! empty($arrayfields['p.import_key']['checked'])) { + print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center '); +} +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18).''.yn($obj->no_email).''.dol_print_socialnetworks($obj->facebook, $obj->rowid, $obj->socid, 'facebook').''.dol_print_socialnetworks($obj->facebook, $obj->rowid, $obj->socid, 'facebook').''.dol_print_socialnetworks($obj->linkedin, $obj->rowid, $obj->socid, 'linkedin').''; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 6114f49930c..118ad0f5c67 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -157,13 +157,13 @@ if ($action == 'edit') print ''; + print ''; print $form->showphoto('contact', $object)."\n"; if ($object->photo) print "
\n"; print ''; - if ($object->photo) print ''; + if ($object->photo) print ''; print ''; print ''; print '
'.$langs->trans("Delete").'

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

'.$langs->trans("PhotoFile").'
'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 40242ee8068..d3026d0264e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1212,7 +1212,7 @@ if ($action == 'create') { print '
'; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print '
'.$langs->trans("Project").''; $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 "
'.$langs->trans("ServiceNb", $cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("PriceUHT").''.$langs->trans("PriceUHTCurrency").''.$langs->trans("PriceUHTCurrency").''.$langs->trans("Qty").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").''.$langs->trans("BuyingPrice").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").''.$langs->trans("BuyingPrice").' 
'.($objp->subprice != '' ? price($objp->subprice) : '')."'.($objp->subprice != '' ? price($objp->subprice) : '')."'.price($objp->multicurrency_subprice).''.price($objp->multicurrency_subprice).''.$objp->qty.''.$objp->remise_percent."%'.$objp->remise_percent."%'.price($objp->pa_ht).''; + print ''; if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) { print ''; @@ -1746,10 +1746,10 @@ else $doleditor->Create(); print ''; + print ''; print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1); print '%%'; + print ''; if ($objp->fk_product) print ''; print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; + print ''; if ($user->societe_id == 0) { if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline') diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6e907699f22..f657f7746fa 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -621,7 +621,7 @@ class Contrat extends CommonObject $sql.= " ref_ext,"; $sql.= " fk_user_mise_en_service, date_contrat as datecontrat,"; $sql.= " fk_user_author, fin_validite, date_cloture,"; - $sql.= " fk_projet,"; + $sql.= " fk_projet as fk_project,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " note_private, note_public, model_pdf, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; @@ -672,8 +672,8 @@ class Contrat extends CommonObject $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf; - $this->fk_projet = $obj->fk_projet; // deprecated - $this->fk_project = $obj->fk_projet; + $this->fk_projet = $obj->fk_project; // deprecated + $this->fk_project = $obj->fk_project; $this->socid = $obj->fk_soc; $this->fk_soc = $obj->fk_soc; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 5b3493a7249..1e8fbcbfdee 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -156,11 +156,11 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 60daaa22ce4..64ecff642f7 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -128,11 +128,11 @@ if ($object->id) $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index dfcb1e8457c..05135f39aeb 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -189,7 +189,7 @@ foreach($listofstatus as $status) print '
'.$staticcontratligne->LibStatut($status, 0, ($bool?1:0)).''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).'
'.$staticcontratligne->LibStatut($status, 0, ($bool?1:0)).''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).'
'.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'
'.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; @@ -332,7 +332,7 @@ if ($result) print '
'.$langs->trans("LastContracts", 5).''.$langs->trans("DateModification").''.$langs->trans("Status").''.$langs->trans("Status").''.$langs->trans("Services").'
'.dol_print_date($db->jdate($obj->tms), 'dayhour').''.$staticcontrat->LibStatut($obj->statut,2).''.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3):'').''.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0):'').''.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1):'').''.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3):'').''.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3):'').''.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0):'').''.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1):'').''.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3):'').'
'; + print ''; $dateend=$db->jdate($obj->date_fin_validite); print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0); print ''; + print ''; print $staticcontratligne->LibStatut($obj->statut, 3); print '
'; + print ''; print $staticcontratligne->LibStatut($obj->statut, 3, 1); print '
'; $searchpicto=$form->showFilterButtons(); diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 1ab0edfbcf3..886e836f10e 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -96,11 +96,11 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 68f8595c294..f2d827b87cb 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -394,7 +394,7 @@ $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // N print $hookmanager->resPrint; if (! empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, 'align="right"', $sortfield, $sortorder); +if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "
'; + print ''; $arrayofstatus=array( '0'=>$langs->trans("ServiceStatusInitial"), '4'=>$langs->trans("ServiceStatusRunning"), @@ -523,7 +523,7 @@ if (! empty($arrayfields['status']['checked'])) print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; print price($obj->total_ht); print ''; + print ''; print price($obj->total_tva); print ''; + print ''; print price2num($obj->tva_tx).'%'; print ''; + print ''; print price($obj->subprice); print ''; + print ''; if ($obj->cstatut == 0) // If contract is draft, we say line is also draft { print $contractstatic->LibStatut(0, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)); @@ -735,9 +735,9 @@ if (isset($totalarray['displaytotalline'])) { if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
getNomUrl(1); ?> date_contrat, 'day'); ?> $objectlink) } echo price($totalcontrat); } ?>getLibStatut(7); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(7); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'; + print ''; print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' '; print ''; @@ -433,19 +433,19 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, print ''.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').''.img_edit_add().' '.img_edit_add().' '; + print ''; $userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0; $userstatic->lastname=isset($val['login_c'])?$val['login_c']:0; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 9f7a457e238..c3cdbcef412 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -28,18 +28,18 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_graph_orders_supplier_permonth extends ModeleBoxes { - var $boxcode="orderssupplierpermonth"; - var $boximg="object_order"; - var $boxlabel="BoxSuppliersOrdersPerMonth"; - var $depends = array("fournisseur"); + public $boxcode="orderssupplierpermonth"; + public $boximg="object_order"; + public $boxlabel="BoxSuppliersOrdersPerMonth"; + public $depends = array("fournisseur"); - /** + /** * @var DoliDB Database handler. */ public $db; - var $info_box_head = array(); - var $info_box_contents = array(); + public $info_box_head = array(); + public $info_box_contents = array(); /** diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index c8c3d9c94b6..e041c0ab197 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005-2012 Maxime Kohlhaas - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2019 Frédéric France * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -117,6 +117,8 @@ class box_produits_alerte_stock extends ModeleBoxes while ($line < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); + $price = ''; + $price_base_type = ''; // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index f08586ba9b0..f03915b7b2a 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -89,21 +89,17 @@ class box_project extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $projectstatic = new Project($this->db); - $socid=$user->societe_id; + $socid=0; + //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. - // Get list of project id allowed to user (in a string list separated by coma) + // Get list of project id allowed to user (in a string list separated by coma) $projectsListId=''; if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; - if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; - $sql.= " WHERE p.entity IN (".getEntity('project').')'; - if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users - if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; - $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; + $sql.= " WHERE p.fk_statut = 1"; // Only open projects + if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users $sql.= " ORDER BY p.datec DESC"; //$sql.= $db->plimit($max, 0); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 98d7e720628..c1b483efe8c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -570,7 +570,7 @@ abstract class CommonDocGenerator 'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs), ); - // Units + // Units if ($conf->global->PRODUCT_USE_UNITS) { $resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long')); @@ -882,7 +882,7 @@ abstract class CommonDocGenerator // Sorting - uasort ($this->cols, array( $this, 'columnSort' )); + uasort($this->cols, array($this, 'columnSort')); // Positionning $curX = $this->page_largeur-$this->marge_droite; // start from right @@ -945,10 +945,10 @@ abstract class CommonDocGenerator } /** - * get column content width from column key + * get column content width from column key * - * @param string $colKey the column key - * @return float width in mm + * @param string $colKey the column key + * @return float width in mm */ function getColumnContentWidth($colKey) { @@ -1025,13 +1025,13 @@ abstract class CommonDocGenerator /** - * print standard column content + * print standard column content * - * @param PDF $pdf pdf object - * @param float $curY curent Y position - * @param string $colKey the column key - * @param string $columnText column text - * @return int new rank on success and -1 on error + * @param PDF $pdf pdf object + * @param float $curY curent Y position + * @param string $colKey the column key + * @param string $columnText column text + * @return int new rank on success and -1 on error */ function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1f86d60598c..98b9d93580a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -672,6 +672,8 @@ abstract class CommonObject $outdone++; if ($this->facebook) $out.=dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook'); $outdone++; + if ($this->linkedin) $out.=dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin'); + $outdone++; } $out.=''; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 2a92d14c7b9..7fd9258ddd7 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -936,7 +936,7 @@ class DolGraph $tag=dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-','.')))); $this->stringtoshow =''."\n"; - if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; + if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; if (! empty($this->shownographyet)) { $this->stringtoshow.='
'; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 5c9797a2407..63172d17566 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -303,17 +303,6 @@ class EmailSenderProfile extends CommonObject return $result; } - /** - * Return link to download file from a direct external access - * - * @param int $withpicto Add download picto into link - * @return string HTML link to file - */ - function getDirectExternalLink($withpicto = 0) - { - return 'todo'; - } - /** * Retourne le libelle du status d'un user (actif, inactif) * diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 921878aef73..c23f40a0283 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2015 Charles-Fr BENKE * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2017 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,84 +42,138 @@ class ExtraFields */ public $db; - // type of element (for what object is the extrafield) - // @deprecated - var $attribute_elementtype; - // Array with type of the extra field - // @deprecated - var $attribute_type; - // Array with label of extra field - // @deprecated - var $attribute_label; - // Array with size of extra field - // @deprecated - var $attribute_size; - // array with list of possible values for some types of extra fields - // @deprecated - var $attribute_choice; - // Array to store compute formula for computed fields - // @deprecated - var $attribute_computed; - // Array to store default value - // @deprecated - var $attribute_default; - // Array to store if attribute is unique or not - // @deprecated - var $attribute_unique; - // Array to store if attribute is required or not - // @deprecated - var $attribute_required; - // Array to store parameters of attribute (used in select type) - // @deprecated - var $attribute_param; - // Array to store position of attribute - // @deprecated - var $attribute_pos; - // Array to store if attribute is editable regardless of the document status - // @deprecated - var $attribute_alwayseditable; - // Array to store permission to check - // @deprecated - var $attribute_perms; - // Array to store language file to translate label of values - // @deprecated - var $attribute_langfile; - // Array to store if field is visible by default on list - // @deprecated - var $attribute_list; + /** + * @var string type of element (for what object is the extrafield) + * @deprecated + */ + public $attribute_elementtype; - // New array to store extrafields definition - var $attributes; + /** + * @var array Array with type of the extra field + * @deprecated + */ + public $attribute_type; + + /** + * @var array Array with label of extra field + * @deprecated + */ + public $attribute_label; + + /** + * @var array Array with size of extra field + * @deprecated + */ + public $attribute_size; + + /** + * @var array Array with list of possible values for some types of extra fields + * @deprecated + */ + public $attribute_choice; + + /** + * @var array Array to store compute formula for computed fields + * @deprecated + */ + public $attribute_computed; + + /** + * @var array Array to store default value + * @deprecated + */ + public $attribute_default; + + /** + * @var array Array to store if attribute is unique or not + * @deprecated + */ + public $attribute_unique; + + /** + * @var array Array to store if attribute is required or not + * @deprecated + */ + public $attribute_required; + + /** + * @var array Array to store parameters of attribute (used in select type) + * @deprecated + */ + public $attribute_param; + + /** + * @var array Array to store position of attribute + * @deprecated + */ + public $attribute_pos; + + /** + * @var array Array to store if attribute is editable regardless of the document status + * @deprecated + */ + public $attribute_alwayseditable; + + /** + * @var array Array to store permission to check + * @deprecated + */ + public $attribute_perms; + + /** + * @var array Array to store language file to translate label of values + * @deprecated + */ + public $attribute_langfile; + + /** + * @var array Array to store if field is visible by default on list + * @deprecated + */ + public $attribute_list; + + /** + * @var array New array to store extrafields definition + */ + public $attributes; /** * @var string Error code (or message) */ public $error=''; - var $errno; + /** + * @var string[] Array of Error code (or message) + */ + public $errors = array(); + + /** + * @var string DB Error number + */ + public $errno; public static $type2label=array( - 'varchar'=>'String', - 'text'=>'TextLong', - 'html'=>'HtmlText', - 'int'=>'Int', - 'double'=>'Float', - 'date'=>'Date', - 'datetime'=>'DateAndTime', - 'boolean'=>'Boolean', - 'price'=>'ExtrafieldPrice', - 'phone'=>'ExtrafieldPhone', - 'mail'=>'ExtrafieldMail', - 'url'=>'ExtrafieldUrl', - 'password' => 'ExtrafieldPassword', - 'select' => 'ExtrafieldSelect', - 'sellist' => 'ExtrafieldSelectList', - 'radio' => 'ExtrafieldRadio', - 'checkbox' => 'ExtrafieldCheckBox', - 'chkbxlst' => 'ExtrafieldCheckBoxFromList', - 'link' => 'ExtrafieldLink', - 'separate' => 'ExtrafieldSeparator', + 'varchar'=>'String', + 'text'=>'TextLong', + 'html'=>'HtmlText', + 'int'=>'Int', + 'double'=>'Float', + 'date'=>'Date', + 'datetime'=>'DateAndTime', + 'boolean'=>'Boolean', + 'price'=>'ExtrafieldPrice', + 'phone'=>'ExtrafieldPhone', + 'mail'=>'ExtrafieldMail', + 'url'=>'ExtrafieldUrl', + 'password' => 'ExtrafieldPassword', + 'select' => 'ExtrafieldSelect', + 'sellist' => 'ExtrafieldSelectList', + 'radio' => 'ExtrafieldRadio', + 'checkbox' => 'ExtrafieldCheckBox', + 'chkbxlst' => 'ExtrafieldCheckBoxFromList', + 'link' => 'ExtrafieldLink', + 'separate' => 'ExtrafieldSeparator', ); @@ -131,7 +185,8 @@ class ExtraFields function __construct($db) { $this->db = $db; - $this->error = array(); + $this->error = ''; + $this->errors = array(); $this->attributes = array(); // For old usage @@ -430,6 +485,7 @@ class ExtraFields if ($result < 0) { $this->error=$this->db->lasterror(); + $this->errors[]=$this->db->lasterror(); $error++; } @@ -450,6 +506,7 @@ class ExtraFields if ($result < 0) { $this->error=$this->db->lasterror(); + $this->errors[]=$this->db->lasterror(); $error++; } } @@ -1885,7 +1942,7 @@ class ExtraFields /** * Fill array_options property of object by extrafields value (using for data sent by forms) * - * @param array $extralabels $array of extrafields (@deprecated) + * @param array $extralabels Deprecated $array of extrafields * @param object $object Object * @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset. * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 647460e049c..ce5c27f3b8c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2266,7 +2266,7 @@ class Form $objp->remise_percent = $objp2->remise_percent; $objp->remise = $objp2->remise; - $this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel); + $this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel, $filterkey); $j++; @@ -2293,7 +2293,7 @@ class Form $objp->price_ttc = price2num($objp->price_ttc, 'MU'); } } - $this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel); + $this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel, $filterkey); // Add new entry // "key" value of json key array is used by jQuery automatically as selected value // "label" value of json key array is used by jQuery automatically as text for combo box @@ -2318,7 +2318,8 @@ class Form } /** - * constructProductListOption + * constructProductListOption. + * This define value for &$opt and &$optJson. * * @param resultset $objp Resultset of fetch * @param string $opt Option (var used for returned value in string option format) @@ -2326,11 +2327,12 @@ class Form * @param int $price_level Price level * @param string $selected Preselected value * @param int $hidepriceinlabel Hide price in label + * @param string $filterkey Filter key to highlight * @return void */ - private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0) + private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '') { - global $langs,$conf,$user,$db; + global $langs, $conf, $user, $db; $outkey=''; $outval=''; @@ -2368,7 +2370,7 @@ class Form { $opt.= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; } - if (! empty($conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) + if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"'; elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; @@ -2509,14 +2511,38 @@ class Form $outtva_tx=$objp->tva_tx; } - if (! empty($conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) + if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) { $opt.= ' - '.$langs->trans("Stock").':'.$objp->stock; if ($objp->stock > 0) { - $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + $outval.= ' - '; }elseif ($objp->stock <= 0) { - $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + $outval.= ' - '; + } + $outval.= $langs->transnoentities("Stock").':'.$objp->stock; + $outval.= ''; + if (! empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation + { + $langs->load("stocks"); + + $tmpproduct=new Product($this->db); + $tmpproduct->fetch($objp->rowid); + $tmpproduct->load_virtual_stock(); + $virtualstock = $tmpproduct->stock_theorique; + + $opt.= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; + + $outval.=' - '.$langs->transnoentities("VirtualStock").':'; + if ($virtualstock > 0) { + $outval.= ' - '; + }elseif ($virtualstock <= 0) { + $outval.= ' - '; + } + $outval.=$virtualstock; + $outval.=''; + + unset($tmpproduct); } } @@ -3656,6 +3682,75 @@ class Form return $num; } + /** + * Return a HTML select list of establishment + * + * @param string $selected Id establishment pre-selected + * @param string $htmlname Name of select zone + * @param int $statut Status of searched establishment (0=open, 1=closed, 2=both) + * @param string $filtre To filter list + * @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 + * @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...) + */ + function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '') + { + // phpcs:enable + global $langs, $conf; + + $langs->load("admin"); + $num = 0; + + $sql = "SELECT rowid, name, fk_country, status, entity"; + $sql.= " FROM ".MAIN_DB_PREFIX."establishment"; + $sql.= " WHERE 1=1"; + if ($statut != 2) $sql.= " AND status = '".$statut."'"; + if ($filtre) $sql.=" AND ".$filtre; + $sql.= " ORDER BY name"; + + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; + if ($num) + { + print '"; + } + else + { + if ($statut == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").''; + else print ''.$langs->trans("NoEstablishmentFound").''; + } + } + else { + dol_print_error($this->db); + } + } + /** * Display form to select bank account * @@ -4729,7 +4824,7 @@ class Form $out=''; $out.= ''."\n"; if (is_array($array) && ! empty($array)) { @@ -6152,7 +6246,7 @@ class Form foreach ($array as $key => $value) { $out.= '
'.$options.''; - $out .= ' '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName")); - $out .= '
'.$options.''; + $out .= ' '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName")); + $out .= '
"; @@ -271,7 +286,7 @@ class FormFile * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) - * @param int $genallowed Generation is allowed (1/0 or array list of templates) + * @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) * @param string $modelselected Model to preselect by default * @param integer $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) @@ -1202,8 +1217,6 @@ class FormFile } // Preview link if (! $editline) print $this->showPreview($file, $modulepart, $filepath); - // Public share link - //if (! $editline && ! empty($filearray[$key]['hashp'])) print pictowithlinktodirectdownload; print "
'; print ''; -print_liste_field_titre( + print_liste_field_titre( $langs->trans("Links"), $_SERVER['PHP_SELF'], "name", @@ -1732,7 +1737,7 @@ print_liste_field_titre( $sortfield, $sortorder ); -print_liste_field_titre( + print_liste_field_titre( "", "", "", @@ -1740,7 +1745,7 @@ print_liste_field_titre( "", 'class="right"' ); -print_liste_field_titre( + print_liste_field_titre( $langs->trans("Date"), $_SERVER['PHP_SELF'], "date", @@ -1750,7 +1755,7 @@ print_liste_field_titre( $sortfield, $sortorder ); -print_liste_field_titre( + print_liste_field_titre( '', $_SERVER['PHP_SELF'], "", @@ -1827,7 +1832,7 @@ print_liste_field_titre( * @param array $file Array with data of file. Example: array('name'=>...) * @param string $modulepart propal, facture, facture_fourn, ... * @param string $relativepath Relative path of docs - * @param string $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) + * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links * @return string $out Output string with HTML */ diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 752d2406ea4..1159c74dc8d 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2015-2017 Marcos García * Copyright (C) 2015-2017 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -228,9 +228,9 @@ class FormMail extends Form if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';', $_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { - unset ($listofpaths[$keytodelete]); - unset ($listofnames[$keytodelete]); - unset ($listofmimes[$keytodelete]); + unset($listofpaths[$keytodelete]); + unset($listofnames[$keytodelete]); + unset($listofmimes[$keytodelete]); $_SESSION["listofpaths".$keytoavoidconflict]=join(';', $listofpaths); $_SESSION["listofnames".$keytoavoidconflict]=join(';', $listofnames); $_SESSION["listofmimes".$keytoavoidconflict]=join(';', $listofmimes); @@ -455,7 +455,7 @@ class FormMail extends Form } if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this. { - $out.= ''; // Severity print ''; - // Category - print ''; // Notify thirdparty at creation @@ -532,7 +533,7 @@ class FormTicket * @param string $morecss More CSS * @return void */ - public function selectAnalyticCodesTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') + public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') { global $langs, $user; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f59ad79c430..695464f536f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -655,7 +655,7 @@ class SMTPs $_retVal = true; // if we have a path... - if ( ! empty ($_strConfigPath) ) + if ( ! empty($_strConfigPath) ) { // If the path is not valid, this will NOT generate an error, // it will simply return false. @@ -989,7 +989,7 @@ class SMTPs $aryHost = $this->_msgRecipients; // Only run this if we have something - if ( !empty ($_addrList)) + if ( !empty($_addrList)) { // $_addrList can be a STRING or an array if ( is_string($_addrList) ) @@ -1409,7 +1409,7 @@ class SMTPs // If we have ZERO, we have a problem if( $keyCount === 0 ) - die ("Sorry, no content"); + die("Sorry, no content"); // If we have ONE, we can use the simple format elseif( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) diff --git a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php index f7df05acdde..81f536f5228 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php +++ b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php @@ -101,7 +101,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) sLink + fileName + '<\/a>' + - '<\/td>'; + // print ''; } else { @@ -410,13 +410,13 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if ($error == 0) { if (! $silent) print ''; - if (! $silent) print ''."\n"; + if (! $silent) print ''."\n"; $ok = 1; } else { if (! $silent) print ''; - if (! $silent) print ''."\n"; + if (! $silent) print ''."\n"; $ok = 0; } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index c24cc0928ed..531b90b75e3 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -239,7 +239,7 @@ function show_array_actions_to_do($max = 5) print '
'; + $out.= '
'; //$out.='
'; if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // New usage @@ -1140,7 +1140,7 @@ class FormMail extends Form * @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found) * @param int $active 1=Only active template, 0=Only disabled, -1=All * @param string $label Label of template - * @return ModelMail One instance of ModelMail + * @return ModelMail|integer One instance of ModelMail or -1 if error */ public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index cce12ae5f8b..5aecb6efc71 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -223,16 +223,16 @@ class FormMargin print ''; print ''; print ''; - print ''; + print ''; if ($conf->global->MARGIN_TYPE == "1") - print ''; + print ''; else - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; if (! empty($conf->product->enabled)) @@ -240,13 +240,13 @@ class FormMargin //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; } @@ -254,13 +254,13 @@ class FormMargin { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; } @@ -268,13 +268,13 @@ class FormMargin { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; } print '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').'
'.$langs->trans('MarginOnProducts').''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'
'.$langs->trans('MarginOnServices').''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'
'.$langs->trans('TotalMargin').''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'
'; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4b03886a714..cdbf35dc32b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2016 Christophe Battarel +/* Copyright (C) 2013-2015 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -291,17 +292,17 @@ class FormTicket // Type print '
'; - print $this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2'); + $this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2'); print '
'; - print $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2'); + $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2'); print '
'; - print $this->selectAnalyticCodesTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); + // Group + print '
'; + $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); print '
 ' + + '<\/td> ' + fileSize + ' KB' + '<\/td><\/tr>' ; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index b58c9107cf8..004762d2810 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -367,7 +367,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle $listofinsertedrowid[$cursorinsert]=$insertedrowid; dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG); } - // print 'OKOK
'.$langs->trans("ProcessMigrateScript").''.$langs->trans("OK").'
'.$langs->trans("OK").'
'.$langs->trans("ProcessMigrateScript").''.$langs->trans("KO").'
'.$langs->trans("KO").'
'; print ''; - print ''; + print ''; print ''; $var = true; @@ -276,7 +276,7 @@ function show_array_actions_to_do($max = 5) $datep2=$db->jdate($obj->dp2); // Date - print '"; // Statut - print "\n"; + print '\n"; print "\n"; @@ -336,7 +336,7 @@ function show_array_last_actions_done($max = 5) print '
'.$langs->trans("LastActionsToDo", $max).''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.dol_print_date($datep, 'day').' '; + print ''.dol_print_date($datep, 'day').' '; $late=0; if ($obj->percent == 0 && $datep && $datep < time()) $late=1; if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1; @@ -286,7 +286,7 @@ function show_array_actions_to_do($max = 5) print "".$staticaction->LibStatut($obj->percent, 3)."'.$staticaction->LibStatut($obj->percent, 3)."
'; print ''; - print ''; + print ''; print ''; $var = true; $i = 0; @@ -369,11 +369,11 @@ function show_array_last_actions_done($max = 5) print ''; // Date - print '"; // Statut - print "\n"; + print "\n"; print "\n"; $i++; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index bf3626d3e5c..d7d8ee5a5ee 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -541,7 +541,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof /** * On/off button for object * - * @param int $object Id product to set + * @param Object $object Object to set * @param string $code Name of constant : status or status_buy for product by example * @param string $field Name of database field : tosell or tobuy for product by example * @param string $text_on Text if on diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index be9c660a499..94707467166 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1266,27 +1266,31 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")"; - if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') - { - $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'Product') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + if (is_object($objcon) && $objcon->id) { + $sql.= " AND a.fk_contact = ".$objcon->id; + } else { + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') + { + $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'Product') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } } // Condition on actioncode @@ -1378,7 +1382,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. - if (! empty($conf->mailing->enabled) && ! empty($objcon->email)) + if (! empty($conf->mailing->enabled) && ! empty($objcon->email) + && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { $langs->load("mails"); @@ -1528,7 +1533,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Ref $out.=''; // Author of event diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d94862cf842..1f120efcd60 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2981,7 +2981,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithoutext, array( 'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'note', 'sign-out', 'split', 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow', - 'jabber','skype','twitter','facebook' + 'jabber','skype','twitter','facebook','linkedin' ) )) { $fa='fa'; @@ -3081,7 +3081,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ elseif ($pictowithoutext == 'jabber') { $fakey = 'fa-comment-o'; } - elseif ($pictowithoutext == 'skype') { + elseif (in_array($pictowithoutext, array('skype', 'twitter', 'facebook', 'linkedin'))) { $fakey = 'fa-'.$pictowithoutext; if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa = 'fab'; } @@ -6610,12 +6610,12 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen $temp = array(); foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; - if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); - else - { - ($case_sensitive) ? natsort($temp) : natcasesort($temp); - if($order!='asc') $temp=array_reverse($temp, true); - } + if (! $natsort) { + ($order=='asc') ? asort($temp) : arsort($temp); + } else { + ($case_sensitive) ? natsort($temp) : natcasesort($temp); + if($order!='asc') $temp=array_reverse($temp, true); + } $sorted = array(); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 61dae6d0a5c..dd557fa0a51 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2017,30 +2017,30 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) /** * Get an array with properties of an element * - * @param string $element_type Element type: 'action', 'facture', 'project_task' or 'object@modulext'... - * @return array (module, classpath, element, subelement, classfile, classname) + * @param string $element_type Element type: 'action', 'facture', 'project_task' or 'object@modulext'... + * @return array (module, classpath, element, subelement, classfile, classname) */ function getElementProperties($element_type) { // Parse element/subelement (ex: project_task) - $module = $element = $subelement = $element_type; + $module = $element_type; + $element = $element_type; + $subelement = $element_type; // If we ask an resource form external module (instead of default path) - if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) - { + if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) { $element = $subelement = $regs[1]; - $module = $regs[2]; + $module = $regs[2]; } //print '
1. element : '.$element.' - module : '.$module .'
'; - if ( preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) - { + if ( preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) { $module = $element = $regs[1]; $subelement = $regs[2]; } // For compat - if($element_type == "action") { + if ($element_type == "action") { $classpath = 'comm/action/class'; $subelement = 'Actioncomm'; $module = 'agenda'; @@ -2049,13 +2049,13 @@ function getElementProperties($element_type) // To work with non standard path if ($element_type == 'facture' || $element_type == 'invoice') { $classpath = 'compta/facture/class'; - $module='facture'; - $subelement='facture'; + $module ='facture'; + $subelement = 'facture'; } if ($element_type == 'commande' || $element_type == 'order') { $classpath = 'commande/class'; - $module='commande'; - $subelement='commande'; + $module = 'commande'; + $subelement = 'commande'; } if ($element_type == 'propal') { $classpath = 'comm/propal/class'; @@ -2142,8 +2142,7 @@ function getElementProperties($element_type) */ function fetchObjectByElement($element_id, $element_type, $element_ref = '') { - global $conf; - global $db,$conf; + global $conf, $db; $element_prop = getElementProperties($element_type); if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled) @@ -2359,6 +2358,9 @@ function getModuleDirForApiClass($module) elseif ($module == 'adherent' || $module == 'members' || $module == 'memberstypes' || $module == 'subscriptions') { $moduledirforclass = 'adherents'; } + elseif ($module == 'don' || $module == 'donations') { + $moduledirforclass = 'don'; + } elseif ($module == 'banque' || $module == 'bankaccounts') { $moduledirforclass = 'compta/bank'; } @@ -2369,7 +2371,7 @@ function getModuleDirForApiClass($module) $moduledirforclass = 'commande'; } elseif ($module == 'shipments') { - $moduledirforclass = 'expedition'; + $moduledirforclass = 'expedition'; } elseif ($module == 'facture' || $module == 'invoice' || $module == 'invoices') { $moduledirforclass = 'compta/facture'; diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 7f4d44f73f6..6481604ff64 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -38,10 +38,10 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false) global $conf; $num = str_replace(array(',', ' '), '', trim($num)); - if(! $num) { + if (! $num) { return false; } - if($centimes && strlen($num) == 1) { + if ($centimes && strlen($num) == 1) { $num = $num*10; } $TNum = explode('.', $num); @@ -151,7 +151,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') if ($numero >= 1000000000001) return -1; // Get 2 decimals to cents, another functions round or truncate - $strnumber = number_format ($numero, 10); + $strnumber = number_format($numero, 10); $len=strlen($strnumber); for ($i=0; $i<$len; $i++) { @@ -187,7 +187,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $DdMMillon * 10000000000; $UdMMillon = (int) ($numero / 1000000000); $numero = $numero - $UdMMillon * 1000000000; - $entexto .= hundreds2text ($CdMMillon, $DdMMillon, $UdMMillon); + $entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon); $entexto .= " MIL "; } if ($number >= 1000000){ @@ -197,7 +197,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $DdMILLON * 10000000; $udMILLON = (int) ($numero / 1000000); $numero = $numero - $udMILLON * 1000000; - $entexto .= hundreds2text ($CdMILLON, $DdMILLON, $udMILLON); + $entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON); if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1) $entexto .= " MILLÓN "; else @@ -210,7 +210,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $ddm * 10000; $udm = (int) ($numero / 1000); $numero = $numero - $udm * 1000; - $entexto .= hundreds2text ($cdm, $ddm, $udm); + $entexto .= hundreds2text($cdm, $ddm, $udm); if ($cdm || $ddm || $udm) $entexto .= " MIL "; } @@ -218,7 +218,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $c * 100; $d = (int) ($numero / 10); $u = (int) $numero - $d * 10; - $entexto .= hundreds2text ($c, $d, $u); + $entexto .= hundreds2text($c, $d, $u); if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000) $entexto .= " DE"; $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 69da66fa99c..9a78e7a3dbf 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -78,6 +78,11 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = curl_setopt($ch, CURLOPT_POST, 1); // POST curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields } + elseif ($postorget == 'POSTALREADYFORMATED') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // HTTP request is 'POST' but param string is taken as it is + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string + } elseif ($postorget == 'PUT') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index b5c0ee813c9..fd51506bd01 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -257,7 +257,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 54, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2463__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 55, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2464__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2464__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2465__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_closure', 2451__+MAX_llx_menu__, '/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuClosureAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); -- Accounting period insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); -- Binding diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1c20a019eae..2e15586b4cd 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -143,6 +143,25 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->add('/product/index.php?mainmenu=products&leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname); } + // MRP + $tmpentry = array( + 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), + 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), + 'module'=>'bom|mrp', + ); + $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); + if ($showmode) + { + $classname=""; + if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } + else $classname = 'class="tmenu"'; + $idsel='products'; + + $chaine=$langs->trans("TMenuMRP"); + + $menu->add('/bom/bom_list.php?mainmenu=mrp&leftmenu=', $chaine, 0, $showmode, $atarget, "bom", '', 30, $id, $idsel, $classname); + } + // Projects $tmpentry=array('enabled'=>(! empty($conf->projet->enabled)), 'perms'=>(! empty($user->rights->projet->lire)), @@ -1058,6 +1077,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 55); $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 60); + $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 70); // Fiscal year if ($conf->global->MAIN_FEATURES_LEVEL > 1) { @@ -1443,6 +1463,20 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } } + /* + * Menu PRODUCTS-SERVICES MRP + */ + if ($mainmenu == 'mrp') + { + // BOM + if (! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)) + { + $newmenu->add("", $langs->trans("BOM"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); + $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBom"), 1, $user->rights->bom->write); + $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read); + } + } + /* * Menu PROJECTS */ diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index a1a7d13a5ed..98f86e9a596 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -36,14 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; class pdf_ban extends ModeleBankAccountDoc { /** - * Issuer - * @var Societe + * @var Societe Issuer */ public $emetteur; /** - * Dolibarr version of the loaded document - * @public string + * @var string Dolibarr version of the loaded document */ public $version = 'development'; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 4196022b854..14f3c1fc862 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -53,8 +53,7 @@ class doc_generic_order_odt extends ModelePDFCommandes public $phpmin = array(5, 4); /** - * Dolibarr version of the loaded document - * @public string + * @var string Dolibarr version of the loaded document */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 74ab8b04fc9..1f77537ceb5 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -45,14 +45,14 @@ class doc_generic_contract_odt extends ModelePDFContract public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) - */ + */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 2fa786f096e..558ffe44e0a 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -47,14 +47,14 @@ class doc_generic_shipment_odt extends ModelePdfExpedition public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) - */ + */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 615b44b81bf..03ebe71e88d 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -61,14 +61,14 @@ class pdf_standard extends ModeleExpenseReport public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 136f75f56cf..c5405d9c3a9 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -46,14 +46,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index d11c24bd6c2..3eb5905ccd2 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -69,14 +69,14 @@ class pdf_crabe extends ModelePDFFactures public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 9dde0a49566..174f34bfb4b 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -76,7 +76,7 @@ class pdf_sponge extends ModelePDFFactures /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'development'; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index e2c27fd293c..91a4ff6d332 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -59,14 +59,14 @@ class pdf_soleil extends ModelePDFFicheinter public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index b34c5ae87ab..e8e5a6f9205 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -60,14 +60,14 @@ class pdf_typhon extends ModelePDFDeliveryOrder public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index d170675aa81..fc2c173d90c 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -418,6 +418,6 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; + $this->export_sql_order[$r] .=' ORDER BY ac.datep'; } } diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php new file mode 100644 index 00000000000..d9b27b729e3 --- /dev/null +++ b/htdocs/core/modules/modBom.class.php @@ -0,0 +1,374 @@ + + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 Maxime Kohlhaas + * + * 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 bom Module Bom + * \brief Bom module descriptor. + * + * \file htdocs/bom/core/modules/modBom.class.php + * \ingroup bom + * \brief Description and activation file for module Bom + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + + +/** + * Description and activation class for module Bom + */ +class modBom 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 = 650; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'bom'; + + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = "products"; + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = '90'; + // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); + + // Module label (no space allowed), used if translation string 'ModuleBomName' not found (Bom is name of module). + $this->name = preg_replace('/^mod/i', '', get_class($this)); + // Module description, used if translation string 'ModuleBomDesc' not found (Bom is name of module). + $this->description = "Bill of Materials (BOM) definitions for Manufacturing Resource Planning"; + // Used only if file README.md and README-LL.md not found. + $this->descriptionlong = "Bill of Materials definitions. They can be used to make Manufacturing Resource Planning"; + + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' + $this->version = 'experimental'; + + //Url to the file with your last numberversion of this module + //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; + // Key used in llx_const table to save module status enabled/disabled (where BILLOFMATERIALS is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Name of image file used for this module. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto='generic'; + + // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) + $this->module_parts = array( + /* + 'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers) + 'login' => 0, // Set this to 1 if module has its own login method file (core/login) + 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) + 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) + 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) + 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) + 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) + 'css' => array('/bom/css/bom.css.php'), // Set this to relative path of css file if module has its own css file + 'js' => array('/bom/js/bom.js.php'), // Set this to relative path of js file if module must load a js on all pages + 'hooks' => array('data'=>array('hookcontext1','hookcontext2'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' + 'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users + */ + ); + + // Data directories to create when module is enabled. + // Example: this->dirs = array("/bom/temp","/bom/subdir"); + $this->dirs = array("/bom/temp"); + + // Config pages. Put here list of php page, stored into bom/admin directory, to use to setup module. + $this->config_page_url = array("setup.php@bom"); + + // Dependencies + $this->hidden = false; // A condition to hide module + $this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + $this->langfiles = array("bom@bom"); + //$this->phpmin = array(5,4); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(9,0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + //$this->automatic_activation = array('FR'=>'BomWasAutomaticallyActivatedBecauseOfYourCountryChoice'); + //$this->always_enabled = true; // If true, can't be disabled + + // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(0=>array('BILLOFMATERIALS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('BILLOFMATERIALS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // ); + $this->const = array( + //1=>array('BILLOFMATERIALS_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + ); + + // Some keys to add into the overwriting translation tables + /*$this->overwrite_translation = array( + 'en_US:ParentCompany'=>'Parent company or reseller', + 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' + )*/ + + if (! isset($conf->bom) || ! isset($conf->bom->enabled)) + { + $conf->bom=new stdClass(); + $conf->bom->enabled=0; + } + + + // Array to add new pages in new tabs + $this->tabs = array(); + // Example: + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@bom:$user->rights->bom->read:/bom/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@bom:$user->rights->othermodule->read:/bom/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) + // 'contact' to add a tab in contact view + // 'contract' to add a tab in contract view + // 'group' to add a tab in group view + // 'intervention' to add a tab in intervention view + // 'invoice' to add a tab in customer invoice view + // 'invoice_supplier' to add a tab in supplier invoice view + // 'member' to add a tab in fundation member view + // 'opensurveypoll' to add a tab in opensurvey poll view + // 'order' to add a tab in customer order view + // 'order_supplier' to add a tab in supplier order view + // 'payment' to add a tab in payment view + // 'payment_supplier' to add a tab in supplier payment view + // 'product' to add a tab in product view + // 'propal' to add a tab in propal view + // 'project' to add a tab in project view + // 'stock' to add a tab in stock view + // 'thirdparty' to add a tab in third party view + // 'user' to add a tab in user view + + + // Dictionaries + $this->dictionaries=array(); + /* Example: + $this->dictionaries=array( + 'langs'=>'mylangfile@bom', + 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor + 'tablib'=>array("Table1","Table2","Table3"), // Label of tables + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields + 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order + 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) + 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) + 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) + 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond'=>array($conf->bom->enabled,$conf->bom->enabled,$conf->bom->enabled) // Condition to show each dictionary + ); + */ + + + // Boxes/Widgets + // Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget. + $this->boxes = array( + //0=>array('file'=>'bomwidget1.php@bom','note'=>'Widget provided by Bom','enabledbydefaulton'=>'Home'), + //1=>array('file'=>'bomwidget2.php@bom','note'=>'Widget provided by Bom'), + //2=>array('file'=>'bomwidget3.php@bom','note'=>'Widget provided by Bom') + ); + + + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week + $this->cronjobs = array( + //0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/bom/class/bom.class.php', 'objectname'=>'Bom', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->bom->enabled', 'priority'=>50) + ); + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->bom->enabled', 'priority'=>50), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->bom->enabled', 'priority'=>50) + // ); + + + // Permissions + $this->rights = array(); // Permission array used by this module + + $r=0; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read bom of Bom'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update bom of Bom'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete bom of Bom'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + + + // Main menu entries + $this->menu = array(); // List of menus to add + $r=0; + + // Add here entries to declare new menus + + /* BEGIN MODULEBUILDER TOPMENU */ + /*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'top', // This is a Top menu entry + 'titre'=>'Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'', + 'url'=>'/bom/bom_list.php', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. + 'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + */ + /* END MODULEBUILDER TOPMENU */ + + /* BEGIN MODULEBUILDER LEFTMENU BILLOFMATERIALS + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'List Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom_list', + 'url'=>'/bom/bom_list.php', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->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->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=bom,fk_leftmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom_new', + 'url'=>'/bom/bom_page.php?action=create', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->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->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + */ + /* + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'List Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom', + 'url'=>'/bom/bom_list.php', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1100+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->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->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=bom,fk_leftmenu=bom_bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom', + 'url'=>'/bom/bom_card.php?action=create', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1100+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->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->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + */ + /* END MODULEBUILDER LEFTMENU BILLOFMATERIALS */ + + + // Exports + $r=1; + + /* BEGIN MODULEBUILDER EXPORT BILLOFMATERIALS */ + /* + $langs->load("bom@bom"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='BomLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='bom@bom'; + $keyforclass = 'Bom'; $keyforclassfile='/mymobule/class/bom.class.php'; $keyforelement='bom'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='bom'; $keyforaliasextra='extra'; $keyforelement='bom'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'bom as t'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('bom').')'; + $r++; */ + /* END MODULEBUILDER EXPORT BILLOFMATERIALS */ + } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result=$this->_load_tables('/bom/sql/'); + if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') + + // Create extrafields + include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + + //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + + $sql = array(); + + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + + return $this->_remove($sql, $options); + } +} diff --git a/htdocs/core/modules/modIFTTT.class.php b/htdocs/core/modules/modIFTTT.class.php new file mode 100644 index 00000000000..55739978715 --- /dev/null +++ b/htdocs/core/modules/modIFTTT.class.php @@ -0,0 +1,251 @@ + + * + * 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 + */ + 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 + */ + 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 + */ + 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/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index e08def907a1..e6deef76144 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -231,23 +231,9 @@ class modTicket extends DolibarrModules 'titre' => 'List', 'mainmenu' => 'ticket', 'leftmenu' => 'ticketlist', - 'url' => '/ticket/list.php', - 'langs' => 'ticket', - 'position' => 103, - 'enabled' => '$conf->ticket->enabled', - 'perms' => '$user->rights->ticket->read', - 'target' => '', - 'user' => 2); - $r++; - - $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticketlist', - 'type' => 'left', - 'titre' => 'MenuListNonClosed', - 'mainmenu' => 'ticket', - 'leftmenu' => 'ticketlist', 'url' => '/ticket/list.php?search_fk_status=non_closed', 'langs' => 'ticket', - 'position' => 104, + 'position' => 103, 'enabled' => '$conf->ticket->enabled', 'perms' => '$user->rights->ticket->read', 'target' => '', @@ -259,7 +245,7 @@ class modTicket extends DolibarrModules 'titre' => 'MenuTicketMyAssign', 'mainmenu' => 'ticket', 'leftmenu' => 'ticketmy', - 'url' => '/ticket/list.php?mode=my_assign', + 'url' => '/ticket/list.php?mode=mine&search_fk_status=non_closed', 'langs' => 'ticket', 'position' => 105, 'enabled' => '$conf->ticket->enabled', @@ -268,19 +254,6 @@ class modTicket extends DolibarrModules 'user' => 0); $r++; - $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticketmy', - 'type' => 'left', - 'titre' => 'MenuTicketMyAssignNonClosed', - 'mainmenu' => 'ticket', - 'url' => '/ticket/list.php?mode=my_assign&search_fk_status=non_closed', - 'langs' => 'ticket', - 'position' => 106, - 'enabled' => '$conf->ticket->enabled', - 'perms' => '$user->rights->ticket->read', - 'target' => '', - 'user' => 0); - $r++; - $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticket', 'type' => 'left', 'titre' => 'Statistics', diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php new file mode 100644 index 00000000000..cf2c2418092 --- /dev/null +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -0,0 +1,179 @@ + + * + * 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/core/modules/oauth/stripe_oauthcallback.php + * \ingroup oauth + * \brief Page to get oauth callback + */ + +require '../../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; +use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; +use OAuth\OAuth2\Service\GitHub; + +// 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 + + + +$action = GETPOST('action', 'alpha'); +$backtourl = GETPOST('backtourl', 'alpha'); + + +/** + * Create a new instance of the URI class with the current URI, stripping the query string + */ +$uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); +//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); +//$currentUri->setQuery(''); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php'); + + +/** + * Load the credential for the service + */ + +/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */ +$serviceFactory = new \OAuth\ServiceFactory(); +$httpClient = new \OAuth\Common\Http\Client\CurlClient(); +// TODO Set options for proxy and timeout +// $params=array('CURLXXX'=>value, ...) +//$httpClient->setCurlParameters($params); +$serviceFactory->setHttpClient($httpClient); + +// Dolibarr storage +$storage = new DoliStorage($db, $conf); + +// Setup the credentials for the requests +$credentials = new Credentials( + $conf->global->OAUTH_STRIPE_TEST_ID, + $conf->global->STRIPE_LIVE_SECRET_KEY, + $currentUri->getAbsoluteUri() +); + +$requestedpermissionsarray=array(); +if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back +/*if ($action != 'delete' && empty($requestedpermissionsarray)) +{ + print 'Error, parameter state is not defined'; + exit; +}*/ +//var_dump($requestedpermissionsarray);exit; + +// Instantiate the Api service using the credentials, http client and storage mechanism for the token +/** @var $apiService Service */ +//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray); + +$sql="INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeLive', entity=".$conf->entity; +$db->query($sql); + +// access type needed to have oauth provider refreshing token +//$apiService->setAccessType('offline'); + +$langs->load("oauth"); + + +/* + * Actions + */ + + +if ($action == 'delete') +{ + $storage->clearToken('StripeLive'); + + setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + + header('Location: ' . $backtourl); + exit(); +} + +if (! empty($_GET['code'])) // We are coming from oauth provider page +{ + // We should have + //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) + + dol_syslog("We are coming from the oauth provider page"); + //llxHeader('',$langs->trans("OAuthSetup")); + + //$linkback=''.$langs->trans("BackToModuleList").''; + //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); + + //dol_fiche_head(); + // retrieve the CSRF state parameter + $state = isset($_GET['state']) ? $_GET['state'] : null; + //print '
'.$langs->trans("LastDoneTasks", $max).''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.dol_print_date($db->jdate($obj->da2), 'day'); + print ''.dol_print_date($db->jdate($obj->da2), 'day'); print "".$staticaction->LibStatut($obj->percent, 3)."".$staticaction->LibStatut($obj->percent, 3)."
'; - $out.=$actionstatic->getNomUrl(1, -1); + if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') { + $out.=''.img_object($langs->trans("ShowEMailing"), "email").' '; + $out.=$histo[$key]['id']; + $out.=''; + } else { + $out.=$actionstatic->getNomUrl(1, -1); + } $out.='
'; + + // This was a callback request from service, get the token + try { + //var_dump($_GET['code']); + //var_dump($state); + //var_dump($apiService); // OAuth\OAuth2\Service\GitHub + + //$token = $apiService->requestAccessToken($_GET['code'], $state); + $token = $apiService->requestAccessToken($_GET['code']); + // Github is a service that does not need state to be stored. + // Into constructor of GitHub, the call + // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) + // has not the ending parameter to true like the Google class constructor. + + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + + $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; + unset($_SESSION["backtourlsavedbeforeoauthjump"]); + + header('Location: ' . $backtourl); + exit(); + } catch (Exception $e) { + print $e->getMessage(); + } +} +else // If entry on page with no parameter, we arrive here +{ + $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; + + // This may create record into oauth_state before the header redirect. + // Creation of record with state in this tables depend on the Provider used (see its constructor). + if (GETPOST('state')) + { + $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); + } + else + { + //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write + $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write'; + } + + // we go on oauth provider authorization page + header('Location: ' . $url); + exit(); +} + + +/* + * View + */ + +// No view at all, just actions + +$db->close(); diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index ed50ebaa870..d061fc33b7d 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +95,7 @@ class printing_printgcp extends PrintingDriver $storage = new DoliStorage($this->db, $this->conf); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); // Setup the credentials for the requests - $credentials = new Credentials( + $credentials = new Credentials( $this->google_id, $this->google_secret, $urlwithroot.'/core/modules/oauth/google_oauthcallback.php' @@ -234,6 +234,7 @@ class printing_printgcp extends PrintingDriver */ public function getlistAvailablePrinters() { + $ret = array(); // Token storage $storage = new DoliStorage($this->db, $this->conf); // Setup the credentials for the requests @@ -335,8 +336,9 @@ class printing_printgcp extends PrintingDriver return $error; } } + } else { + dol_print_error($this->db); } - else dol_print_error($this->db); $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype); $this->error = 'PRINTGCP: '.$ret['errormessage']; @@ -358,7 +360,7 @@ class printing_printgcp extends PrintingDriver public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) { // Check if printer id - if(empty($printerid)) { + if (empty($printerid)) { return array('status' =>0, 'errorcode' =>'','errormessage'=>'No provided printer ID'); } // Open the file which needs to be print diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index f713b3a2a53..048c0e06846 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -44,14 +44,14 @@ class doc_generic_product_odt extends ModelePDFProduct public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index d3a37ffa6b0..d5bfd453322 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -57,14 +57,14 @@ class pdf_standard extends ModelePDFProduct public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 22003125439..e1c54a13a35 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -61,14 +61,14 @@ class doc_generic_project_odt extends ModelePDFProjects public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 0fd2385b9c2..8b05da32e37 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -59,14 +59,14 @@ class pdf_baleine extends ModelePDFProjects public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 7620b923b9d..4af8e8d1e32 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -38,23 +38,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_proposal_odt extends ModelePDFPropales { - /** - * Issuer - * @var Company object that emits - */ - public $emetteur; - - /** - * @var array() Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.4 = array(5, 4) - */ - public $phpmin = array(5, 4); - - /** - * Dolibarr version of the loaded document - * @public string + /** + * @var Company Issuer object that emits */ - public $version = 'dolibarr'; + public $emetteur; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.4 = array(5, 4) + */ + public $phpmin = array(5, 4); + + /** + * @var string Dolibarr version of the loaded document + */ + public $version = 'dolibarr'; /** @@ -369,7 +367,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity], diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index bb0ffdd786a..fd254490ec1 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -67,14 +67,14 @@ class pdf_azur extends ModelePDFPropales public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index c88852ea610..936309fb6d8 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -41,22 +41,25 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_cyan extends ModelePDFPropales { - public $db; + /** + * @var DoliDb Database handler + */ + public $db; public $name; public $description; public $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template public $type; - public $phpmin = array(4,3,0); // Minimum version of PHP required by module + public $phpmin = array(5, 4); // Minimum version of PHP required by module public $version = 'development'; public $page_largeur; public $page_hauteur; public $format; public $marge_gauche; - public $marge_droite; - public $marge_haute; - public $marge_basse; + public $marge_droite; + public $marge_haute; + public $marge_basse; public $emetteur; // Objet societe qui emet diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index fb93998ef84..fdd2a92d15b 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -1,20 +1,21 @@ -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* or see http://www.gnu.org/ -*/ +/* Copyright (C) 2018 Quentin Vial-Gouteyron + * Copyright (C) 2019 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ /** * \file htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -35,10 +36,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_reception_odt extends ModelePdfReception { - var $emetteur; // Objet societe qui emet + /** + * @var Company Issuer object that emits + */ + public $emetteur; // Objet societe qui emet - var $phpmin = array(5,2,0); // Minimum version of PHP required by module - var $version = 'dolibarr'; + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.4 = array(5, 4) + */ + public $phpmin = array(5, 4); // Minimum version of PHP required by module + + /** + * @var string Dolibarr version of the loaded document + */ + public $version = 'dolibarr'; /** @@ -300,7 +312,7 @@ class doc_generic_reception_odt extends ModelePdfReception '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook @@ -318,7 +330,7 @@ class doc_generic_reception_odt extends ModelePdfReception // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->reception->dir_temp, @@ -343,10 +355,9 @@ class doc_generic_reception_odt extends ModelePdfReception // Make substitutions into odt of freetext try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); - } - catch(OdfException $e) - { - } + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } // Make substitutions into odt of user info $tmparray=$this->get_substitutionarray_user($user, $outputlangs); @@ -364,9 +375,8 @@ class doc_generic_reception_odt extends ModelePdfReception { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - } - catch(OdfException $e) - { + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Make substitutions into odt of mysoc @@ -385,9 +395,8 @@ class doc_generic_reception_odt extends ModelePdfReception { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - } - catch(OdfException $e) - { + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Make substitutions into odt of thirdparty @@ -404,9 +413,8 @@ class doc_generic_reception_odt extends ModelePdfReception { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - } - catch(OdfException $e) - { + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of object + external modules @@ -427,9 +435,8 @@ class doc_generic_reception_odt extends ModelePdfReception { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - } - catch(OdfException $e) - { + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -445,15 +452,12 @@ class doc_generic_reception_odt extends ModelePdfReception $reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); - } - catch(OdfException $e) - { - } - catch(SegmentException $e) - { + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -473,9 +477,8 @@ class doc_generic_reception_odt extends ModelePdfReception { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - catch(OdfException $e) - { + } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -487,7 +490,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e){ $this->error=$e->getMessage(); return -1; } @@ -495,7 +498,7 @@ class doc_generic_reception_odt extends ModelePdfReception else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e){ $this->error=$e->getMessage(); return -1; } diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php index 234b620ce38..62e2434d9ac 100644 --- a/htdocs/core/modules/reception/modules_reception.php +++ b/htdocs/core/modules/reception/modules_reception.php @@ -29,7 +29,7 @@ */ abstract class ModelePdfReception extends CommonDocGenerator { - var $error=''; + public $error=''; // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 4ded1d5391a..1b5707330da 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -43,7 +43,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index c28751e9074..c5bc5f53c8e 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -43,15 +43,15 @@ class doc_generic_stock_odt extends ModelePDFStock */ public $emetteur; - /** - * @var array() Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.4 = array(5, 4) - */ + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.4 = array(5, 4) + */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index c2ddf01aa3d..c46799b6e41 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -57,14 +57,14 @@ class pdf_standard extends ModelePDFStock public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php index 5ad967e1e13..495dd3a6ef8 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php @@ -58,14 +58,14 @@ class pdf_stdmovement extends ModelePDFMovement public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; @@ -105,8 +105,7 @@ class pdf_stdmovement extends ModelePDFMovement public $marge_basse; /** - * Issuer - * @var Societe + * @var Societe Issuer */ public $emetteur; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 4e2b32463fb..2d2164ebeb1 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -58,14 +58,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 73d22e88d50..a95440ad42f 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -62,14 +62,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index ec217c6a961..87b4791524e 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -59,14 +59,14 @@ class pdf_standard extends ModelePDFSuppliersPayments public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index f30b696db67..27163ac32db 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -45,14 +45,14 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 95b7b41341b..faad9b8d66a 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -59,14 +59,14 @@ class pdf_aurore extends ModelePDFSupplierProposal public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 9e018a4d6c6..b58c327e1bc 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -37,21 +37,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; class doc_generic_user_odt extends ModelePDFUser { /** - * Issuer - * @var Societe + * @var Societe Issuer */ public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) - */ + */ public $phpmin = array(5, 4); /** - * Dolibarr version of the loaded document - * @public string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index c14a1953042..2dfd2cfcfee 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -45,14 +45,14 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) - */ + */ public $phpmin = array(5, 4); /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; @@ -67,7 +67,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup global $conf, $langs, $mysoc; // Load translation files required by the page - $langs->loadLangs(array("main","companies")); + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index dadfff3e62e..2c351996632 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -541,7 +541,7 @@ print ''; - echo $dialog; - if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { - echo ''; - } elseif ($parameters['currentcontext'] == 'membercard') { - echo ''; - } elseif ($parameters['currentcontext'] == 'contactcard') { - echo ''; - } - if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { - echo ''; - } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') { - echo ''; - } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'contactcard') { - echo ''; - } + return false; + }); + } ); + '; + echo $dialog; + if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { + echo ''; + } elseif ($parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif ($parameters['currentcontext'] == 'contactcard') { + echo ''; + } + if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'contactcard') { + echo ''; + } } } diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 4b89b79e273..01953fba0ee 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -30,11 +30,11 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; */ Class DataPolicy { - /** - * getAllContactNotInformed - * - * @return number - */ + /** + * getAllContactNotInformed + * + * @return number + */ function getAllContactNotInformed() { global $langs, $conf, $db, $user; @@ -144,71 +144,71 @@ Class DataPolicy */ function sendMailDataPolicyContact($contact) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $contact->email; - $code= md5($contact->email); - if (!empty($contact->default_lang)) { - $l = $contact->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $sendto = $contact->email; + $code= md5($contact->email); + if (!empty($contact->default_lang)) { + $l = $contact->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( - '__LINKACCEPT__' => ''.$linka.'', - '__LINKREFUSED__' => ''.$linkr.'', - '__FIRSTNAME__' => $contact->firstname, - '__NAME__' => $contact->lastname, - '__CIVILITY__' => $contact->civility, - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + '__FIRSTNAME__' => $contact->firstname, + '__NAME__' => $contact->lastname, + '__CIVILITY__' => $contact->civility, + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); - if (!$error) { + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); + if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $contact->update($contact->id); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $contact->update($contact->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } /** @@ -219,44 +219,46 @@ Class DataPolicy */ function sendMailDataPolicyCompany($societe) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $societe->email; + $sendto = $societe->email; - $code= md5($societe->email); - if (!empty($societe->default_lang)) { - $l = $societe->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) + { + if ($sendtocc) + { $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); @@ -264,23 +266,23 @@ Class DataPolicy $actionmsg .= dol_concatdesc($actionmsg, $message); } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); - if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $societe->update($societe->id); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $societe->update($societe->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } /** @@ -291,66 +293,66 @@ Class DataPolicy */ function sendMailDataPolicyAdherent($adherent) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $adherent->email; + $sendto = $adherent->email; - $code= md5($adherent->email); - if (!empty($adherent->default_lang)) { - $l = $adherent->default_lang; - } else { - $l = $langs->defaultlang; - } - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($adherent->email); + if (!empty($adherent->default_lang)) { + $l = $adherent->default_lang; + } else { + $l = $langs->defaultlang; + } + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg .= dol_concatdesc($actionmsg, $message); - } + } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); - if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $adherent->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $adherent->update($user); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $adherent->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $adherent->update($user); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } } diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 01478580a3a..656831eed2f 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ */ /** - * \file datapolicy/class/datapolicycron.class.php + * \file htdocs/datapolicy/class/datapolicycron.class.php * \ingroup datapolicy * \brief Example hook overload. */ @@ -27,11 +27,11 @@ */ class DataPolicyCron { - /** - * Function exec - * - * @return boolean - */ + /** + * Function exec + * + * @return boolean + */ public function exec() { global $conf, $db, $langs, $user; diff --git a/htdocs/datapolicy/lib/datapolicy.lib.php b/htdocs/datapolicy/lib/datapolicy.lib.php index 41c92299989..b72417d7ff9 100644 --- a/htdocs/datapolicy/lib/datapolicy.lib.php +++ b/htdocs/datapolicy/lib/datapolicy.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +17,7 @@ */ /** - * \file datapolicy/lib/datapolicy.lib.php + * \file htdocs/datapolicy/lib/datapolicy.lib.php * \ingroup datapolicy * \brief Library files with common functions for datapolicy */ @@ -28,27 +29,26 @@ */ function datapolicyAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf; - $langs->load("datapolicy@datapolicy"); + $langs->load("datapolicy@datapolicy"); - $h = 0; - $head = array(); + $h = 0; + $head = array(); - $head[$h][0] = dol_buildpath("/datapolicy/admin/setup.php", 1); - $head[$h][1] = $langs->trans("Deletion"); - $head[$h][2] = 'settings'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setup.php"; + $head[$h][1] = $langs->trans("Deletion"); + $head[$h][2] = 'settings'; + $h++; - if (! empty($conf->global->DATAPOLICIES_ENABLE_EMAILS)) - { - $head[$h][0] = dol_buildpath("/datapolicy/admin/setupmail.php", 1); - $head[$h][1] = $langs->trans("DATAPOLICIESMail"); - $head[$h][2] = 'settings'; - $h++; - } + if (! empty($conf->global->DATAPOLICIES_ENABLE_EMAILS)) { + $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setupmail.php"; + $head[$h][1] = $langs->trans("DATAPOLICIESMail"); + $head[$h][2] = 'settings'; + $h++; + } - complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicy'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicy'); - return $head; + return $head; } diff --git a/htdocs/datapolicy/mailing.php b/htdocs/datapolicy/mailing.php index e3f38b269be..69da78e00ac 100644 --- a/htdocs/datapolicy/mailing.php +++ b/htdocs/datapolicy/mailing.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,22 +17,22 @@ */ /** - * \file datapolicy/mailing.php + * \file htdocs/datapolicy/mailing.php * \ingroup datapolicy * \brief datapolicy mailing page. */ require '../../main.inc.php'; -dol_include_once('/contact/class/contact.class.php'); -dol_include_once('/datapolicy/class/datapolicy.class.php'); +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php'; $idcontact = GETPOST('idc'); -if(!empty($idcontact)){ +if (!empty($idcontact)) { $contact = new Contact($db); $contact->fetch($idcontact); DataPolicy::sendMailDataPolicyContact($contact); -}else{ +} else { $contacts = new DataPolicy($db); $contacts->getAllContactNotInformed(); diff --git a/htdocs/datapolicy/public/index.php b/htdocs/datapolicy/public/index.php index f819fb079f5..6c78f380b93 100644 --- a/htdocs/datapolicy/public/index.php +++ b/htdocs/datapolicy/public/index.php @@ -17,7 +17,7 @@ */ /** - * \file datapolicy/admin/setup.php + * \file htdocs/datapolicy/admin/setup.php * \ingroup datapolicy * \brief datapolicy setup page. */ @@ -30,11 +30,11 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); require '../../main.inc.php'; -dol_include_once('/contact/class/contact.class.php'); -dol_include_once('/societe/class/societe.class.php'); -dol_include_once('/adherents/class/adherent.class.php'); -dol_include_once('/user/class/user.class.php'); -dol_include_once('/datapolicy/class/datapolicy.class.php'); +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php'; $idc = GETPOST('c', 'int'); $ids = GETPOST('s', 'int'); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 40d0616ad37..02a35deb70d 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -154,7 +154,7 @@ if ($action == 'add') if (! $error) { - $object->fk_soc = GETPOST("fk_soc", 'int'); + $object->socid = GETPOST("socid", 'int'); $object->firstname = GETPOST("firstname", 'alpha'); $object->lastname = GETPOST("lastname", 'alpha'); $object->societe = GETPOST("societe", 'alpha'); @@ -164,7 +164,7 @@ if ($action == 'add') $object->town = GETPOST("town", 'alpha'); $object->country_id = GETPOST('country_id', 'int'); $object->email = GETPOST('email', 'alpha'); - $object->date = $donation_date; + $object->date = $donation_date; $object->note_private = GETPOST("note_private", 'none'); $object->note_public = GETPOST("note_public", 'none'); $object->public = GETPOST("public", 'alpha'); @@ -372,7 +372,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; @@ -531,10 +531,10 @@ if (! empty($id) && $action == 'edit') print ""; print "\n"; -if ( $object->fk_soc && ! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES) ) { +if ( $object->socid && ! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES) ) { $company=new Societe($db); - $result=$company->fetch($object->fk_soc); + $result=$company->fetch($object->socid); print '
'; } else { @@ -693,10 +693,10 @@ if (! empty($id) && $action != 'edit') print yn($object->public); print ''; -if ($object->fk_soc) { +if ($object->socid) { $company=new Societe($db); - $result=$company->fetch($object->fk_soc); + $result=$company->fetch($object->socid); print ''; } else { diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index b326c6f4959..de854ce806d 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Laurent Destailleur +/* Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2019 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ class Donations extends DolibarrApi { global $db, $conf; $this->db = $db; - $this->don = new Don($this->db); + $this->don = new Don($this->db); } /** @@ -72,13 +72,13 @@ class Donations extends DolibarrApi throw new RestException(404, 'Donation not found'); } - if( ! DolibarrApi::_checkAccessToResource('commande', $this->don->id)) { + if( ! DolibarrApi::_checkAccessToResource('don', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } // Add external contacts ids - //$this->commande->contacts_ids = $this->don->liste_contact(-1,'external',1); - //$this->commande->fetchObjectLinked(); + //$this->don->contacts_ids = $this->don->liste_contact(-1,'external',1); + //$this->don->fetchObjectLinked(); return $this->_cleanObjectDatas($this->don); } @@ -87,14 +87,14 @@ class Donations extends DolibarrApi /** * List donations * - * Get a list of orders + * Get a list of donations * - * @param string $sortfield Sort field - * @param string $sortorder Sort order + * @param string $sortfield Sort field + * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of order objects * * @throws RestException @@ -108,25 +108,14 @@ class Donations extends DolibarrApi // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; - // If the internal user must only see his customers, force searching by him - $search_sale = 0; - if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; - $sql = "SELECT t.rowid"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) ) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."don as t"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale - $sql.= ' WHERE t.entity IN ('.getEntity('don').')'; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; - if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; - if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Insert sale filter - if ($search_sale > 0) - { - $sql .= " AND sc.fk_user = ".$search_sale; - } + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) ) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($thirdparty_ids) $sql.= " AND t.fk_soc = ".$thirdparty_ids." "; + // Add sql filters if ($sqlfilters) { @@ -151,7 +140,7 @@ class Donations extends DolibarrApi dol_syslog("API Rest request"); $result = $db->query($sql); - + if ($result) { $num = $db->num_rows($result); @@ -160,21 +149,22 @@ class Donations extends DolibarrApi while ($i < $min) { $obj = $db->fetch_object($result); - $commande_static = new Commande($db); - if($commande_static->fetch($obj->rowid)) { + $don_static = new Don($db); + if($don_static->fetch($obj->rowid)) { // Add external contacts ids - $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1); - $obj_ret[] = $this->_cleanObjectDatas($commande_static); + //$don_static->contacts_ids = $don_static->liste_contact(-1, 'external', 1); + $obj_ret[] = $this->_cleanObjectDatas($don_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror()); + throw new RestException(503, 'Error when retrieve donation list : '.$db->lasterror()); } if( ! count($obj_ret)) { - throw new RestException(404, 'No order found'); + throw new RestException(404, 'No donation found'); } + return $obj_ret; } @@ -186,28 +176,28 @@ class Donations extends DolibarrApi */ function post($request_data = null) { - if(! DolibarrApiAccess::$user->rights->commande->creer) { + if(! DolibarrApiAccess::$user->rights->don->creer) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields $result = $this->_validate($request_data); foreach($request_data as $field => $value) { - $this->commande->$field = $value; + $this->don->$field = $value; } /*if (isset($request_data["lines"])) { $lines = array(); foreach ($request_data["lines"] as $line) { array_push($lines, (object) $line); } - $this->commande->lines = $lines; + $this->don->lines = $lines; }*/ - if ($this->commande->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors)); + if ($this->don->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating order", array_merge(array($this->don->error), $this->don->errors)); } - return $this->commande->id; + return $this->don->id; } /** @@ -220,36 +210,30 @@ class Donations extends DolibarrApi */ function put($id, $request_data = null) { - if (! DolibarrApiAccess::$user->rights->commande->creer) { + if (! DolibarrApiAccess::$user->rights->don->creer) { throw new RestException(401); } - $result = $this->commande->fetch($id); + $result = $this->don->fetch($id); if (! $result) { - throw new RestException(404, 'Order not found'); + throw new RestException(404, 'Donation not found'); } - if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + if (! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { if ($field == 'id') continue; - $this->commande->$field = $value; + $this->don->$field = $value; } - // Update availability - if (!empty($this->commande->availability_id)) { - if ($this->commande->availability($this->commande->availability_id) < 0) - throw new RestException(400, 'Error while updating availability'); - } - - if ($this->commande->update(DolibarrApiAccess::$user) > 0) + if ($this->don->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { - throw new RestException(500, $this->commande->error); + throw new RestException(500, $this->don->error); } } @@ -269,7 +253,7 @@ class Donations extends DolibarrApi throw new RestException(404, 'Donation not found'); } - if( ! DolibarrApi::_checkAccessToResource('don', $this->don->id)) { + if( ! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -309,10 +293,10 @@ class Donations extends DolibarrApi */ function validate($id, $idwarehouse = 0, $notrigger = 0) { - if(! DolibarrApiAccess::$user->rights->commande->creer) { + if(! DolibarrApiAccess::$user->rights->don->creer) { throw new RestException(401); } - $result = $this->commande->fetch($id); + $result = $this->don->fetch($id); if( ! $result ) { throw new RestException(404, 'Donation not found'); } @@ -321,25 +305,25 @@ class Donations extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); + $result = $this->don->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); if ($result == 0) { throw new RestException(304, 'Error nothing done. May be object is already validated'); } if ($result < 0) { - throw new RestException(500, 'Error when validating Order: '.$this->commande->error); + throw new RestException(500, 'Error when validating Order: '.$this->don->error); } - $result = $this->commande->fetch($id); + $result = $this->don->fetch($id); if( ! $result ) { throw new RestException(404, 'Order not found'); } - if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + if( ! DolibarrApi::_checkAccessToResource('don', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $this->commande->fetchObjectLinked(); + $this->don->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->commande); + return $this->_cleanObjectDatas($this->don); } /** @@ -372,12 +356,12 @@ class Donations extends DolibarrApi */ function _validate($data) { - $commande = array(); + $don = array(); foreach (Orders::$FIELDS as $field) { if (!isset($data[$field])) throw new RestException(400, $field ." field missing"); - $commande[$field] = $data[$field]; + $don[$field] = $data[$field]; } - return $commande; + return $don; } } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index f6c2ff1847c..f361299f83a 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -395,7 +395,7 @@ class Don extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".price2num($this->amount); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); - $sql.= ", '".$this->db->escape($this->fk_soc)."'"; + $sql.= ", '".$this->db->escape($this->socid)."'"; $sql.= ", '".$this->db->escape($this->firstname)."'"; $sql.= ", '".$this->db->escape($this->lastname)."'"; $sql.= ", '".$this->db->escape($this->societe)."'"; @@ -644,7 +644,7 @@ class Don extends CommonObject global $conf; $sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,"; - $sql.= " d.fk_soc,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; + $sql.= " d.fk_soc as socid,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; $sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, "; $sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,"; $sql.= " p.ref as project_ref,"; @@ -672,40 +672,42 @@ class Don extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->datec = $this->db->jdate($obj->datec); - $this->date_valid = $this->db->jdate($obj->date_valid); - $this->datem = $this->db->jdate($obj->datem); - $this->date = $this->db->jdate($obj->datedon); - $this->fk_soc = $obj->fk_soc; - $this->firstname = $obj->firstname; - $this->lastname = $obj->lastname; - $this->societe = $obj->societe; - $this->statut = $obj->fk_statut; - $this->address = $obj->address; - $this->town = $obj->town; - $this->zip = $obj->zip; - $this->town = $obj->town; - $this->country_id = $obj->fk_country; - $this->country_code = $obj->country_code; - $this->country = $obj->country; - $this->country_olddata= $obj->country_olddata; // deprecated - $this->email = $obj->email; - $this->phone = $obj->phone; - $this->phone_mobile = $obj->phone_mobile; - $this->project = $obj->project_ref; - $this->fk_projet = $obj->fk_project; // deprecated - $this->fk_project = $obj->fk_project; - $this->public = $obj->public; - $this->modepaymentid = $obj->fk_payment; - $this->modepaymentcode = $obj->payment_code; - $this->modepayment = $obj->payment_label; - $this->paid = $obj->paid; - $this->amount = $obj->amount; - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->modelpdf = $obj->model_pdf; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->date_creation = $this->db->jdate($obj->datec); + $this->datec = $this->db->jdate($obj->datec); + $this->date_validation = $this->db->jdate($obj->date_valid); + $this->date_modification = $this->db->jdate($obj->datem); + $this->datem = $this->db->jdate($obj->datem); + $this->date = $this->db->jdate($obj->datedon); + $this->socid = $obj->socid; + $this->firstname = $obj->firstname; + $this->lastname = $obj->lastname; + $this->societe = $obj->societe; + $this->statut = $obj->fk_statut; + $this->address = $obj->address; + $this->town = $obj->town; + $this->zip = $obj->zip; + $this->town = $obj->town; + $this->country_id = $obj->fk_country; + $this->country_code = $obj->country_code; + $this->country = $obj->country; + $this->country_olddata = $obj->country_olddata; // deprecated + $this->email = $obj->email; + $this->phone = $obj->phone; + $this->phone_mobile = $obj->phone_mobile; + $this->project = $obj->project_ref; + $this->fk_projet = $obj->fk_project; // deprecated + $this->fk_project = $obj->fk_project; + $this->public = $obj->public; + $this->mode_reglement_id = $obj->fk_payment; + $this->mode_reglement_code= $obj->payment_code; + $this->mode_reglement = $obj->payment_label; + $this->paid = $obj->paid; + $this->amount = $obj->amount; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->modelpdf = $obj->model_pdf; // Retreive all extrafield // fetch optionals attributes and labels diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5a7b7ff2e42..c386327bea6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -121,7 +121,7 @@ if (empty($reshook)) { $action = ''; $object->fetch($id); // show shipment also after canceling modification - } + } include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -784,8 +784,7 @@ if (empty($reshook)) $stockLocation="entl".$detail_entrepot->line_id; $qty = "qtyl".$detail_entrepot->line_id; $warehouse = GETPOST($stockLocation, 'int'); - if (!empty ($warehouse)) - { + if (!empty($warehouse)) { $line->id = $detail_entrepot->line_id; $line->entrepot_id = $warehouse; $line->qty = GETPOST($qty, 'int'); @@ -800,8 +799,9 @@ if (empty($reshook)) } } } - else // Product no predefined + else { + // Product no predefined $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); @@ -960,7 +960,7 @@ if ($action == 'create') print ''; print ''; print ''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9c908d32a95..84853fe51e6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -527,7 +527,7 @@ class Expedition extends CommonObject // Check parameters if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet, e.billed"; + $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery"; $sql.= ", e.fk_shipping_method, e.tracking_number"; @@ -575,7 +575,7 @@ class Expedition extends CommonObject $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin_id = $obj->origin_id; $this->billed = $obj->billed; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->trueWeight = $obj->weight; $this->weight_units = $obj->weight_units; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index eb4ca875448..987968e241f 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -948,7 +948,7 @@ if ($action == 'create') $numprojet=$formproject->select_projects($soc->id, $projectid, 'projectid'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").' '; } print ''; } @@ -961,7 +961,7 @@ if ($action == 'create') $numcontrat=$formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1); if ($numcontrat==0) { - print '   '.$langs->trans("AddContract").''; + print '   '.$langs->trans("AddContract").' '; } print ''; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 97ecffacf95..00210277db1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -379,7 +379,7 @@ class Fichinter extends CommonObject $sql.= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql.= " f.date_valid as datev,"; $sql.= " f.tms as datem,"; - $sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; + $sql.= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if ($ref) { $sql.= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -407,7 +407,7 @@ class Fichinter extends CommonObject $this->datet = $this->db->jdate($obj->datet); $this->datev = $this->db->jdate($obj->datev); $this->datem = $this->db->jdate($obj->datem); - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->modelpdf = $obj->model_pdf; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index de5744711ea..ef8baf8748f 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -173,7 +173,7 @@ if (! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck)) } if (empty($dolibarr_main_db_host)) { - print '
Dolibarr setup is not yet complete.

'."\n"; + print '
Dolibarr setup is not yet complete.

'."\n"; print 'Click here to finish Dolibarr install process ...
'."\n"; die; } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 69e6ff160dc..4391d14ea3c 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -185,8 +185,8 @@ class SupplierInvoices extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -221,8 +221,8 @@ class SupplierInvoices extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { @@ -239,7 +239,7 @@ class SupplierInvoices extends DolibarrApi } if($this->invoice->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } @@ -253,8 +253,8 @@ class SupplierInvoices extends DolibarrApi function delete($id) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Supplier invoice not found'); @@ -306,9 +306,9 @@ class SupplierInvoices extends DolibarrApi throw new RestException(404, 'Invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); if ($result == 0) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index b48635d3fd1..38c9ab9e200 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -190,8 +190,8 @@ class SupplierOrders extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -226,8 +226,8 @@ class SupplierOrders extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->order->fetch($id); if( ! $result ) { @@ -244,7 +244,7 @@ class SupplierOrders extends DolibarrApi } if($this->order->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } @@ -257,20 +257,19 @@ class SupplierOrders extends DolibarrApi */ function delete($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { - throw new RestException(401); - } + if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { + throw new RestException(401); + } $result = $this->order->fetch($id); - if( ! $result ) { + if ( ! $result) { throw new RestException(404, 'Supplier order not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( $this->order->delete(DolibarrApiAccess::$user) < 0) - { + if ( $this->order->delete(DolibarrApiAccess::$user) < 0) { throw new RestException(500); } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8233d6a2302..05b6754bc5d 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1700,29 +1700,33 @@ class FactureFournisseur extends CommonInvoice $this->line->fk_facture_fourn=$this->id; //$this->line->label=$label; // deprecated $this->line->desc=$desc; - $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative $this->line->ref_supplier=$ref_supplier; + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise + $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx=$txtva; $this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0); $this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0); $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; + + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative + $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); + $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); + $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); + $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->fk_product=$fk_product; $this->line->product_type=$type; $this->line->remise_percent=$remise_percent; - $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->date_start=$date_start; $this->line->date_end=$date_end; $this->line->ventil=$ventil; $this->line->rang=$rang; $this->line->info_bits=$info_bits; - $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva= $total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; - $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->special_code=$this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; @@ -1891,11 +1895,11 @@ class FactureFournisseur extends CommonInvoice $line->localtax2_tx = $txlocaltax2; $line->localtax1_type = $localtaxes_type[0]; $line->localtax2_type = $localtaxes_type[2]; - $line->total_ht = $total_ht; - $line->total_tva = $total_tva; + $line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); + $line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); $line->total_localtax1 = $total_localtax1; $line->total_localtax2 = $total_localtax2; - $line->total_ttc = $total_ttc; + $line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $line->fk_product = $idproduct; $line->product_type = $product_type; $line->info_bits = $info_bits; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 353fe5273f1..644ebd79347 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1496,7 +1496,7 @@ if ($action=='create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; } print ''; @@ -1558,7 +1558,7 @@ if ($action=='create') $langs->load('projects'); print '
'; } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 257750559a1..fab8aa705de 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -499,7 +499,7 @@ if ($id > 0 || ! empty($ref)) { $sql .= " WHERE l.fk_commande = " . $object->id; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND l.product_type = 0"; - $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product + $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product $sql .= " ORDER BY p.ref, p.label"; $resql = $db->query($sql); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b85099d5a15..70407661d52 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1755,7 +1755,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; } print ''; @@ -3036,8 +3036,13 @@ else print ''; } + $discount = new DiscountAbsolute($db); + $result = $discount->fetch(0, 0, $object->id); + // Reopen a standard paid invoice - if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT + || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && empty($discount->id))) + && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) { if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer) // Not replaced by another invoice { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index bfe7fb4df85..4d5a3d32c78 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -368,7 +368,7 @@ if (! $search_all) $sql.= " typent.code,"; $sql.= " state.code_departement, state.nom,"; $sql.= ' country.code,'; - $sql.= " p.rowid, p.ref"; + $sql.= " p.rowid, p.ref, p.title"; foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by { diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 4ea0b76a9d4..1985926563b 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -78,7 +78,7 @@ dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user"); $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status"; $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; -$sql.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE e.entity IN (".getEntity('establishment').')'; $sql.= $db->order($sortfield, $sortorder); $sql.= $db->plimit($limit+1, $offset); diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 5759d567761..f39a9ee374a 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -208,6 +208,7 @@ class Establishment extends CommonObject $sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null'); $sql .= ", status = ".$this->db->escape($this->status); $sql .= ", fk_user_mod = " . $user->id; + $sql .= ", entity = " . $this->entity; $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); @@ -230,7 +231,7 @@ class Establishment extends CommonObject */ function fetch($id) { - $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id,"; + $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id, e.entity,"; $sql.= ' c.code as country_code, c.label as country'; $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON e.fk_country = c.rowid'; @@ -249,6 +250,7 @@ class Establishment extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; $this->status = $obj->status; + $this->entity = $obj->entity; $this->country_id = $obj->country_id; $this->country_code = $obj->country_code; @@ -352,7 +354,7 @@ class Establishment extends CommonObject */ function info($id) { - $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod'; + $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; $sql.= ' WHERE e.rowid = '.$id; @@ -389,6 +391,37 @@ class Establishment extends CommonObject dol_print_error($this->db); } } + + /** + * Get on record Establishment + * + * @param int $id Id of record + * @return Object + */ + function getEstablishment($id) + { + $sql = 'SELECT e.rowid, e.name, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; + $sql.= ' WHERE e.rowid = '.$id; + + dol_syslog(get_class($this)."::fetch info", LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + } + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + + return $obj; + } /** * Return clicable name (with picto eventually) @@ -414,6 +447,34 @@ class Establishment extends CommonObject if ($withpicto != 2) $result.=$link.$this->name.$linkend; return $result; } + + /** + * Return clicable name (with picto eventually) + * + * @param int $id Id of record + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @return string String with URL + */ + function getNomUrlParent($id = 0, $withpicto = 0) + { + global $langs, $conf; + + $result=''; + + $obj = $this->getEstablishment(($id>0)?$id:$conf->entity); + + $link = ''; + $linkend=''; + + $picto='building'; + + $label=$langs->trans("Show").': '.$obj->name; + + if ($withpicto) $result.=($link.img_object($label, $picto).$linkend); + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$link.$obj->name.$linkend; + return $result; + } /** * Return account country code diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 28763f8b0f3..37a3d7f538b 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -92,8 +92,7 @@ elseif ($action == 'add') $object->status = GETPOST('status', 'int'); $object->fk_user_author = $user->id; $object->datec = dol_now(); - - + $object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity; $id = $object->create($user); @@ -141,6 +140,7 @@ elseif ($action == 'update') $object->country_id = GETPOST('country_id', 'int'); $object->fk_user_mod = $user->id; $object->status = GETPOST('status', 'int'); + $object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity; $result = $object->update($user); @@ -190,6 +190,14 @@ if ($action == 'create') print ''; print ''; + // Parent + print ''; + print ''; + print ''; + print ''; + // Address print ''; print ''; @@ -202,7 +210,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; print ''; + + // Parent + print ''; + print ''; // Address @@ -292,12 +306,12 @@ if (($id || $ref) && $action == 'edit') // Zipcode / Town print ''; print ''; @@ -366,6 +380,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; print ''; + + // Parent + print ''; + print ''; + print ''; + print ''; // Address print ''; diff --git a/htdocs/ifttt/README.md b/htdocs/ifttt/README.md new file mode 100644 index 00000000000..581853f80c6 --- /dev/null +++ b/htdocs/ifttt/README.md @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000000..d6eb777109b --- /dev/null +++ b/htdocs/ifttt/admin/index.php @@ -0,0 +1,131 @@ + + * 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 == 'setproductionmode') +{ + $status = GETPOST('status', 'alpha'); + + if (dolibarr_set_const($db, 'IFTTT_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0) + { + 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 '
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
' . $langs->trans('Project') . ''; $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; + print $form->selectEstablishments(GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity, 'entity', 1); + print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; -print $formcompany->select_ziptown( + print $formcompany->select_ziptown( GETPOST('zipcode', 'alpha'), 'zipcode', array ( @@ -218,7 +226,7 @@ print $formcompany->select_ziptown( print '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; -print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( + print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( 'zipcode', 'selectcountry_id' )); @@ -282,6 +290,12 @@ if (($id || $ref) && $action == 'edit') // Name print '
'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; print ''; + print '
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; + print $form->selectEstablishments($object->entity>0?$object->entity:$conf->entity, 'entity', 1); print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; -print $formcompany->select_ziptown($object->zip, 'zipcode', array ( + print $formcompany->select_ziptown($object->zip, 'zipcode', array ( 'town', 'selectcountry_id' ), 6) . '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; -print $formcompany->select_ziptown($object->town, 'town', array ( + print $formcompany->select_ziptown($object->town, 'town', array ( 'zipcode', 'selectcountry_id' )) . '
'.$langs->trans("Name").''.$object->name.'
'.$langs->trans("Parent").''.$object->getNomUrlParent($object->entity).'
'; + +print ''; +print ""; +print '"; +print ""; +print ""; + +print ''; +print ''; +$production_mode=(empty($conf->global->IFTTT_PRODUCTION_MODE)?false:true); +if ($production_mode) +{ + print ''; +} +else +{ + print ''; +} +print ''; +print ''; + +print '
".$langs->trans("Parameter")."'.$langs->trans("Value")." 
'.$langs->trans("ProductionMode").''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + 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.'/api/index.php/login?login=auserlogin&password=thepassword[&reset=1]'; +$message.=$langs->trans("UrlToGetKeyToUseAPIs").':
'; +$message.=img_picto('', 'object_globe.png').' '.$url; +print $message; +print '
'; +print '
'; + +// Explorer +print ''.$langs->trans("ApiExporerIs").':
'; +if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer')) +{ + $url=DOL_MAIN_URL_ROOT.'/api/index.php/explorer'; + print img_picto('', 'object_globe.png').' '.$url."
\n"; +} +else +{ + print $langs->trans("NotAvailableWithThisDistribution"); +} + +*/ + +llxFooter(); +$db->close(); diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 9012448959c..575573c41c9 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -268,5 +268,15 @@ UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; +-- Delete duplicate accounting account, but only if not used +DROP TABLE tmp_llx_accouting_account; +CREATE TABLE tmp_llx_accouting_account AS SELECT MIN(rowid) as MINID, account_number, entity, fk_pcg_version, count(*) AS NB FROM llx_accounting_account group BY account_number, entity, fk_pcg_version HAVING count(*) >= 2 order by account_number, entity, fk_pcg_version; +--SELECT * from tmp_llx_accouting_account; +DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)); + + ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); + + + 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 6e188240a43..fe7cdb9faf6 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 @@ -94,13 +94,11 @@ ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL; ALTER TABLE llx_payment_various ADD COLUMN subledger_account varchar(32); - ALTER TABLE llx_prelevement_facture_demande ADD COLUMN entity integer(11); ALTER TABLE llx_prelevement_facture_demande ADD COLUMN sourcetype varchar(32); ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(128) NULL; ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL; - -- Fix if table exists ALTER TABLE llx_c_units DROP INDEX uk_c_units_code; ALTER TABLE llx_c_units ADD COLUMN scale integer; @@ -119,7 +117,6 @@ CREATE TABLE llx_c_units( ALTER TABLE llx_c_units ADD UNIQUE uk_c_units_code(code); - INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('T', '3','WeightUnitton','T', 'weight', 1); INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('KG', '0','WeightUnitkg','Kg', 'weight', 1); INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('G', '-3','WeightUnitg','g', 'weight', 1); @@ -162,3 +159,73 @@ INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VAL -- Default Warehouse id for a user ALTER TABLE llx_user ADD COLUMN fk_warehouse INTEGER NULL; + +-- Save informations for online / API shopping and push to invoice +ALTER TABLE llx_commande ADD COLUMN module_source varchar(32); +ALTER TABLE llx_commande ADD COLUMN pos_source varchar(32); + + +ALTER TABLE llx_societe ADD COLUMN linkedin varchar(255) after whatsapp; +ALTER TABLE llx_socpeople ADD COLUMN linkedin varchar(255) after whatsapp; +ALTER TABLE llx_adherent ADD COLUMN linkedin varchar(255) after whatsapp; +ALTER TABLE llx_user ADD COLUMN linkedin varchar(255) after whatsapp; + + + + +CREATE TABLE llx_bom_bom( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp NOT NULL, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status integer NOT NULL, + fk_product integer, + qty double(24,8) + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +create table llx_bom_bom_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +CREATE TABLE llx_bom_bomline( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + description text, + import_key varchar(14), + qty double(24,8), + fk_product integer, + fk_bom integer, + rank integer NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +create table llx_bom_bomline_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_rowid (rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_ref (ref); +ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_status (status); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product); + +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index f54523d2230..387f8e159ec 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -376,6 +376,16 @@ update llx_bank_url as bu set url_id = (select e.fk_user_author from tmp_bank_ur drop table tmp_bank_url_expense_user; +-- Delete duplicate accounting account, but only if not used +DROP TABLE tmp_llx_accouting_account; +CREATE TABLE tmp_llx_accouting_account AS SELECT MIN(rowid) as MINID, account_number, entity, fk_pcg_version, count(*) AS NB FROM llx_accounting_account group BY account_number, entity, fk_pcg_version HAVING count(*) >= 2 order by account_number, entity, fk_pcg_version; +--SELECT * from tmp_llx_accouting_account; +DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)); + +ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; +ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); + + -- VMYSQL4.1 update llx_projet_task_time set task_datehour = task_date where task_datehour < task_date or task_datehour > DATE_ADD(task_date, interval 1 day); diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index ede4de2e487..588fb323dae 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -51,6 +51,7 @@ create table llx_adherent skype varchar(255), twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/mysql/tables/llx_bom_bom.key.sql b/htdocs/install/mysql/tables/llx_bom_bom.key.sql new file mode 100644 index 00000000000..72631851e1b --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bom.key.sql @@ -0,0 +1,28 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_rowid (rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_ref (ref); +ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_status (status); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_bom_bom ADD UNIQUE INDEX uk_bom_bom_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql new file mode 100644 index 00000000000..bb8da0726bf --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -0,0 +1,34 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +CREATE TABLE llx_bom_bom( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp NOT NULL, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status integer NOT NULL, + fk_product integer, + qty double(24,8) + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql b/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql new file mode 100644 index 00000000000..2f748847455 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + +create table llx_bom_bom_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.key.sql b/htdocs/install/mysql/tables/llx_bom_bomline.key.sql new file mode 100644 index 00000000000..89c65f78644 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bomline.key.sql @@ -0,0 +1,26 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_bom_bomline ADD UNIQUE INDEX uk_bom_bomline_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_bom_bomline ADD CONSTRAINT llx_bom_bomline_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql new file mode 100644 index 00000000000..d1a958e9633 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -0,0 +1,27 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +CREATE TABLE llx_bom_bomline( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + description text, + import_key varchar(14), + qty double(24,8), + fk_product integer, + fk_bom integer, + rank integer NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql b/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql new file mode 100644 index 00000000000..a81715d0184 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + +create table llx_bom_bomline_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index d0522f7e5e3..35b6798e77a 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -57,6 +57,8 @@ create table llx_commande model_pdf varchar(255), last_main_doc varchar(255), -- relative filepath+filename of last main generated document + module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...) + pos_source varchar(32), -- name of POS station when order is generated by a POS module facture tinyint default 0, fk_account integer, -- bank account fk_currency varchar(3), -- currency code diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 6225ae416e8..ed4919c3fc5 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -54,6 +54,7 @@ create table llx_societe skype varchar(255), -- twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 00456e3ece6..4ed401e39da 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -46,6 +46,7 @@ create table llx_socpeople skype varchar(255), twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index cb9bf35ccd0..0beffd73428 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -58,6 +58,7 @@ create table llx_user skype varchar(255), twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 1229ace57ee..2fa5fad38ac 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2846,7 +2846,7 @@ function migrate_project_task_actors($db, $langs, $conf) $db->begin(); - $sql = "SELECT fk_projet_task, fk_user FROM ".MAIN_DB_PREFIX."projet_task_actors"; + $sql = "SELECT fk_projet_task as fk_project_task, fk_user FROM ".MAIN_DB_PREFIX."projet_task_actors"; $resql = $db->query($sql); if ($resql) { @@ -2868,7 +2868,7 @@ function migrate_project_task_actors($db, $langs, $conf) $sql2.= ") VALUES ("; $sql2.= "'".$db->idate(dol_now())."'"; $sql2.= ", '4'"; - $sql2.= ", ".$obj->fk_projet_task; + $sql2.= ", ".$obj->fk_project_task; $sql2.= ", '180'"; $sql2.= ", ".$obj->fk_user; $sql2.= ")"; diff --git a/htdocs/langs/ar_EG/admin.lang b/htdocs/langs/ar_EG/admin.lang index e4b07918378..53393c74233 100644 --- a/htdocs/langs/ar_EG/admin.lang +++ b/htdocs/langs/ar_EG/admin.lang @@ -25,6 +25,5 @@ Module25Desc=إدارة أوامر الشراء Module700Name=تبرعات Module1780Name=الأوسمة/التصنيفات Permission81=قراءة أوامر الشراء -Audit=Audit LogEventDesc=You can enable here the logging for Dolibarr security events. Administrators can then see its content via menu System tools - Audit. Warning, this feature can consume a large amount of data in database. NoEventOrNoAuditSetup=No security event has been recorded yet. This can be normal if audit has not been enabled on "setup - security - audit" page. diff --git a/htdocs/langs/de_AT/main.lang b/htdocs/langs/de_AT/main.lang index 8a51e29cb85..e3be90a6cc4 100644 --- a/htdocs/langs/de_AT/main.lang +++ b/htdocs/langs/de_AT/main.lang @@ -33,7 +33,6 @@ ConfirmClone=Klonen/Duplizieren - Optionen: Of=Von Search=Suche SearchOf=Suche -Upload=Upload PasswordRetype=Geben Sie das Passwort erneut ein DateStart=Start-Datum DateEnd=End-Datum diff --git a/htdocs/langs/en_GB/admin.lang b/htdocs/langs/en_GB/admin.lang index d5046722e24..6f2ae713012 100644 --- a/htdocs/langs/en_GB/admin.lang +++ b/htdocs/langs/en_GB/admin.lang @@ -35,7 +35,6 @@ ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to MeasuringUnit=Measurement unit MAIN_MAIL_AUTOCOPY_TO=Copy (Cc) all sent emails to ModuleFamilyCrm=Customer Relations Management (CRM) -ModuleFamilyProducts=Product Management (PM) ModuleFamilyHr=Human Resources Management (HR) ModuleFamilyTechnic=Multi-module tools ThisIsProcessToFollow=These are steps to process: @@ -56,9 +55,6 @@ FollowingSubstitutionKeysCanBeUsed=
To learn how to create your .odt document DescWeather=The following pictures will be shown on the dashboard when the number of late actions reaches the following values: ThisForceAlsoTheme=This menu manager will use its own theme irrespective of user choice. This menu manager is also specialised for some but not all, smartphones. Use another menu manager if you experience problems with yours. Module50200Name=PayPal -Permission300=Read barcodes -Permission301=Create/modify barcodes -Permission302=Delete barcodes DictionaryAccountancyJournal=Finance journals CompanyZip=Postcode LDAPFieldZip=Postcode diff --git a/htdocs/langs/en_GB/companies.lang b/htdocs/langs/en_GB/companies.lang index db4c81a57bd..560fcec6832 100644 --- a/htdocs/langs/en_GB/companies.lang +++ b/htdocs/langs/en_GB/companies.lang @@ -1,3 +1,2 @@ # Dolibarr language file - Source file is en_US - companies Zip=Postcode -Gencod=Barcode diff --git a/htdocs/langs/en_GB/errors.lang b/htdocs/langs/en_GB/errors.lang index 77442968d1a..24123f479a8 100644 --- a/htdocs/langs/en_GB/errors.lang +++ b/htdocs/langs/en_GB/errors.lang @@ -1,4 +1,2 @@ # Dolibarr language file - Source file is en_US - errors ErrorBadBarCodeSyntax=Bad syntax for barcode. Perhaps you selected the wrong barcode type or you defined a barcode mask for numbering that does not match the value scanned. -ErrorBarCodeRequired=Barcode required -ErrorBarCodeAlreadyUsed=Barcode already used diff --git a/htdocs/langs/en_GB/products.lang b/htdocs/langs/en_GB/products.lang index 398b1e76bde..fc9c683916c 100644 --- a/htdocs/langs/en_GB/products.lang +++ b/htdocs/langs/en_GB/products.lang @@ -1,5 +1,3 @@ # Dolibarr language file - Source file is en_US - products -BarCodePrintsheet=Print barcode PageToGenerateBarCodeSheets=With this tool, you can print sheets of barcode labels. Choose format of your label page, type of barcode and value of barcode, then click on button %s. PrintsheetForOneBarCode=Print several labels for one barcode -DefinitionOfBarCodeForProductNotComplete=Definition of type or value of barcode not complete for product %s. diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8b3a5a6600b..524979e610d 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -96,6 +96,7 @@ MenuTaxAccounts=Tax accounts MenuExpenseReportAccounts=Expense report accounts MenuLoanAccounts=Loan accounts MenuProductsAccounts=Product accounts +MenuClosureAccounts=Closure accounts ProductsBinding=Products accounts Ventilation=Binding to accounts Binding=Binding to accounts @@ -142,6 +143,7 @@ ACCOUNTING_LENGTH_AACCOUNT=Length of the third-party accounting accounts (If you ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account. Needed by some countries (like Switzerland). If set to off (default), you can set the following two parameters to ask the application to add virtual zeros. BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL=Enable draft export on journal +ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account (may be slow if you have a lot of third parties) ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal @@ -150,7 +152,12 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transfer +ACCOUNTING_RESULT_PROFIT=Result accounting account (Profit) +ACCOUNTING_RESULT_LOSS=Result accounting account (Loss) +ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal of closure + +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer + ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions @@ -207,6 +214,7 @@ DescThirdPartyReport=Consult here the list of third-party customers and vendors ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error +ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service @@ -287,6 +295,7 @@ ChartofaccountsId=Chart of accounts Id InitAccountancy=Init accountancy InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accounting account defined for sales and purchases. DefaultBindingDesc=This page can be used to set a default account to use to link transactions record about payment salaries, donation, taxes and vat when no specific accounting account were already set. +DefaultClosureDesc=This page can be used to set parameters to use to enclose a balance sheet. Options=Options OptionModeProductSell=Mode sales OptionModeProductBuy=Mode purchases diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 87766554735..477f611bf39 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -904,13 +904,13 @@ DictionaryRevenueStamp=Amount of tax stamps DictionaryPaymentConditions=Payment Terms DictionaryPaymentModes=Payment Modes DictionaryTypeContact=Contact/Address types -DictionaryTypeOfContainer=Type of website pages/containers +DictionaryTypeOfContainer=Website - Type of website pages/containers DictionaryEcotaxe=Ecotax (WEEE) DictionaryPaperFormat=Paper formats DictionaryFormatCards=Card formats DictionaryFees=Expense report - Types of expense report lines DictionarySendingMethods=Shipping methods -DictionaryStaff=No. of Employees +DictionaryStaff=Number of Employees DictionaryAvailability=Delivery delay DictionaryOrderMethods=Ordering methods DictionarySource=Origin of proposals/orders diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index f93de815d17..6638a4c1a04 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -492,6 +492,8 @@ Drafts=Drafts StatusInterInvoiced=Invoiced Validated=Validated Opened=Open +OpenAll=Open (All) +ClosedAll=Closed (All) New=New Discount=Discount Unknown=Unknown @@ -883,7 +885,6 @@ LineNb=Line no. IncotermLabel=Incoterms TabLetteringCustomer=Customer lettering TabLetteringSupplier=Vendor lettering -# Week day Monday=Monday Tuesday=Tuesday Wednesday=Wednesday @@ -963,3 +964,4 @@ SelectAThirdPartyFirst=Select a third party first... YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode Inventory=Inventory AnalyticCode=Analytic code +TMenuMRP=MRP \ No newline at end of file diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 72a3cfe93f2..6366e93e375 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -27,9 +27,9 @@ Permission56003=Delete tickets Permission56004=Manage tickets Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) -TicketDictType=Tickets type -TicketDictCategory=Tickets analytic code -TicketDictSeverity=Tickets severity +TicketDictType=Ticket - Types +TicketDictCategory=Ticket - Groupes +TicketDictSeverity=Ticket - Severities TicketTypeShortBUGSOFT=Dysfonctionnement logiciel TicketTypeShortBUGHARD=Dysfonctionnement matériel TicketTypeShortCOM=Commercial question @@ -123,13 +123,14 @@ TicketsAutoAssignTicket=Automatically assign the user who created the ticket TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket. TicketNumberingModules=Tickets numbering module TicketNotifyTiersAtCreation=Notify third party at creation +TicketGroup=Group # # Index & list page # TicketsIndex=Ticket - home TicketList=List of tickets -TicketAssignedToMeInfos=This page display ticket list which are assigned to current user +TicketAssignedToMeInfos=This page display ticket list created by or assigned to current user NoTicketsFound=No ticket found TicketViewAllTickets=View all tickets TicketViewNonClosedOnly=View only open tickets diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 862d137a510..53ac720d862 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -109,3 +109,4 @@ UserLogoff=User logout UserLogged=User logged DateEmployment=Employment Start Date DateEmploymentEnd=Employment End Date +CantDisableYourself=You can disable your own user record \ No newline at end of file diff --git a/htdocs/langs/es_CL/admin.lang b/htdocs/langs/es_CL/admin.lang index 93ee3101ef4..ec427601415 100644 --- a/htdocs/langs/es_CL/admin.lang +++ b/htdocs/langs/es_CL/admin.lang @@ -931,7 +931,6 @@ FCKeditorForProduct=WYSIWIG creación / edición de productos / servicios descri FCKeditorForMailing=Creación / edición WYSIWIG para eMailings masivos (Herramientas-> eMailing) FCKeditorForUserSignature=Creación / edición WYSIWIG de la firma del usuario FCKeditorForMail=Creación / edición WYSIWIG para todo el correo (excepto Herramientas-> correo electrónico) -OSCommerceTestKo2=La conexión al servidor '%s' con el usuario '%s' falló. StockSetup=Configuración del módulo de stock MenuDeleted=Menú borrado NotTopTreeMenuPersonalized=Menús personalizados no vinculados a una entrada del menú superior diff --git a/htdocs/langs/es_CL/main.lang b/htdocs/langs/es_CL/main.lang index 9bb6dd7f295..9dbe998903c 100644 --- a/htdocs/langs/es_CL/main.lang +++ b/htdocs/langs/es_CL/main.lang @@ -313,7 +313,6 @@ MailSentBy=Correo electrónico enviado por TextUsedInTheMessageBody=Cuerpo del correo electronico SendAcknowledgementByMail=Enviar correo electrónico de confirmación SendMail=Enviar correo electrónico -EMail=Email NoEMail=Sin correo electrónico FollowingConstantsWillBeSubstituted=Las siguientes constantes se reemplazarán por el valor correspondiente. BackToList=Volver a la lista diff --git a/htdocs/langs/es_EC/admin.lang b/htdocs/langs/es_EC/admin.lang index 4da30a203a0..1ee4ce793e6 100644 --- a/htdocs/langs/es_EC/admin.lang +++ b/htdocs/langs/es_EC/admin.lang @@ -975,7 +975,6 @@ FCKeditorForProduct=WYSIWIG creación / edición de productos / servicios descri FCKeditorForMailing= WYSIWIG creación / edición para eMailings masivos (Herramientas->eMailing) FCKeditorForUserSignature=WYSIWIG creación / edición de firma de usuario FCKeditorForMail=WYSIWIG Creación / edición para todo el correo (excepto Herramientas->eMailing) -OSCommerceTestKo2=Conexión al servidor '%s' con el usuario '%s' falló. StockSetup=Configuración del módulo de stock/inventario NotTopTreeMenuPersonalized=Menús personalizados no vinculados a una entrada de menú superior Menu=Selección del menú diff --git a/htdocs/langs/es_EC/main.lang b/htdocs/langs/es_EC/main.lang index d391ac58b14..4f2591c0c42 100644 --- a/htdocs/langs/es_EC/main.lang +++ b/htdocs/langs/es_EC/main.lang @@ -342,7 +342,6 @@ MailSentBy=Correo electrónico enviado por TextUsedInTheMessageBody=Cuerpo del correo electronico SendAcknowledgementByMail=Enviar correo electrónico de confirmación SendMail=Enviar correo electrónico -EMail=Correo electrónico NoEMail=Sin correo electrónico Email=Correo electrónico NotRead=No leer diff --git a/htdocs/langs/es_HN/main.lang b/htdocs/langs/es_HN/main.lang index 8b731814285..0d6b013ca18 100644 --- a/htdocs/langs/es_HN/main.lang +++ b/htdocs/langs/es_HN/main.lang @@ -2,26 +2,20 @@ DIRECTION=ltr FONTFORPDF=helvetica FONTSIZEFORPDF=10 -SeparatorDecimal=, +SeparatorDecimal=. SeparatorThousand=None -FormatDateShort=%d/%m/%Y -FormatDateShortInput=%d/%m/%Y -FormatDateShortJava=dd/MM/yyyy -FormatDateShortJavaInput=dd/MM/yyyy -FormatDateShortJQuery=dd/mm/yy -FormatDateShortJQueryInput=dd/mm/yy +FormatDateShort=%m/%d/%Y +FormatDateShortInput=%m/%d/%Y +FormatDateShortJava=MM/dd/yyyy +FormatDateShortJavaInput=MM/dd/yyyy +FormatDateShortJQuery=mm/dd/yy +FormatDateShortJQueryInput=mm/dd/yy FormatHourShortJQuery=HH:MI -FormatHourShort=%H:%M +FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M -FormatDateTextShort=%d %b %Y -FormatDateText=%d %B %Y -FormatDateHourShort=%d/%m/%Y %H:%M -FormatDateHourSecShort=%d/%m/%Y %H:%M:%S -FormatDateHourTextShort=%d %b %Y %H:%M -FormatDateHourText=%d %B %Y %H:%M -AmountVAT=Importe ISV -TotalVAT=Total ISV -HT=Sin ISV -TTC=ISV incluido -VAT=ISV -VATRate=Tasa ISV +FormatDateTextShort=%b %d, %Y +FormatDateText=%B %d, %Y +FormatDateHourShort=%m/%d/%Y %I:%M %p +FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p +FormatDateHourTextShort=%b %d, %Y, %I:%M %p +FormatDateHourText=%B %d, %Y, %I:%M %p diff --git a/htdocs/langs/es_MX/main.lang b/htdocs/langs/es_MX/main.lang index 5d9a6b2fcda..aa4bac2bdb1 100644 --- a/htdocs/langs/es_MX/main.lang +++ b/htdocs/langs/es_MX/main.lang @@ -182,7 +182,6 @@ FeatureNotYetSupported=Característica aún no soportada SendByMail=Enviar por correo electrónico MailSentBy=Correo electrónico enviado por TextUsedInTheMessageBody=Cuerpo del correo electronico -EMail=Email NoEMail=Sin correo electrónico FollowingConstantsWillBeSubstituted=Las siguientes constantes serán reemplazadas con el valor correspondiente. Refresh=Actualizar diff --git a/htdocs/langs/fr_CA/main.lang b/htdocs/langs/fr_CA/main.lang index c7466f9df38..6776c458708 100644 --- a/htdocs/langs/fr_CA/main.lang +++ b/htdocs/langs/fr_CA/main.lang @@ -99,7 +99,6 @@ MonthVeryShort09=D NbOfObjectReferers=Nombre d'articles connexes Referers=Articles connexes SendAcknowledgementByMail=Envoyer un email de confirmation -EMail=Courriel ValueIsNotValid=La valeur n'est pas valide RecordsModified=%s enregistrement modifié RecordsDeleted=%s enregistrement(s) supprimé(s) diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index a2b29b577fb..fa4e5366ac0 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -27,9 +27,9 @@ Permission56003=Supprimer tickets Permission56004=Gérer les tickets Permission56005=Voir les tickets de tous les tiers (sauf pour les utilisateurs externes, toujours limité au tiers dont ils dépendent) -TicketDictType=Type de ticket -TicketDictCategory=Catégories de tickets -TicketDictSeverity=Sévérité des tickets +TicketDictType=Ticket - Types +TicketDictCategory=Ticket - Groupes +TicketDictSeverity=Ticket - Sévérités TicketTypeShortBUGSOFT=Dysfonctionnement logiciel TicketTypeShortBUGHARD=Dysfonctionnement matériel TicketTypeShortCOM=Question commerciale diff --git a/htdocs/langs/pt_BR/admin.lang b/htdocs/langs/pt_BR/admin.lang index ed1f3794eec..3a6fbb39347 100644 --- a/htdocs/langs/pt_BR/admin.lang +++ b/htdocs/langs/pt_BR/admin.lang @@ -1016,8 +1016,6 @@ FCKeditorForProduct=Criação/edição do WYSIWIG nas descrições de produtos/ FCKeditorForMailing=Criação/edição do WYSIWIG nos E-Mails massivos (ferramentas->emailing) FCKeditorForUserSignature=criação/edição do WYSIWIG nas assinaturas de usuários FCKeditorForMail=Criação/Edição WYSIWIG para todos os e-mails (exceto Ferramentas->eMailing) -OSCommerceTestOk=Conexão para o servidor '%s' no banco de dados '%s' com o usuário '%s' foi bem sucedida. -OSCommerceTestKo2=Conexão ao servidor '%s' com o usuário '%s' falhou. MenuDeleted=Menu Deletado NotTopTreeMenuPersonalized=Menus personalizados não conectados à uma entrada do menu superior NewMenu=Novo Menu diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index ccc017dab49..6a524fa5a99 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -624,14 +624,14 @@ class MultiCurrency extends CommonObject } /** - * Sync rates from api + * Sync rates from api * - * @param array $response array of reponse from api to sync dolibarr rates - * @return void + * @param array $response array of reponse from api to sync dolibarr rates + * @return void */ public static function syncRates($response) { - global $db,$conf; + global $conf, $db, $langs; $ch = curl_init('http://apilayer.net/api/live?access_key='.$key.''); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @@ -639,8 +639,8 @@ class MultiCurrency extends CommonObject curl_close($ch); $response = json_decode($response); - if ($response->success) { - + if ($response->success) + { $TRate = $response->quotes; $timestamp = $response->timestamp; diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 93e3d1128e2..8840da3f3e7 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2014 Marcos García * * 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 @@ -448,7 +448,7 @@ if (issetAndNoEmpty('reporterhoraires')) { if (issetAndNoEmpty('resethoraires')) { $nbofchoice=count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { - unset ($_SESSION["horaires$i"]); + unset($_SESSION["horaires$i"]); } } @@ -484,7 +484,8 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) { //bouton vert if (($numerojour >= $jourAJ && $_SESSION["mois"] == $moisAJ && $_SESSION["annee"] == $anneeAJ) || ($_SESSION["mois"] > $moisAJ && $_SESSION["annee"] == $anneeAJ) || $_SESSION["annee"] > $anneeAJ) { print '
'.$numerojour.'
'; - if (($action != 'editbarcodetype') && $usercancreate && $createbarcode) print ''; + if (($action != 'editbarcodetype') && $usercancreate && $createbarcode) print ''; print '
'; print $langs->trans("BarcodeType"); print 'id.'">'.img_edit($langs->trans('Edit'), 1).'id.'">'.img_edit($langs->trans('Edit'), 1).'
'; print '
'; if ($action == 'editbarcodetype' || $action == 'editbarcode') @@ -1665,7 +1665,7 @@ else print ''; - if (($action != 'editbarcode') && $usercancreate && $createbarcode) print ''; + if (($action != 'editbarcode') && $usercancreate && $createbarcode) print ''; print '
'; print $langs->trans("BarcodeValue"); print 'id.'">'.img_edit($langs->trans('Edit'), 1).'id.'">'.img_edit($langs->trans('Edit'), 1).'
'; print '
'; if ($action == 'editbarcode') @@ -1934,7 +1934,7 @@ else // Categories if($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'product', 1); print "
'.$productfourn->getNomUrl().''.$productfourn->getNomUrl().''.$productfourn->fourn_ref.''.$productfourn->fourn_ref.''; + print ''; print $productfourn->fourn_qty; print ''; + print ''; print vatrate($productfourn->fourn_tva_tx, true); print ''; + print ''; print $productfourn->fourn_price?price($productfourn->fourn_price):""; print ''; + print ''; print $productfourn->fourn_multicurrency_price ? price($productfourn->fourn_multicurrency_price) : ""; print ''; + print ''; print price($productfourn->fourn_unitprice); //print $objp->unitprice? price($objp->unitprice) : ($objp->quantity?price($objp->price/$objp->quantity):" "); print ''; + print ''; print price($productfourn->fourn_multicurrency_unitprice); print ''; + print ''; print $productfourn->fourn_multicurrency_code ? currency_name($productfourn->fourn_multicurrency_code) : ''; print ''; + print ''; print price2num($productfourn->fourn_remise_percent).'%'; print ''; + print ''; print $productfourn->delivery_time_days; print ''; + print ''; if (!empty($productfourn->supplier_reputation) && !empty($object->reputations[$productfourn->supplier_reputation])) { print $object->reputations[$productfourn->supplier_reputation]; } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 91d6f3f4681..950f4d47b5f 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -4,7 +4,8 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2014-2016 Charlie BENKE * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2019 Pierre Ardoin + * Copyright (C) 2019 Pierre Ardoin + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +22,7 @@ */ /** - * \file htdocs/product/index.php + * \file htdocs/product/index.php * \ingroup product * \brief Homepage products and services */ @@ -142,31 +143,31 @@ print '
'.$langs->trans("Statistics").'product->enabled)) { $statProducts = '
'.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).''.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
'.$langs->trans("ProductsOnSaleOnly").''.round($prodser[0][1]).''.$langs->trans("ProductsOnSaleOnly").''.round($prodser[0][1]).'
'.$langs->trans("ProductsOnPurchaseOnly").''.round($prodser[0][2]).''.$langs->trans("ProductsOnPurchaseOnly").''.round($prodser[0][2]).'
'.$langs->trans("ProductsOnSellAndOnBuy").''.round($prodser[0][3]).''.$langs->trans("ProductsOnSellAndOnBuy").''.round($prodser[0][3]).'
'.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).''.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
'.$langs->trans("ServicesOnSaleOnly").''.round($prodser[1][1]).''.$langs->trans("ServicesOnSaleOnly").''.round($prodser[1][1]).'
'.$langs->trans("ServicesOnPurchaseOnly").''.round($prodser[1][2]).''.$langs->trans("ServicesOnPurchaseOnly").''.round($prodser[1][2]).'
'.$langs->trans("ServicesOnSellAndOnBuy").''.round($prodser[1][3]).''.$langs->trans("ServicesOnSellAndOnBuy").''.round($prodser[1][3]).'
'.$langs->trans("Total").''; +print '
'.$langs->trans("Total").''; print $total; print '
'; @@ -198,7 +199,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS print '
'; print ''; print ''; - print ''; - print ''; print '
'.$langs->trans("Categories").'
'; + print '
'; $sql = "SELECT c.label, count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; @@ -258,7 +259,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS } } print '
'.$langs->trans("Total").''; + print '
'.$langs->trans("Total").''; print $total; print '
'; @@ -356,15 +357,15 @@ if ($result) $objp->price = $price_result; } } - print '
'; + print ''; if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC"); else print price($objp->price).' '.$langs->trans("HT"); print ''; + print ''; print $product_static->LibStatut($objp->tosell, 3, 0); print "'; + print ''; print $product_static->LibStatut($objp->tobuy, 3, 1); print "
'; if ($product_type==0) - print ''; + print ''; else - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; } $i = 0; @@ -463,12 +464,12 @@ function activitytrim($product_type) { if ($trim1+$trim2+$trim3+$trim4 > 0) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; $lgn++; } @@ -496,12 +497,12 @@ function activitytrim($product_type) } if ($trim1+$trim2+$trim3+$trim4 > 0) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; } if ($num > 0 ) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dd2ae7bed87..b37a0d31df9 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -514,26 +514,26 @@ if ($resql) print ''; if (! empty($arrayfields['p.ref']['checked'])) { - print ''; } if (! empty($arrayfields['pfp.ref_fourn']['checked'])) { - print ''; } if (! empty($arrayfields['p.label']['checked'])) { - print ''; } // Type if (! empty($arrayfields['p.fk_product_type']['checked'])) { - print ''; @@ -555,7 +555,7 @@ if ($resql) // Sell price if (! empty($arrayfields['p.sellprice']['checked'])) { - print ''; } // Minimum buying Price @@ -623,17 +623,17 @@ if ($resql) } if (! empty($arrayfields['p.tosell']['checked'])) { - print ''; } if (! empty($arrayfields['p.tobuy']['checked'])) { - print ''; } - print ''; @@ -641,39 +641,81 @@ if ($resql) print ''; print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"], "pfp.ref_fourn", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], "p.label", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"], "p.fk_product_type", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"], "p.barcode", "", $param, "", $sortfield, $sortorder); - if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"], "p.duration", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"], "p.desiredstock", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"], "p.stock", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"], "p.tobatch", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy", "", $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['p.ref']['checked'])) { + print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['pfp.ref_fourn']['checked'])) { + print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"], "pfp.ref_fourn", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['p.label']['checked'])) { + print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], "p.label", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['p.fk_product_type']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"], "p.fk_product_type", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['p.barcode']['checked'])) { + print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"], "p.barcode", "", $param, "", $sortfield, $sortorder); + } + if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) { + print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"], "p.duration", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (! empty($arrayfields['p.sellprice']['checked'])) { + print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.minbuyprice']['checked'])) { + print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.numbuyprice']['checked'])) { + print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.pmp']['checked'])) { + print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { + print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.desiredstock']['checked'])) { + print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"], "p.desiredstock", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.stock']['checked'])) { + print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"], "p.stock", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['stock_virtual']['checked'])) { + print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.tobatch']['checked'])) { + print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"], "p.tobatch", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) { + print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell", "", $param, '', $sortfield, $sortorder); + } + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) { + print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy", "", $param, '', $sortfield, $sortorder); + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'], $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'], $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); - print "\n"; + if (! empty($arrayfields['p.datec']['checked'])) { + print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (! empty($arrayfields['p.tms']['checked'])) { + print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (! empty($arrayfields['p.tosell']['checked'])) { + print_liste_field_titre($arrayfields['p.tosell']['label'], $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['p.tobuy']['checked'])) { + print_liste_field_titre($arrayfields['p.tobuy']['label'], $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right '); + } + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print "\n"; - $product_static=new Product($db); - $product_fourn =new ProductFournisseur($db); + $product_static = new Product($db); + $product_fourn = new ProductFournisseur($db); $i = 0; $totalarray=array(); @@ -776,7 +818,7 @@ if ($resql) // Duration if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) { - print ''; } @@ -865,7 +907,7 @@ if ($resql) // Limit alert if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -937,7 +979,7 @@ if ($resql) // Date creation if (! empty($arrayfields['p.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -945,7 +987,7 @@ if ($resql) // Date modification if (! empty($arrayfields['p.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -954,7 +996,7 @@ if ($resql) // Status (to sell) if (! empty($arrayfields['p.tosell']['checked'])) { - print '"; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); -print_liste_field_titre('NbOfQtyInProposals', $_SERVER["PHP_SELF"], 'c', '', $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('NbOfQtyInProposals', $_SERVER["PHP_SELF"], 'c', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; foreach($infoprod as $prodid => $vals) @@ -196,7 +196,7 @@ foreach($infoprod as $prodid => $vals) else print $langs->trans("Product"); print ''; print ''; - print ''; + print ''; print "\n"; $i++; } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index ec1987d4764..0738d421c3c 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -893,9 +893,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; foreach ($object->prices_by_qty_list[$i] as $ii => $prices) @@ -907,18 +907,18 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; } else { print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; } @@ -1013,10 +1013,10 @@ else print ''; //print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; if ($action != 'edit_price_by_qty') @@ -1028,13 +1028,13 @@ else print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -1049,27 +1049,27 @@ else print ''; // id in product_price_by_qty print ''; print ''; - print ''; - print ''; + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; } else { print ''; print ''; - print ''; - print ''; + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - print ''; + print ''; } if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - print ''; + print ''; } - print ''; + print ''; print $conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL; - if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) print ''; - print ''; - print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) print ''; + print ''; + print ''; if (! empty($conf->dynamicprices->enabled)) { - print ''; + print ''; } - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if ($user->rights->produit->supprimer) - print ''; + print ''; print ''; $notfirstlineforlevel=array(); @@ -1509,16 +1509,16 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ // Price level if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - print '"; + print '"; } // Price by quantity if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { $type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard'; - print '"; + print '"; } - print ''; - print ''; - print '"; + print ''; + print ''; + print '"; } else { - print '"; - print '"; if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled - print ''; + print ''; } } - print ''; - print ''; // User - print ''; + print ''; // Action if ($user->rights->produit->supprimer) @@ -1599,7 +1599,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ } elseif ($i > 0) $candelete=1; - print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print ''; - print ''; + //print ''; + print ''; } else { - print ''; + print ''; } - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -1917,8 +1917,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ""; print ""; - print '"; - print '"; + print '"; - print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print '"; - print ''; + //print '"; + print ''; } else { - print '"; + print '"; } - print ''; - print ''; + print ''; + print ''; // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); - print ''; print ''; @@ -1992,7 +1992,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; // Print the search button - print ''; @@ -2002,22 +2002,22 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print ''; - print ''; + //print ''; + print ''; } else { - print ''; + print ''; } - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -2046,8 +2046,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ""; print ""; - print '"; - print '"; + print '"; - print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print '"; - print ''; + //print '"; + print ''; } else { - print '"; + print '"; } - print ''; - print ''; - print ''; + print ''; + print ''; if ($user->rights->produit->supprimer || $user->rights->service->supprimer) { - print '"; print ""; - print '"; - print '"; + print '"; - print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print '"; - print ''; + //print '"; + print ''; } else { - print '"; + print '"; } - print ''; - print ''; + print ''; + print ''; // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); - print ''; @@ -2165,7 +2165,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Action if ($user->rights->produit->supprimer || $user->rights->service->supprimer) { - print ''; - print ''; + print ''; print ''; if ($virtualdiffersfromphysical) print ''; print ''; print ''; print ''; - print ''; @@ -306,23 +306,23 @@ if ($resql) print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); - if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("StockLimit", $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", 'align="right"', $sortfield, $sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("StockLimit", $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right '); // Details per warehouse if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context) { if ($nb_warehouse>1) { - foreach($warehouses_list as &$wh) { - print_liste_field_titre($wh['label'], '', '', '', '', 'align="right"'); + foreach ($warehouses_list as &$wh) { + print_liste_field_titre($wh['label'], '', '', '', '', '', '', '', 'right '); } } } - if ($virtualdiffersfromphysical) print_liste_field_titre("VirtualStock", $_SERVER["PHP_SELF"], "", $param, "", 'align="right"', $sortfield, $sortorder); + if ($virtualdiffersfromphysical) print_liste_field_titre("VirtualStock", $_SERVER["PHP_SELF"], "", $param, "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); - print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", $param, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", $param, "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); print "\n"; @@ -343,18 +343,18 @@ if ($resql) if (! empty($conf->service->enabled) && $type == 1) { - print ''; } - //print ''; - print ''; - print ''; + //print ''; + print ''; + print ''; // Real stock - print ''; @@ -365,7 +365,7 @@ if ($resql) if($nb_warehouse>1) { foreach($warehouses_list as &$wh) { - print ''; } @@ -375,14 +375,14 @@ if ($resql) // Virtual stock if ($virtualdiffersfromphysical) { - print ''; } - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; $i++; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 3d4e79c4569..a1f3398b685 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -285,14 +285,14 @@ if ($resql) print ''; } print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; @@ -302,18 +302,18 @@ if ($resql) print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); - if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", 'align="center"', $sortfield, $sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", $param, "", '', $sortfield, $sortorder); - //print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", 'align="right"', $sortfield, $sortorder); + //print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right ); + print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", $param, "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right '); // TODO Add info of running suppliers/customers orders - //print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); + //print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'',$sortfield,$sortorder, 'right '); print_liste_field_titre(''); - print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); print "\n"; @@ -375,16 +375,16 @@ if ($resql) if (! empty($conf->service->enabled) && $type == 1) { - print ''; } - //print ''; - //print ''; - //print ''; + //print ''; + //print ''; + //print ''; // Warehouse print ''; // Lot - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; $i++; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index dd7bc25dc4c..f4ee61190e8 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -443,13 +443,21 @@ else print ""; print_liste_field_titre("Product", "", "p.ref", "&id=".$id, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", "", "p.label", "&id=".$id, "", "", $sortfield, $sortorder); - print_liste_field_titre("Units", "", "ps.reel", "&id=".$id, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("AverageUnitPricePMPShort", "", "p.pmp", "&id=".$id, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("EstimatedStockValueShort", "", "", "&id=".$id, "", 'align="right"', $sortfield, $sortorder); - if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre("SellPriceMin", "", "p.price", "&id=".$id, "", 'align="right"', $sortfield, $sortorder); - if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&id=".$id, "", 'align="right"', $sortfield, $sortorder); - if ($user->rights->stock->mouvement->creer) print_liste_field_titre(''); - if ($user->rights->stock->creer) print_liste_field_titre(''); + print_liste_field_titre("Units", "", "ps.reel", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("AverageUnitPricePMPShort", "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("EstimatedStockValueShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + if (empty($conf->global->PRODUIT_MULTIPRICES)) { + print_liste_field_titre("SellPriceMin", "", "p.price", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + } + if (empty($conf->global->PRODUIT_MULTIPRICES)) { + print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + } + if ($user->rights->stock->mouvement->creer) { + print_liste_field_titre(''); + } + if ($user->rights->stock->creer) { + print_liste_field_titre(''); + } print "\n"; $totalunit=0; @@ -506,28 +514,28 @@ else // Label print ''; - print ''; $totalunit+=$objp->value; // Price buy PMP - print ''; + print ''; // Total PMP - print ''; + print ''; $totalvalue+=price2num($objp->ppmp*$objp->value, 'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) { $pricemin=$objp->price; - print ''; // Total sell min - print ''; } @@ -535,14 +543,14 @@ else if ($user->rights->stock->mouvement->creer) { - print '"; } if ($user->rights->stock->creer) { - print '"; } @@ -553,16 +561,16 @@ else $db->free($resql); print ''; - print ''; print ''; - print ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 9dd34f18569..ba8339f98ed 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -205,7 +205,7 @@ class Warehouses extends DolibarrApi } if($this->warehouse->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index fe9577c5ca8..81e8680034e 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2008 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2016 Francis Appels + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +45,7 @@ class Entrepot extends CommonObject public $table_element='entrepot'; public $picto='stock'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** * Warehouse closed, inactive @@ -75,8 +77,14 @@ class Entrepot extends CommonObject */ public $address; - //! Code Postal + /** + * @var string Zipcode + */ public $zip; + + /** + * @var string Town + */ public $town; /** @@ -572,26 +580,26 @@ class Entrepot extends CommonObject { return $label; } - if ($mode == 1) + elseif ($mode == 1) { return $label; } - if ($mode == 2) + elseif ($mode == 2) { if ($statut > 0) $picto = 'statut4'; return img_picto($label, $picto).' '.$label; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut > 0) $picto = 'statut4'; return img_picto($label, $picto).' '.$label; } - if ($mode == 4) + elseif ($mode == 4) { if ($statut > 0) $picto = 'statut4'; return img_picto($label, $picto).' '.$label; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut > 0) $picto = 'statut4'; return $label.' '.img_picto($label, $picto); @@ -616,7 +624,6 @@ class Entrepot extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result=''; - $label = ''; $label = '' . $langs->trans("ShowWarehouse").''; $label.= '
' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref); @@ -723,9 +730,9 @@ class Entrepot extends CommonObject /** * Return array of children warehouses ids from $id warehouse (recursive function) * - * @param int $id id parent warehouse - * @param array $TChildWarehouses array which will contain all children (param by reference) - * @return array $TChildWarehouses array which will contain all children + * @param int $id id parent warehouse + * @param integer[] $TChildWarehouses array which will contain all children (param by reference) + * @return integer[] $TChildWarehouses array which will contain all children */ function get_children_warehouses($id, &$TChildWarehouses) { diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index ea11974ae97..a19025b5dd6 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -92,7 +92,7 @@ if ($result) print '
'; print "\n"; - print ''; + print ''; print "\n"; $i++; } @@ -142,7 +142,7 @@ if ($resql) print ''; } print ''; - print ''; + print ''; print "\n"; $i=0; @@ -170,7 +170,7 @@ if ($resql) print '\n"; - print ''; print "\n"; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 95071085923..7db2dffc7db 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -162,22 +162,22 @@ if ($result) // Lignes des champs de filtre print ''; - print ''; - print ''; print ''; - print ''; - print ''; @@ -187,10 +187,10 @@ if ($result) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("LocationSummary", $_SERVER["PHP_SELF"], "e.lieu", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -213,14 +213,14 @@ if ($result) // Location print ''; // Stock qty - print ''; + print ''; // PMP value - print ''; // Selling value - print ''; // Status - print ''; + print ''; print ''; @@ -242,10 +242,10 @@ if ($result) if ($totalnboflines-$offset <= $limit) { print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; while ($i < $num && $i < $max) @@ -522,18 +522,18 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S $taskstatic->fk_statut = $obj->status; $taskstatic->dateo = $db->jdate($obj->dateo); $taskstatic->datee = $db->jdate($obj->datee); - print ''; - print ''; + print ''; - print ''; - print ''; - print ''; - print ''; print "\n"; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index a7c9aaf329d..7fe2d0af8a6 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -485,7 +485,7 @@ print ''; print ''; print ''; // Action column -print ''; @@ -495,13 +495,13 @@ print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; print ''; -print ''; -print ''; -/*print ''; -if ($usertoprocess->id == $user->id) print ''; -else print '';*/ -print ''; -print ''; +print ''; +print ''; +/*print ''; +if ($usertoprocess->id == $user->id) print ''; +else print '';*/ +print ''; +print ''; print ''; // By default, we can edit only tasks we are assigned to diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index a293c8ee451..ca4663bd43e 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -309,17 +309,17 @@ print ''; print '
'.$langs->trans("ProductSellByQuarterHT").'
'.$langs->trans("ProductSellByQuarterHT").'
'.$langs->trans("ServiceSellByQuarterHT").''.$langs->trans("Quarter1").''.$langs->trans("Quarter2").''.$langs->trans("Quarter3").''.$langs->trans("Quarter4").''.$langs->trans("Total").'
'.$langs->trans("ServiceSellByQuarterHT").''.$langs->trans("Quarter1").''.$langs->trans("Quarter2").''.$langs->trans("Quarter3").''.$langs->trans("Quarter4").''.$langs->trans("Total").'
'.$tmpyear.''.price($trim1).''.price($trim2).''.price($trim3).''.price($trim4).''.price($trim1+$trim2+$trim3+$trim4).'
'.$tmpyear.''.price($trim1).''.price($trim2).''.price($trim3).''.price($trim4).''.price($trim1+$trim2+$trim3+$trim4).'
'.$tmpyear.''.price($trim1).''.price($trim2).''.price($trim3).''.price($trim4).''.price($trim1+$trim2+$trim3+$trim4).'
'.$tmpyear.''.price($trim1).''.price($trim2).''.price($trim3).''.price($trim4).''.price($trim1+$trim2+$trim3+$trim4).'
'; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); print $form->selectarray('search_type', $array, $search_type); print ''; + print ''; print ''; + print ''; print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1); print ''; + print ''; print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1); print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; if (preg_match('/([^a-z]+)[a-z]$/i', $obj->duration)) { @@ -842,7 +884,7 @@ if ($resql) // Number of buy prices if (! empty($arrayfields['p.numbuyprice']['checked'])) { - print ''; + print ''; if ($obj->tobuy) { if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) @@ -857,7 +899,7 @@ if ($resql) // WAP if (! empty($arrayfields['p.pmp']['checked'])) { - print ''; + print ''; print price($product_static->pmp, 1, $langs); print ''; + print ''; if ($obj->fk_product_type != 1) { print $obj->seuil_stock_alerte; @@ -876,7 +918,7 @@ if ($resql) // Desired stock if (! empty($arrayfields['p.desiredstock']['checked'])) { - print ''; + print ''; if ($obj->fk_product_type != 1) { print $obj->desiredstock; @@ -887,7 +929,7 @@ if ($resql) // Stock real if (! empty($arrayfields['p.stock']['checked'])) { - print ''; + print ''; if ($obj->fk_product_type != 1) { if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; @@ -899,7 +941,7 @@ if ($resql) // Stock virtual if (! empty($arrayfields['stock_virtual']['checked'])) { - print ''; + print ''; if ($obj->fk_product_type != 1) { if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; @@ -911,7 +953,7 @@ if ($resql) // Lot/Serial if (! empty($arrayfields['p.tobatch']['checked'])) { - print ''; + print ''; print yn($obj->tobatch); print ''; + print ''; print dol_print_date($obj->date_creation, 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($obj->date_update, 'dayhour', 'tzuser'); print ''; + print ''; if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { @@ -966,7 +1008,7 @@ if ($resql) // Status (to buy) if (! empty($arrayfields['p.tobuy']['checked'])) { - print ''; + print ''; if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { @@ -976,7 +1018,7 @@ if ($resql) if (! $i) $totalarray['nbfield']++; } // Action - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 897763f4d91..8efbf7667ba 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -163,7 +163,7 @@ print "
'.$vals['label'].''.$vals['nblineproposal'].''.$vals['nblineproposal'].'
' . $langs->trans("PriceByQuantityRange") . ' ' . $i . '' . $langs->trans("HT") . '' . $langs->trans("UnitPrice") . '' . $langs->trans("Discount") . '' . $langs->trans("HT") . '' . $langs->trans("UnitPrice") . '' . $langs->trans("Discount") . ' 
 ' . $object->price_base_type . ' % ' . $object->price_base_type . ' %
' . $prices['quantity'] . '' . price($prices['price']) . '' . price($prices['unitprice']) . '' . price($prices['remise_percent']) . ' %'; + print '' . price($prices['price']) . '' . price($prices['unitprice']) . '' . price($prices['remise_percent']) . ' %'; if (($user->rights->produit->creer || $user->rights->service->creer)) { print ''; print img_edit() . ''; @@ -938,10 +938,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI print ''; // id in product_price print '
 ' . $object->price_base_type . '  % ' . $object->price_base_type . '  %
' . $langs->trans("PriceByQuantityRange") . '' . $langs->trans("Quantity") . '' . $langs->trans("Price") . '' . $langs->trans("UnitPrice") . '' . $langs->trans("Discount") . '' . $langs->trans("Price") . '' . $langs->trans("UnitPrice") . '' . $langs->trans("Discount") . ' 
'; //print $object->price_base_type; print '  %  %
'; + print ''; //print $object->price_base_type; print $prices['price_base_type']; print '  %  %
' . $prices['quantity'] . '' . price($prices['price']) . ''; + print '' . price($prices['price']) . ''; //print $object->price_base_type; print $prices['price_base_type']; print '' . price($prices['unitprice']) . '' . price($prices['remise_percent']) . ' %'; + print '' . price($prices['unitprice']) . '' . price($prices['remise_percent']) . ' %'; if (($user->rights->produit->creer || $user->rights->service->creer)) { print ''; @@ -1475,25 +1475,25 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ print '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceLevel") . '' . $langs->trans("PriceLevel") . '' . $langs->trans("Type") . '' . $langs->trans("Type") . '' . $langs->trans("PriceBase") . '' . $langs->trans("PriceBase") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("PriceExpressionSelected") . '' . $langs->trans("PriceExpressionSelected") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '  
' . $objp->price_level . "' . $objp->price_level . "' . $langs->trans($type) . "' . $langs->trans($type) . "'; + print ''; if (empty($objp->price_by_qty)) { print $langs->trans($objp->price_base_type); } @@ -1526,7 +1526,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - print ''; + print ''; if (empty($objp->price_by_qty)) { $positiverates=''; @@ -1552,41 +1552,41 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ $price_expression = new PriceExpression($db); $res = $price_expression->fetch($objp->fk_price_expression); $title = $price_expression->title; - print '' . $title . "' . $title . "'; + print ''; if (empty($objp->price_by_qty)) { print ($objp->price_base_type != 'TTC' ? price($objp->price) : ''); } print "'; + print ''; if (empty($objp->price_by_qty)) { print ($objp->price_base_type == 'TTC' ? price($objp->price_ttc) : ''); } print "'; + print ''; if (empty($objp->price_by_qty)) { print ($objp->price_base_type != 'TTC' ? price($objp->price_min) : ''); } print ''; + print ''; if (empty($objp->price_by_qty)) { print ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : ''); } print '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . ''; + print ''; if ($candelete) { print 'id . '&lineid=' . $objp->rowid . '">'; @@ -1866,21 +1866,21 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("PriceBase") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("INCVATONLY") . '' . $langs->trans("INCT") . '' . $langs->trans("INCVATONLY") . '' . $langs->trans("INCT") . '' . $langs->trans("TTC") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
" . $staticsoc->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "'; + print '' . $langs->trans($line->price_base_type) . "'; $positiverates=''; if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); @@ -1930,25 +1930,25 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) //. vatrate($tva_tx, true, $line->recuperableonly) . print "' . price($line->price) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($resultarray[2]) . '' . price($line->price_ttc) . "' . price($resultarray[2]) . '' . price($line->price_ttc) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print ''; print $userstatic->getLoginUrl(1); print '
 '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("PriceBase") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("INCVATONLY") . '' . $langs->trans("INCT") . '' . $langs->trans("INCVATONLY") . '' . $langs->trans("INCT") . '' . $langs->trans("TTC") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
" . $langs->trans("Default") . "" . "' . $langs->trans($object->price_base_type) . "'; + print '' . $langs->trans($object->price_base_type) . "'; $positiverates=''; if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx); @@ -2060,26 +2060,26 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) //print $object->default_vat_code?' ('.$object->default_vat_code.')':''; print "' . price($object->price) . "' . price($object->price) . "' . price($object->price_ttc) . "' . price($resultarray[2]) . '' . price($object->price_ttc) . "' . price($resultarray[2]) . '' . price($object->price_ttc) . "' . price($object->price_ttc) . "' . price($object->price_min) . '' . price($object->price_min_ttc) . ''; + print '' . price($object->price_min) . '' . price($object->price_min_ttc) . ''; print ''; + print ''; print 'id . '">'; print img_info($langs->trans('PriceByCustomerLog')); print ''; @@ -2128,8 +2128,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print "" . $staticsoc->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "'; + print '' . $langs->trans($line->price_base_type) . "'; $positiverates=''; if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); @@ -2139,25 +2139,25 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) echo vatrate($positiverates.($line->default_vat_code?' ('.$line->default_vat_code.')':''), '%', ($line->tva_npr?$line->tva_npr:$line->recuperableonly)); print "' . price($line->price) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($resultarray[2]) . '' . price($line->price_ttc) . "' . price($resultarray[2]) . '' . price($line->price_ttc) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print ''; print $userstatic->getLoginUrl(1); print ''; + print ''; print 'id . '&socid=' . $line->fk_soc . '">'; print img_info($langs->trans('PriceByCustomerLog')); print ''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index fd9d45828d5..31bbfa4b701 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -290,13 +290,13 @@ if ($resql) } // Stock limit print '       '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationYear"); elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationMonth"); elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationDay"); else print $objp->duration; print ''.$objp->stock_theorique.''.$objp->seuil_stock_alerte.''.$objp->desiredstock.''.$objp->stock_theorique.''.$objp->seuil_stock_alerte.''.$objp->desiredstock.''; + print ''; if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $objp->stock_physique|0; print ''; + print ''; print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real; print ''; + print ''; if ($objp->seuil_stock_alerte != '' && ($product->stock_theorique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $product->stock_theorique; print ''.$langs->trans("Movements").''.$product->LibStatut($objp->statut, 5, 0).''.$product->LibStatut($objp->tobuy, 5, 1).''.$langs->trans("Movements").''.$product->LibStatut($objp->statut, 5, 0).''.$product->LibStatut($objp->tobuy, 5, 1).'
       '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationYear"); elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationMonth"); elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationDay"); else print $objp->duration; print ''.$objp->stock_theorique.''.$objp->seuil_stock_alerte.''.$objp->desiredstock.''.$objp->stock_theorique.''.$objp->seuil_stock_alerte.''.$objp->desiredstock.''; @@ -395,22 +395,22 @@ if ($resql) print ''; + print ''; if ($product_lot_static->batch) { print $product_lot_static->getNomUrl(1); } print ''.dol_print_date($db->jdate($objp->eatby), 'day').''.dol_print_date($db->jdate($objp->sellby), 'day').''; + print ''.dol_print_date($db->jdate($objp->eatby), 'day').''.dol_print_date($db->jdate($objp->sellby), 'day').''; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $objp->stock_physique; print ''.$langs->trans("Movements").''.$product_static->LibStatut($objp->statut, 5, 0).''.$product_static->LibStatut($objp->tobuy, 5, 1).''.$langs->trans("Movements").''.$product_static->LibStatut($objp->statut, 5, 0).''.$product_static->LibStatut($objp->tobuy, 5, 1).'
'.$objp->produit.''; + print ''; $valtoshow=price2num($objp->value, 'MS'); print empty($valtoshow)?'0':$valtoshow; print ''.price(price2num($objp->ppmp, 'MU')).''.price(price2num($objp->ppmp, 'MU')).''.price(price2num($objp->ppmp*$objp->value, 'MT')).''.price(price2num($objp->ppmp*$objp->value, 'MT')).''; + print ''; print price(price2num($pricemin, 'MU'), 1); print ''; + print ''; print price(price2num($pricemin*$objp->value, 'MT'), 1); print ''; + print ''; print img_picto($langs->trans("StockMovement"), 'uparrow.png', 'class="hideonsmartphone"').' '.$langs->trans("StockMovement"); print "'; + print ''; print $langs->trans("StockCorrection"); print "
'.$langs->trans("Total").''; + print ''; $valtoshow=price2num($totalunit, 'MS'); print empty($valtoshow)?'0':$valtoshow; print ' '.price(price2num($totalvalue, 'MT')).''.price(price2num($totalvalue, 'MT')).' '.price(price2num($totalvaluesell, 'MT')).''.price(price2num($totalvaluesell, 'MT')).'  
rowid\">".img_object($langs->trans("ShowStock"), "stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut, 5).''.$entrepot->LibStatut($objp->statut, 5).'
'.$langs->trans("EatByDate").''.$langs->trans("Warehouse").''.$langs->trans("FullList").''.$langs->trans("FullList").'
'; print img_object($langs->trans("ShowWarehouse"), "stock").' '.$objp->stock; print "'; + print ''; if ($objp->qty > 0) print '+'; print $objp->qty.'
'; + print ''; print ''; print ''; + print ''; print ''; print ''; print ''; + print ''; print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$objp->lieu.''.price2num($objp->stockqty, 5).''.price2num($objp->stockqty, 5).''; + print ''; if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); else print ''; print ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); else { @@ -229,7 +229,7 @@ if ($result) } print ''.$warehouse->LibStatut($objp->statut, 5).''.$warehouse->LibStatut($objp->statut, 5).'
'.$langs->trans("Total").''.price2num($totalStock, 5).''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''; + print ''.$langs->trans("Total").''.price2num($totalStock, 5).''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency); else { diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 81a625f254c..bae6ff55ef7 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -347,14 +347,13 @@ print ''; $param=''; print ''; -print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', 'class="tagtd maxwidthonsmartphone"', $sortfield, $sortorder); -if ($conf->productbatch->enabled) -{ - print getTitleFieldOfList($langs->trans('Batch'), 0, $_SERVER["PHP_SELF"], '', $param, '', 'class="tagtd maxwidthonsmartphone"', $sortfield, $sortorder); +print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); +if ($conf->productbatch->enabled) { + print getTitleFieldOfList($langs->trans('Batch'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); } -print getTitleFieldOfList($langs->trans('WarehouseSource'), 0, $_SERVER["PHP_SELF"], '', $param, '', 'class="tagtd maxwidthonsmartphone"', $sortfield, $sortorder); -print getTitleFieldOfList($langs->trans('WarehouseTarget'), 0, $_SERVER["PHP_SELF"], '', $param, '', 'class="tagtd maxwidthonsmartphone"', $sortfield, $sortorder); -print getTitleFieldOfList($langs->trans('Qty'), 0, $_SERVER["PHP_SELF"], '', $param, '', 'align="center" class="tagtd maxwidthonsmartphone"', $sortfield, $sortorder); +print getTitleFieldOfList($langs->trans('WarehouseSource'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); +print getTitleFieldOfList($langs->trans('WarehouseTarget'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); +print getTitleFieldOfList($langs->trans('Qty'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'center tagtd maxwidthonsmartphone '); print getTitleFieldOfList('', 0); print ''; @@ -364,8 +363,7 @@ print ''; print ''; // Qty -print ''; +print ''; // Button to add line -print ''; +print ''; print ''; @@ -420,8 +418,8 @@ foreach($listofdata as $key => $val) print ''; - print ''; - print ''; + print ''; + print ''; print ''; } diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index dd4bd9aa628..ba8ea43f231 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -1,9 +1,10 @@ +/* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,8 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (! empty($conf->projet->enabled)) -{ +if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -771,7 +771,7 @@ if ($resql) if (! empty($arrayfields['m.rowid']['checked'])) { // Ref - print ''; } @@ -789,36 +789,36 @@ if ($resql) if (! empty($arrayfields['p.ref']['checked'])) { // Product Ref - print ''; } if (! empty($arrayfields['p.label']['checked'])) { // Product label - print ''; } // Batch if (! empty($arrayfields['m.batch']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.eatby']['checked'])) { - print ''; } if (! empty($arrayfields['pl.sellby']['checked'])) { - print ''; } // Warehouse if (! empty($arrayfields['e.ref']['checked'])) { - print ''; @@ -826,28 +826,28 @@ if ($resql) if (! empty($arrayfields['m.fk_user_author']['checked'])) { // Author - print ''; } if (! empty($arrayfields['m.inventorycode']['checked'])) { // Inventory code - print ''; } if (! empty($arrayfields['m.label']['checked'])) { // Label of movement - print ''; } if (! empty($arrayfields['m.type_mouvement']['checked'])) { // Type of movement - print ''; } if (! empty($arrayfields['m.value']['checked'])) { // Qty - print ''; } if (! empty($arrayfields['m.price']['checked'])) { // Price - print ''; } @@ -904,7 +904,7 @@ if ($resql) print ''; } // Actions - print ''; @@ -920,13 +920,15 @@ if ($resql) if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['m.batch']['checked'])) - print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['pl.eatby']['checked'])) - print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['pl.sellby']['checked'])) - print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['e.ref']['checked'])) - print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible + print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['e.ref']['checked'])) { + // We are on a specific warehouse card, no filter on other should be possible + print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); + } if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['m.inventorycode']['checked'])) @@ -934,13 +936,13 @@ if ($resql) if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['m.type_mouvement']['checked'])) - print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['m.value']['checked'])) - print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['m.price']['checked'])) - print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -949,16 +951,19 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['m.datec']['checked'])) { + print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (! empty($arrayfields['m.tms']['checked'])) { + print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $arrayofuniqueproduct=array(); - while ($i < min($num, $limit)) - { + while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); $userstatic->id=$objp->fk_user_author; @@ -984,7 +989,7 @@ if ($resql) $warehousestatic->lieu=$objp->lieu; $arrayofuniqueproduct[$objp->rowid]=$objp->produit; - if(!empty($objp->fk_origin)) { + if (!empty($objp->fk_origin)) { $origin = $movement->get_origin($objp->fk_origin, $objp->origintype); } else { $origin = ''; @@ -994,7 +999,8 @@ if ($resql) // Id movement if (! empty($arrayfields['m.rowid']['checked'])) { - print ''; // This is primary not movement id + // This is primary not movement id + print ''; } if (! empty($arrayfields['m.datem']['checked'])) { @@ -1028,11 +1034,11 @@ if ($resql) } if (! empty($arrayfields['pl.eatby']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.sellby']['checked'])) { - print ''; + print ''; } // Warehouse if (! empty($arrayfields['e.ref']['checked'])) @@ -1071,16 +1077,16 @@ if ($resql) // Type of movement switch($objp->type_mouvement) { case "0": - print ''; + print ''; break; case "1": - print ''; + print ''; break; case "2": - print ''; + print ''; break; case "3": - print ''; + print ''; break; } } @@ -1092,7 +1098,7 @@ if ($resql) if (! empty($arrayfields['m.value']['checked'])) { // Qty - print ''; @@ -1100,12 +1106,12 @@ if ($resql) if (! empty($arrayfields['m.price']['checked'])) { // Price - print ''; } // Action column - print ''; - //print ''; //print ''; - //print ''; + //print ''; } } else diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 0eff40ddd72..6c3f5b6b7ce 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -403,28 +404,6 @@ if ($action == "transfert_stock" && ! $cancel) } -/* - * Build document - */ -/* The builddoc action for object of a movement must be on the movement card -// Actions to build doc -$upload_dir = $conf->stock->dir_output; -$permissioncreate = $user->rights->stock->creer; -include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; -*/ - -if (empty($reshook) && $action != 'remove_file') -{ - $objectclass='MouvementStock'; - $objectlabel='Movements'; - $permtoread = $user->rights->stock->lire; - $permtodelete = $user->rights->stock->supprimer; - $uploaddir = $conf->stock->dir_output; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; -} - - - /* * View */ @@ -768,7 +747,7 @@ if ($resql) if (! empty($arrayfields['m.rowid']['checked'])) { // Ref - print ''; } @@ -786,36 +765,36 @@ if ($resql) if (! empty($arrayfields['p.ref']['checked'])) { // Product Ref - print ''; } if (! empty($arrayfields['p.label']['checked'])) { // Product label - print ''; } // Batch if (! empty($arrayfields['m.batch']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.eatby']['checked'])) { - print ''; } if (! empty($arrayfields['pl.sellby']['checked'])) { - print ''; } // Warehouse if (! empty($arrayfields['e.ref']['checked'])) { - print ''; @@ -823,28 +802,28 @@ if ($resql) if (! empty($arrayfields['m.fk_user_author']['checked'])) { // Author - print ''; } if (! empty($arrayfields['m.inventorycode']['checked'])) { // Inventory code - print ''; } if (! empty($arrayfields['m.label']['checked'])) { // Label of movement - print ''; } if (! empty($arrayfields['m.type_mouvement']['checked'])) { // Type of movement - print ''; } if (! empty($arrayfields['m.value']['checked'])) { // Qty - print ''; } if (! empty($arrayfields['m.price']['checked'])) { // Price - print ''; } @@ -901,28 +880,59 @@ if ($resql) print ''; } // Actions - print ''; print "\n"; print ''; - if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible - if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['m.rowid']['checked'])) { + print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder); + } + if (! empty($arrayfields['m.datem']['checked'])) { + print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder); + } + if (! empty($arrayfields['p.ref']['checked'])) { + print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + } + if (! empty($arrayfields['p.label']['checked'])) { + print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); + } + if (! empty($arrayfields['m.batch']['checked'])) { + print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (! empty($arrayfields['pl.eatby']['checked'])) { + print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (! empty($arrayfields['pl.sellby']['checked'])) { + print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center '); + } + if (! empty($arrayfields['e.ref']['checked'])) { + // We are on a specific warehouse card, no filter on other should be possible + print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['m.fk_user_author']['checked'])) { + print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['m.inventorycode']['checked'])) { + print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['m.label']['checked'])) { + print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['m.type_mouvement']['checked'])) { + print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center '); + } + if (! empty($arrayfields['origin']['checked'])) { + print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); + } + if (! empty($arrayfields['m.value']['checked'])) { + print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (! empty($arrayfields['m.price']['checked'])) { + print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right '); + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -931,9 +941,13 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['m.datec']['checked'])) { + print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (! empty($arrayfields['m.tms']['checked'])) { + print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -1010,11 +1024,11 @@ if ($resql) } if (! empty($arrayfields['pl.eatby']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.sellby']['checked'])) { - print ''; + print ''; } // Warehouse if (! empty($arrayfields['e.ref']['checked'])) @@ -1034,7 +1048,7 @@ if ($resql) { // Inventory code print ''; + print ''; break; case "1": - print ''; + print ''; break; case "2": - print ''; + print ''; break; case "3": - print ''; + print ''; break; } } @@ -1074,7 +1088,7 @@ if ($resql) if (! empty($arrayfields['m.value']['checked'])) { // Qty - print ''; @@ -1082,12 +1096,12 @@ if ($resql) if (! empty($arrayfields['m.price']['checked'])) { // Price - print ''; } // Action column - print ''; - //print ''; //print ''; - //print ''; @@ -1144,54 +1158,6 @@ else } - -/* - * Documents generes - */ -/* Area for doc and last events of warehouse are stored on the main card of warehouse -$modulepart='mouvement'; - -if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) -{ - print '
'; - print '
'; - print ''; // ancre - - // Documents - $objectref = dol_sanitizeFileName($object->ref); - // Add inventorycode & type_mouvement to filename of the pdf - if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; - if($search_type_mouvement) $objectref.="_".$search_type_mouvement; - $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->stock->dir_output . '/movement/' . $objectref; - - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; - $genallowed=$usercanread; - $delallowed=$usercancreate; - - $genallowed=$user->rights->stock->mouvement->lire; - $delallowed=$user->rights->stock->mouvement->creer; - - print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); - $somethingshown=$formfile->numoffiles; - - print '
'; - - $MAXEVENT = 10; - - $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product - - print '
'; -} -*/ - // End of page llxFooter(); $db->close(); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 71f450d8c73..2c0515d309c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1,14 +1,14 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013-2018 Juanjo Menent * Copyright (C) 2014-2015 Cédric Gross - * Copyright (C) 2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2015 Marcos García + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,9 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productstockentrepot.class.php'; -if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; -if (! empty($conf->projet->enabled)) -{ +if (! empty($conf->productbatch->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; +} +if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -807,17 +808,17 @@ if (! $variants) { print '
'; $filtertype=0; if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype=''; -if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) -{ +if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) { $limit=''; } else @@ -391,9 +389,9 @@ print ''; print $formproduct->selectWarehouses($id_tw, 'id_tw', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); print '
'; print $warehousestatict->getNomUrl(1); print ''.$val['qty'].''.img_delete($langs->trans("Remove")).''.$val['qty'].''.img_delete($langs->trans("Remove")).'
'; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; //print ''; print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; //print ''; print ''; + print ''; print '  '; print ''; + print ''; print ''; print ''; + print ''; print '  '; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$objp->mid.''.$objp->mid.''. dol_print_date($objp->eatby, 'day') .''. dol_print_date($objp->eatby, 'day') .''. dol_print_date($objp->sellby, 'day') .''. dol_print_date($objp->sellby, 'day') .''.$langs->trans('StockIncreaseAfterCorrectTransfer').''.$langs->trans('StockIncreaseAfterCorrectTransfer').''.$langs->trans('StockDecreaseAfterCorrectTransfer').''.$langs->trans('StockDecreaseAfterCorrectTransfer').''.$langs->trans('StockDecrease').''.$langs->trans('StockDecrease').''.$langs->trans('StockIncrease').''.$langs->trans('StockIncrease').''; + print ''; if ($objp->qt > 0) print '+'; print $objp->qty; print ''; + print ''; if ($objp->price != 0) print price($objp->price); print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -1130,8 +1136,7 @@ if ($resql) print "
"; $productidselected=0; - foreach ($arrayofuniqueproduct as $key => $val) - { + foreach ($arrayofuniqueproduct as $key => $val) { $productidselected=$key; $productlabelselected=$val; } @@ -1143,17 +1148,17 @@ if ($resql) //print '
'; print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt')); //print ''; + //print ''; print ': '.$balancebefore; print "
\n"; //print '
'; print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter, 'day', 'gmt')); //print ''; + //print ''; print ': '.$balanceafter; print "
\n"; - //print '
'; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; //print ''; print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; //print ''; print ''; + print ''; print '  '; print ''; + print ''; print ''; print ''; + print ''; print '  '; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'. dol_print_date($objp->eatby, 'day') .''. dol_print_date($objp->eatby, 'day') .''. dol_print_date($objp->sellby, 'day') .''. dol_print_date($objp->sellby, 'day') .''.''.$langs->trans('StockIncreaseAfterCorrectTransfer').''.$langs->trans('StockIncreaseAfterCorrectTransfer').''.$langs->trans('StockDecreaseAfterCorrectTransfer').''.$langs->trans('StockDecreaseAfterCorrectTransfer').''.$langs->trans('StockDecrease').''.$langs->trans('StockDecrease').''.$langs->trans('StockIncrease').''.$langs->trans('StockIncrease').''; + print ''; if ($objp->qt > 0) print '+'; print $objp->qty; print ''; + print ''; if ($objp->price != 0) print price($objp->price); print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -1125,14 +1139,14 @@ if ($resql) //print '
'; print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt')); //print ''; + //print ''; print ': '.$balancebefore; print "
\n"; //print '
'; print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter, 'day', 'gmt')); //print ''; + //print ''; print ': '.$balanceafter; print "
\n"; //print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -856,18 +857,18 @@ if (! $variants) { $stock_real = price2num($obj->reel, 'MS'); print ''; print ''; - print ''; + print ''; // PMP - print ''; + print ''; // Value purchase - print ''; + print ''; // Sell price - print ''; // Value sell - print ''; else print $langs->trans("Variable"); print ''; @@ -890,33 +891,33 @@ if (! $variants) { print ''; } else { - print "\n" . ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; } } @@ -925,21 +926,21 @@ if (! $variants) { } } else dol_print_error($db); - print ''; - print ''; - print ''; + print ''; + print ''; // Value purchase - print ''; - print ''; // Value to sell - print ''; @@ -959,14 +960,14 @@ if (! $variants) { print '
' . $langs->trans("Warehouse") . '' . $langs->trans("NumberOfUnit") . '' . $langs->trans("AverageUnitPricePMPShort") . '' . $langs->trans("EstimatedStockValueShort") . '' . $langs->trans("SellPriceMin") . '' . $langs->trans("EstimatedStockValueSellShort") . '' . $langs->trans("NumberOfUnit") . '' . $langs->trans("AverageUnitPricePMPShort") . '' . $langs->trans("EstimatedStockValueShort") . '' . $langs->trans("SellPriceMin") . '' . $langs->trans("EstimatedStockValueSellShort") . '
' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '
' . $entrepotstatic->getNomUrl(1) . '' . $stock_real . ($stock_real < 0 ? ' ' . img_warning() : '') . '' . $stock_real . ($stock_real < 0 ? ' ' . img_warning() : '') . '' . (price2num($object->pmp) ? price2num($object->pmp, 'MU') : '') . '' . (price2num($object->pmp) ? price2num($object->pmp, 'MU') : '') . '' . (price2num($object->pmp) ? price(price2num($object->pmp * $obj->reel, 'MT')) : '') . '' . (price2num($object->pmp) ? price(price2num($object->pmp * $obj->reel, 'MT')) : '') . ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($object->price, 'MU'), 1); else print $langs->trans("Variable"); print ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($object->price * $obj->reel, 'MT'), 1) . '
'; print '
'; print ''; - print ''; - print ''; + print ''; - print ''; - print ''; + print ''; print ''; print '
'; + print ''; print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); print ''; + print ''; print $form->selectDate($pdluo->sellby, 'sellby', '', '', 1, '', 1, 0); print '' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . ''; print '
'; print '
'; print '
'; + print "\n" . '
'; print img_picto($langs->trans("Tranfer"), 'uparrow', 'class="hideonsmartphone"') . ' '; print 'id . '">' . $langs->trans("TransferStock") . ''; // Disabled, because edition of stock content must use the "Correct stock menu". // Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ... //print 'id.'#'.$pdluo->id.'">'; //print img_edit().''; + print ''; print $product_lot_static->getNomUrl(1); print '' . dol_print_date($pdluo->eatby, 'day') . '' . dol_print_date($pdluo->sellby, 'day') . '' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '' . dol_print_date($pdluo->eatby, 'day') . '' . dol_print_date($pdluo->sellby, 'day') . '' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '
' . $langs->trans("Total") . ':' . price2num($total, 'MS') . ''; + print '
' . $langs->trans("Total") . ':' . price2num($total, 'MS') . ''; print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : ' '); // This value may have rounding errors print ''; + print ''; print $totalvalue ? price(price2num($totalvalue, 'MT'), 1) : ' '; print ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print ($total ? price($totalvaluesell / $total, 1) : ' '); else print $langs->trans("Variable"); print ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalvaluesell, 'MT'), 1); else print $langs->trans("Variable"); print '
'; if (!empty($user->rights->produit->creer)) { print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; } else { print ''; - print ''; - print ''; + print ''; + print ''; print ''; } @@ -979,10 +980,10 @@ if (! $variants) { $ent = new Entrepot($db); $ent->fetch($line['fk_entrepot']); print ''; - print ''; - print ''; + print ''; + print ''; if (!empty($user->rights->produit->creer)) { - print ''; + print ''; } print ''; } @@ -1064,8 +1065,8 @@ if (! $variants) { } print ''; - print ''; - print ''; + print ''; + print ''; print ''; } else diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 54243e3c853..7105470032c 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -1,6 +1,7 @@ - * Copyright (C) 2018 Ferran Marcet +/* Copyright (C) 2007-2016 Laurent Destailleur + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,10 +18,10 @@ */ /** - * \file product/stock/productlot_list.php - * \ingroup stock - * \brief This file is an example of a php page - * Initialy built by build_class_from_table on 2016-05-17 12:22 + * \file product/stock/productlot_list.php + * \ingroup stock + * \brief This file is an example of a php page + * Initialy built by build_class_from_table on 2016-05-17 12:22 */ require '../../main.inc.php'; @@ -34,10 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $langs->loadLangs(array('stocks', 'productbatch', 'other', 'users')); // Get parameters -$id = GETPOST('id', 'int'); -$action = GETPOST('action', 'alpha'); +$id = GETPOST('id', 'int'); +$action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$myparam = GETPOST('myparam', 'alpha'); +$myparam = GETPOST('myparam', 'alpha'); $toselect = GETPOST('toselect', 'array'); @@ -362,12 +363,12 @@ if ($resql) /*if (! empty($arrayfields['u.statut']['checked'])) { // Status - print ''; }*/ // Action column - print ''; @@ -389,11 +390,17 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($arrayfields['t.status']['label'],$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); - print ''."\n"; + if (! empty($arrayfields['t.datec']['checked'])) { + print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + if (! empty($arrayfields['t.tms']['checked'])) { + print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + } + //if (! empty($arrayfields['t.status']['checked'])) { + // print_liste_field_titre($arrayfields['t.status']['label'], $_SERVER["PHP_SELF"], "t.status", "", $param, '', $sortfield, $sortorder, 'center '); + //} + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print ''."\n"; $productlot = new Productlot($db); @@ -464,7 +471,7 @@ if ($resql) // Date creation if (! empty($arrayfields['t.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -472,7 +479,7 @@ if ($resql) // Date modification if (! empty($arrayfields['t.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -482,11 +489,11 @@ if ($resql) if (! empty($arrayfields['u.statut']['checked'])) { $userstatic->statut=$obj->statut; - print ''; + print ''; }*/ // Action column - print ''; else print ''; } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 829df2a076a..7bd080b15bf 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -4,6 +4,7 @@ * Copyright (C) 2014 Regis Houssin * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2016 ATM Consulting + * Copyright (C) 2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -534,11 +535,11 @@ print ''; if (!empty($conf->service->enabled) && $type == 1) print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; -print ''; @@ -549,13 +550,13 @@ print ''; print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); -if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre('Duration', $_SERVER["PHP_SELF"], 'p.duration', $param, '', 'align="center"', $sortfield, $sortorder); -print_liste_field_titre('DesiredStock', $_SERVER["PHP_SELF"], 'p.desiredstock', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre('StockLimitShort', $_SERVER["PHP_SELF"], 'p.seuil_stock_alerte', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], 'stock_physique', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre('Ordered', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); +if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre('Duration', $_SERVER["PHP_SELF"], 'p.duration', $param, '', '', $sortfield, $sortorder, 'center '); +print_liste_field_titre('DesiredStock', $_SERVER["PHP_SELF"], 'p.desiredstock', $param, '', '', $sortfield, $sortorder, 'right '); +print_liste_field_titre('StockLimitShort', $_SERVER["PHP_SELF"], 'p.seuil_stock_alerte', $param, '', '', $sortfield, $sortorder, 'right '); +print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], 'stock_physique', $param, '', '', $sortfield, $sortorder, 'right '); +print_liste_field_titre('Ordered', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); +print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); +print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); print "\n"; while ($i < ($limit ? min($num, $limit) : $num)) @@ -660,27 +661,27 @@ while ($i < ($limit ? min($num, $limit) : $num)) } else { $duration = $objp->duration; } - print ''; + print ''; } // Desired stock - print ''; + print ''; // Limit stock for alert - print ''; + print ''; // Current stock (all warehouses) - print ''; + print ''; // Already ordered - print ''; + print ''; // To order - //print ''; - print ''; + //print ''; + print ''; // Supplier - print ''; + print ''; print ''; } diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 40119d91c65..617d40b5232 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -2,7 +2,7 @@ /* * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Regis Houssin - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -198,7 +198,7 @@ if ($resql) ''. - ''; @@ -261,9 +261,10 @@ if ($resql) 'cf.fk_statut', '', $param, - 'align="right"', + '', $sortfield, - $sortorder + $sortorder, + 'right ' ); print ''; @@ -277,13 +278,12 @@ if ($resql) if ($showline) { - $href = DOL_URL_ROOT . '/fourn/commande/card.php?id=' . $obj->rowid; - print ''. + $href = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$obj->rowid; + print ''; // Ref - ''; + print ''; // Company $href = DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid; @@ -300,13 +300,9 @@ if ($resql) } else { $txt = ' '; } - print ''. + print ''; // Amount - ''; + print ''; // Date if ($obj->dc) { @@ -314,14 +310,10 @@ if ($resql) } else { $date = '-'; } - print ''. + print ''; // Statut - ''. - ''; + print ''; + print ''; } $i++; } @@ -334,7 +326,7 @@ if ($resql) } else { - dol_print_error($db); + dol_print_error($db); } // End of page diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 1bc9ffbb018..6bfdb67f068 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -87,9 +87,9 @@ if ($result) print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", "", "", $sortfield, $sortorder); print_liste_field_titre("LocationSummary", $_SERVER["PHP_SELF"], "e.lieu", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "e.valo_pmp", '', '', 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', '', 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "e.valo_pmp", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', '', '', $sortfield, $sortorder, 'right '); print "\n"; if ($num) @@ -104,17 +104,17 @@ if ($result) print ''; print ''; // PMP value - print ''; // Selling value - print ''; // Status - print ''; + print ''; print "\n"; $total += price2num($objp->estimatedvalue, 'MU'); $totalsell += price2num($objp->sellvalue, 'MU'); @@ -123,10 +123,10 @@ if ($result) } print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 4c2d03b796e..6f5a63129de 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -127,7 +127,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print '
' . $formproduct->selectWarehouses('', 'fk_entrepot') . '
' . $langs->trans("Warehouse") . '' . $langs->trans("StockLimit") . '' . $langs->trans("DesiredStock") . '' . $langs->trans("StockLimit") . '' . $langs->trans("DesiredStock") . '
' . $ent->getNomUrl(3) . '' . $line['seuil_stock_alerte'] . '' . $line['desiredstock'] . '' . $line['seuil_stock_alerte'] . '' . $line['desiredstock'] . '' . img_delete() . '' . img_delete() . '
'.$langs->trans("Total").''.$stock_total.''.$langs->trans("Total").''.$stock_total.'
'; + print ''; print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '
'; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$userstatic->getLibStatut(3).''.$userstatic->getLibStatut(3).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -514,9 +521,9 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
   ' . $langs->trans('AlertOnly') . ' ' . $langs->trans('IncludeAlsoDraftOrders') . '  ' . $langs->trans('AlertOnly') . ' ' . $langs->trans('IncludeAlsoDraftOrders') . '  '; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$duration.''.$duration.'' . $desiredstock . '' . $desiredstock . '' . $alertstock . '' . $alertstock . ''. $warning . $stock. ''. $warning . $stock. ''. $ordered . ' ' . $picto. ''. $ordered . ' ' . $picto. ''. $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier).''. $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier).'
'. $form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, ''). ''; + ''; $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'. - ''. - img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref. - ''; + print ''.img_object($langs->trans('ShowOrder'), 'order').' '.$obj->ref.''; + print ''. - $txt. - ''.$txt.''. - price($obj->total_ttc). - ''.price($obj->total_ttc).''. - $date. - ''.$date.''. - $commandestatic->LibStatut($obj->fk_statut, 5). - '
'.$commandestatic->LibStatut($obj->fk_statut, 5).'
'.img_object($langs->trans("ShowWarehouse"), 'stock').' '.$objp->ref.''.$objp->lieu.''; + print ''; if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); else print ''; print ''; + print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); else print $langs->trans("Variable"); print ''.$entrepot->LibStatut($objp->statut, 5).''.$entrepot->LibStatut($objp->statut, 5).'
'.$langs->trans("Total").''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''.price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("Total").''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).''.price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).' 
'; print ''; print ''; -print ''; +print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -157,7 +157,7 @@ if ( $resql ) $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -170,7 +170,7 @@ else } print ''; print ''; -print ''; +print ''; print "\n"; print "
'.$langs->trans('ActivityOnProjectToday').''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; @@ -182,7 +182,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -212,7 +212,7 @@ if ( $resql ) $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -225,7 +225,7 @@ else } print ''; print ''; -print ''; +print ''; print "\n"; print "
'.$langs->trans('ActivityOnProjectYesterday').''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; @@ -240,7 +240,7 @@ if ($db->type != 'pgsql') print ''; print ''; print ''; - print ''; + print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -270,7 +270,7 @@ if ($db->type != 'pgsql') $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -283,7 +283,7 @@ if ($db->type != 'pgsql') } print ''; print ''; - print ''; + print ''; print "\n"; print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'

"; @@ -296,7 +296,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) print ''; print ''; print ''; - print ''; + print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -323,7 +323,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; } $db->free($resql); @@ -334,7 +334,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) } print ''; print ''; - print ''; + print ''; print "\n"; print "
'.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($now, "%B %Y").''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; } @@ -345,7 +345,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) print '
'; print ''; print ''; - print ''; + print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -373,7 +373,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; } $db->free($resql); @@ -384,7 +384,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) } print ''; print ''; - print ''; + print ''; print "\n"; print "
'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; } @@ -467,12 +467,12 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S print '
'.$langs->trans('OpenedProjects').''.$langs->trans('OpportunityStatus').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; - print ''.$langs->trans("ProgressDeclared").''; + print ''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; + print ''.$langs->trans("ProgressDeclared").''; print '
'.dol_print_date($db->jdate($obj->dateo), 'day').''.dol_print_date($db->jdate($obj->datee), 'day'); + print ''.dol_print_date($db->jdate($obj->dateo), 'day').''.dol_print_date($db->jdate($obj->datee), 'day'); print dol_print_date($obj->date_end, 'dayhour'); if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); print ''; + print ''; print convertSecondToTime($obj->planned_workload, 'allhourmin'); print ''; + print ''; print convertSecondToTime($obj->timespent, 'allhourmin'); print ''; + print ''; if (! empty($obj->taskid)) { if (empty($obj->planned_workload) > 0) { @@ -544,7 +544,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S } print $percentcompletion; print ''; + print ''; print ($obj->taskid>0)?$obj->progress.'%':''; print '
'; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$langs->trans("Project").''.$langs->trans("ThirdParty").''.$langs->trans("Task").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.$usertoprocess->firstname.')':'').'
'.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.$usertoprocess->firstname.')':'').'
'.$langs->trans("HourStart").'
'; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print '"; print ''; @@ -327,12 +327,12 @@ print ''; print ''; print ''; -print '"; print ''; @@ -354,8 +354,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -455,8 +455,8 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; clearstatcache(); @@ -499,7 +499,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) else print $tmp; print ''."\n"; - print ''; @@ -583,10 +583,10 @@ print "
".$langs->trans("Parameters")."'.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("ManageOpportunitiesStatus").''; +print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"), ); print $form->selectyesno('PROJECT_USE_OPPORTUNITIES', $conf->global->PROJECT_USE_OPPORTUNITIES, 1); -print ''; +print ''; print ''; print "
'.$langs->trans("ManageTasks").''; +print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"), ); print $form->selectyesno('PROJECT_USE_TASKS', empty($conf->global->PROJECT_HIDE_TASKS)?1:0, 1); -print ''; +print ''; print ''; print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->PROJECT_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -429,7 +429,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -530,7 +530,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
\n"; print "\n"; print ' \n"; print " \n"; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -637,7 +637,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ""; } // Default - print "'; // Preview - print '\n"; print ' \n"; print " \n"; - print '\n"; - print '\n"; - print ''; - print ''; + print '\n"; + print '\n"; + print ''; + print ''; print "\n"; clearstatcache(); @@ -794,7 +794,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) // Active if (in_array($name, $def)) { - print ""; } // Defaut - print "'; // Preview - print ''; // Date - print ''; + print ''; if (in_array($tablename, array('projet_task'))) print $langs->trans("TimeSpent"); if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date"); print ''; @@ -799,17 +799,17 @@ foreach ($listofreferent as $key => $value) else print $langs->trans("ThirdParty"); print ''; // Amount HT - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; + //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; + if (empty($value['disableamount'])) print ''; else print ''; // Amount TTC - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; + if (empty($value['disableamount'])) print ''; else print ''; // Status - if (in_array($tablename, array('projet_task'))) print ''; - else print ''; + if (in_array($tablename, array('projet_task'))) print ''; + else print ''; print ''; $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field)?$project_field:'fk_projet'); @@ -888,7 +888,7 @@ foreach ($listofreferent as $key => $value) print "\n"; // Ref - print ''; // Status - print ''; - $breakline.=''; - $breakline.=''; + $breakline.=''; + $breakline.=''; $breakline.=''; $breakline.=''; } @@ -1146,23 +1146,23 @@ foreach ($listofreferent as $key => $value) print ''; if (in_array($tablename, array('projet_task'))) { - print ''; print ''; } - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - print ''; + //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; + print ''; - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - print ''; + //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; + print '"; } diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 95b766ea405..618170607bd 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -70,13 +70,13 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ''; print ''; - print ''; + print ''; print "\n"; } } if ($conf->use_javascript_ajax) { - print ''; } //if ($totalinprocess != $total) - //print ''; - print ''; + //print ''; + print ''; print ''; + print ''; print "
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -645,13 +645,13 @@ foreach ($dirmodels as $reldir) } else { - print "\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ""; if ($conf->global->PROJECT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -672,12 +672,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -740,10 +740,10 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print "
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -802,13 +802,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } else { - print "\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ""; if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -829,12 +829,12 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -870,27 +870,27 @@ print ''; print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; if (! $conf->use_javascript_ajax) { - print '"; } else { - print '"; } @@ -899,7 +899,7 @@ print ''; print ''; print ''; -print ''; } @@ -1003,7 +1003,7 @@ elseif ($object->id > 0) // Categories if($conf->categorie->enabled) { - print '"; } @@ -1021,7 +1021,7 @@ elseif ($object->id > 0) if ($action == 'edit' && $userWrite > 0) { - print '
'; + print '
'; print '     '; print ''; print '
'; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 82f8c9ba169..a8bfb5939ed 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -238,7 +238,7 @@ class Task extends CommonObject $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.ref,"; - $sql.= " t.fk_projet,"; + $sql.= " t.fk_projet as fk_project,"; $sql.= " t.fk_task_parent,"; $sql.= " t.label,"; $sql.= " t.description,"; @@ -281,7 +281,7 @@ class Task extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->fk_task_parent = $obj->fk_task_parent; $this->label = $obj->label; $this->description = $obj->description; diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 580107c66f9..5ee207033cf 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -159,7 +159,7 @@ print ''; // Categories if ($conf->categorie->enabled) { - print '
"; } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index a5372a7426e..95d5e3dd229 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -250,7 +250,7 @@ if ($id > 0 || ! empty($ref)) // Categories if ($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index d9d1ac4a603..9b393f8a1bf 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -227,7 +227,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_B // Categories if($conf->categorie->enabled) { - print '"; } @@ -563,10 +563,10 @@ print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy'); print '
".$langs->trans("Parameters")."'.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("UseSearchToSelectProject").''; + print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; + print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); print $form->selectarray("activate_PROJECT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->PROJECT_USE_SEARCH_TO_SELECT); - print ''; + print ''; print ''; print "
'.$langs->trans("AllowToSelectProjectFromOtherCompany").''; +print ''; print ' '; print $form->textwithpicto('', $langs->trans('AllowToLinkFromOtherCompany')); print ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 2e42ce18095..8089b66680d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -556,7 +556,7 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1); } else print $text; - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
' . $langs->trans("Categories") . ''; + print '
' . $langs->trans("Categories") . ''; print $form->showCategories($object->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
'; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print ''; foreach ($listofreferent as $key => $value) @@ -676,14 +676,14 @@ foreach ($listofreferent as $key => $value) // Module print ''; // Nb - print ''; + print ''; // Amount HT - print ''; // Amount TTC - print ''; @@ -693,9 +693,9 @@ foreach ($listofreferent as $key => $value) } // and the final balance print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "
'.$langs->trans("Element").''.$langs->trans("Number").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Element").''.$langs->trans("Number").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$name.''.$i.''.$i.''; + print ''; if (! $qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; else print price($total_ht); print ''; + print ''; if (! $qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; else print price($total_ttc); print '
'.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).''.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).'
"; @@ -787,7 +787,7 @@ foreach ($listofreferent as $key => $value) // Ref print ''.$langs->trans("Ref").'
'.$langs->trans("AmountHT").''.$langs->trans("Amount").''.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("Amount").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("AmountTTC").''.$langs->trans("AmountTTC").''.$langs->trans("AmountTTC").''.$langs->trans("ProgressDeclared").''.$langs->trans("Status").''.$langs->trans("ProgressDeclared").''.$langs->trans("Status").'
'; + print ''; if ($tablename == 'expensereport_det') { print $expensereport->getNomUrl(1); @@ -950,7 +950,7 @@ foreach ($listofreferent as $key => $value) if (empty($date)) $date=$element->datev; } } - print ''; + print ''; if ($tablename == 'actioncomm') { print dol_print_date($element->datep, 'dayhour'); @@ -1027,7 +1027,7 @@ foreach ($listofreferent as $key => $value) { $total_ht_by_line=$element->total_ht; } - print ''; + print ''; if ($othermessage) print $othermessage; if (isset($total_ht_by_line)) { @@ -1064,7 +1064,7 @@ foreach ($listofreferent as $key => $value) { $total_ttc_by_line=$element->total_ttc; } - print ''; + print ''; if ($othermessage) print $othermessage; if (isset($total_ttc_by_line)) { @@ -1078,7 +1078,7 @@ foreach ($listofreferent as $key => $value) else print ''; + print ''; if ($tablename == 'expensereport_det') { print $expensereport->getLibStatut(5); @@ -1129,8 +1129,8 @@ foreach ($listofreferent as $key => $value) $breakline.=$langs->trans('SubTotal').' : '; if (is_object($element->thirdparty)) $breakline.=$element->thirdparty->getNomUrl(0, '', 48); $breakline.=''.price($total_ht_by_third).''.price($total_ttc_by_third).''.price($total_ht_by_third).''.price($total_ttc_by_third).'
'.$langs->trans("Number").': '.$i.''; + print ''; print convertSecondToTime($total_time, 'allhourmin'); print ''; print ''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''; if (empty($value['disableamount'])) { if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); } print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; if (empty($value['disableamount'])) { if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 083a3be46c0..d9a9cc37ed8 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -175,7 +175,7 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
'.$labelstatus.''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -92,12 +92,12 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'
'; //print $langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')'; print $form->textwithpicto($langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')', $langs->trans("OpportunityPonderatedAmountDesc"), 1); - print ''.price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency).'
'.price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency).'
"; print ""; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 14cbaf1da1d..a4389339e46 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -221,7 +221,7 @@ if ($resql) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -237,7 +237,7 @@ if ($resql) } print ''; print ''.dol_print_date($db->jdate($obj->datem), 'day').''; - print ''.$projectstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$projectstatic->LibStatut($obj->fk_statut, 5).''; print ''; $i++; } @@ -252,7 +252,7 @@ print '
'; print ''; print ''; print_liste_field_titre("OpenedProjectsByThirdparties", $_SERVER["PHP_SELF"], "s.nom", "", "", '', $sortfield, $sortorder); -print_liste_field_titre("NbOfProjects", "", "", "", "", 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("NbOfProjects", "", "", "", "", '', $sortfield, $sortorder, 'right '); print "\n"; $sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)"; @@ -289,7 +289,7 @@ if ( $resql ) print $langs->trans("OthersNotLinkedToThirdParty"); } print ''; - print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index dc4183bc6e0..06d41e8031f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -618,13 +618,13 @@ if (! empty($arrayfields['p.opp_percent']['checked'])) } if (! empty($arrayfields['p.budget_amount']['checked'])) { - print ''; } if (! empty($arrayfields['p.bill_time']['checked'])) { - print ''; } @@ -649,7 +649,7 @@ if (! empty($arrayfields['p.tms']['checked'])) } if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; } // Action column -print ''; @@ -670,24 +670,24 @@ if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['commercial']['checked'])) print_liste_field_titre($arrayfields['commercial']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'], $_SERVER["PHP_SELF"], "p.public", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, 'align="right"', $sortfield, $sortorder); -if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, 'align="right"', $sortfield, $sortorder); -if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, 'align="right"', $sortfield, $sortorder); -if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, 'align="right"', $sortfield, $sortorder); +if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $i=0; @@ -824,7 +824,7 @@ while ($i < min($num, $limit)) // Opp Amount if (! empty($arrayfields['p.opp_amount']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -846,7 +846,7 @@ while ($i < min($num, $limit)) // Budget if (! empty($arrayfields['p.budget_amount']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -884,7 +884,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['p.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -892,11 +892,11 @@ while ($i < min($num, $limit)) // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; else print ''; } - elseif ($totalarray['totaloppfield'] == $i) print ''; - elseif ($totalarray['totalbudgetfield'] == $i) print ''; + elseif ($totalarray['totaloppfield'] == $i) print ''; + elseif ($totalarray['totalbudgetfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 57e3648e208..e7e06e93352 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -297,7 +297,7 @@ if (! in_array($nowyear, $arrayyears)) $arrayyears[$nowyear]=$nowyear; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; -print ''; +print ''; print '
'; + print ''; if ($obj->socid) print ''.$obj->nb.''; else print ''.$obj->nb.''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $arrayofstatus = array(); foreach($object->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').' + '.$langs->trans('Opened').')'; @@ -658,7 +658,7 @@ if (! empty($arrayfields['p.fk_statut']['checked'])) print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; //if ($obj->opp_status_code) if (strcmp($obj->opp_amount, '')) { @@ -838,7 +838,7 @@ while ($i < min($num, $limit)) // Opp percent if (! empty($arrayfields['p.opp_percent']['checked'])) { - print ''; + print ''; if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%'; print ''; + print ''; if ($obj->budget_amount != '') { print price($obj->budget_amount, 1, $langs, 1, -1, -1); @@ -859,7 +859,7 @@ while ($i < min($num, $limit)) // Bill time if (! empty($arrayfields['p.bill_time']['checked'])) { - print ''; + print ''; if ($obj->bill_time) { print yn($obj->bill_time); @@ -876,7 +876,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['p.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$object->getLibStatut(5).''.$object->getLibStatut(5).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -925,8 +925,8 @@ if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield'] if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).''.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).''.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).''.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).'
'; print ''; print '

'; @@ -305,13 +305,13 @@ print '

'; print '
'; print ''; print ''; -print ''; -print ''; +print ''; +print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } print ''; @@ -324,25 +324,25 @@ foreach ($data_all_year as $val) $oldyear--; print ''; - print ''; + print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - print ''; + print ''; print ''; } print ''; - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } print ''; $oldyear=$year; @@ -353,7 +353,7 @@ print ''; print '
'; -$stringtoshow.= '
'.$langs->trans("Year").''.$langs->trans("NbOfProjects").''.$langs->trans("Year").''.$langs->trans("NbOfProjects").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityAmountAverageShort").''.$langs->trans("OpportunityAmountWeigthedShort").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityAmountAverageShort").''.$langs->trans("OpportunityAmountWeigthedShort").'
0?'&userid='.$userid:'').'">'.$oldyear.'0?'&userid='.$userid:'').'">'.$oldyear.'00000000
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].'0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.($val['total']?price(price2num($val['total'], 'MT'), 1):'0').''.($val['avg']?price(price2num($val['avg'], 'MT'), 1):'0').''.($val['weighted']?price(price2num($val['weighted'], 'MT'), 1):'0').''.($val['total']?price(price2num($val['total'], 'MT'), 1):'0').''.($val['avg']?price(price2num($val['avg'], 'MT'), 1):'0').''.($val['weighted']?price(price2num($val['weighted'], 'MT'), 1):'0').'
'; - if ($action != 'editshipping_method_id') print ''; + if ($action != 'editshipping_method_id') print ''; print '
'; +$stringtoshow.= ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; // Action column - print ''; @@ -712,14 +712,14 @@ elseif ($id > 0 || ! empty($ref)) // print ''; print_liste_field_titre("RefTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); print_liste_field_titre("LabelTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, ''); - print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, ''); - print_liste_field_titre("PlannedWorkload", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'align="center" width="80"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("PlannedWorkload", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; if (count($tasksarray) > 0) diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index a817f1df4f0..679f6a29dc2 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -191,7 +191,7 @@ if ($id > 0 || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index ab1806ea461..af8dc9d39cf 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -263,7 +263,7 @@ if ($id > 0 || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '"; } @@ -380,7 +380,7 @@ if ($id > 0 || ! empty($ref)) print ''; - print ''; + print ''; print ''; print ''; @@ -415,7 +415,7 @@ if ($id > 0 || ! empty($ref)) print ''; - print ''; print ''; @@ -430,7 +430,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -493,7 +493,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Statut - print ''; // Icon update et delete - print '"; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index be44923ea8b..066aebdde6a 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -565,7 +565,7 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; } // Action column -print ''; @@ -574,25 +574,25 @@ print "\n"; print ''; if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="center"'); -if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); +if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -625,7 +625,7 @@ while ($i < min($num, $limit)) $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { - print ''; + print ''; // Ref if (! empty($arrayfields['t.ref']['checked'])) @@ -697,7 +697,7 @@ while ($i < min($num, $limit)) // Project status if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -770,7 +770,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['t.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -778,7 +778,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['t.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -787,10 +787,10 @@ while ($i < min($num, $limit)) /*if (! empty($arrayfields['p.fk_statut']['checked'])) { $projectstatic->statut = $obj->fk_statut; - print ''; + print ''; }*/ // Action column - print ''; else print ''; } - elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; - elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; - elseif ($totalarray['totalprogress_calculated'] == $i) print ''; + elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; + elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; + elseif ($totalarray['totalprogress_calculated'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index a0c3b517769..02925f1092f 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -186,7 +186,7 @@ if ($object->id > 0) // Categories if($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8472c4d54ce..b3c3e151af8 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -302,7 +302,7 @@ if ($id > 0 || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '"; } @@ -428,7 +428,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); - print '
'; + print '
'; print '   '; print ''; print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 1258027d615..37934aa0957 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -539,7 +539,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Categories if ($conf->categorie->enabled) { - print '
"; } @@ -758,7 +758,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); print ''; - print ''; } - print '\n"; $tasktmp = new Task($db); @@ -1296,7 +1296,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { - print ''; @@ -1327,7 +1327,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Invoiced - Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; @@ -1538,7 +1538,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; @@ -1661,7 +1661,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { - print ''; @@ -1686,7 +1686,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; @@ -1725,9 +1725,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($num < $limit && empty($offset)) print ''; else print ''; } - elseif ($totalarray['totaldurationfield'] == $i) print ''; - elseif ($totalarray['totalvaluefield'] == $i) print ''; - //elseif ($totalarray['totalvaluebilledfield'] == $i) print ''; + elseif ($totalarray['totaldurationfield'] == $i) print ''; + elseif ($totalarray['totalvaluefield'] == $i) print ''; + //elseif ($totalarray['totalvaluebilledfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 6166aae1e8a..8f4d1de13f4 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -838,6 +838,7 @@ if ($source == 'order') // Debitor print ''."\n"; // Object $text=''.$langs->trans("PaymentOrderRef", $order->ref).''; @@ -958,6 +959,7 @@ if ($source == 'invoice') // Debitor print ''."\n"; // Object $text=''.$langs->trans("PaymentInvoiceRef", $invoice->ref).''; @@ -1009,15 +1011,6 @@ if ($source == 'invoice') print ''; print ''."\n"; - // Add download link - if ($download > 0) - { - print ''."\n"; - } - // Shipping address $shipToName=$invoice->thirdparty->name; $shipToStreet=$invoice->thirdparty->address; @@ -1295,22 +1288,20 @@ if ($source == 'membersubscription') $fulltag=dol_string_unaccent($fulltag); // Creditor - print ''."\n"; // Debitor - print ''."\n"; // Object - $text=''.$langs->trans("PaymentSubscription").''; if (GETPOST('desc', 'alpha')) $text=''.$langs->trans(GETPOST('desc', 'alpha')).''; print ''."\n"; // Tag - print ''."\n"; // Debitor - print ''."\n"; // Object - $text=''.$langs->trans("PaymentDonation").''; if (GETPOST('desc', 'alpha')) $text=''.$langs->trans(GETPOST('desc', 'alpha')).''; print ''."\n"; // Amount - print ''."\n"; // Tag - print ''; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index a24f85cecad..c2400abea1d 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -805,7 +805,7 @@ if ($action == 'create') print ''; print ''; print ''; } @@ -989,9 +989,9 @@ if ($action == 'create') { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
'; if ($mesg) { print $mesg; } else { $stringtoshow.= $px1->show(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index e7b99993ef1..068a26b5fe2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -554,7 +554,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -671,38 +671,38 @@ elseif ($id > 0 || ! empty($ref)) print ''; print '
'; + print ''; print ''; print ''; $formother->select_year($search_dtstartyear?$search_dtstartyear:-1, 'search_dtstartyear', 1, 20, 5); print ''; + print ''; print ''; print ''; $formother->select_year($search_dtendyear?$search_dtendyear:-1, 'search_dtendyear', 1, 20, 5); print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''.$langs->trans("Project").'
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'; $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid'); print '
'; $formcompany->selectTypeContact($object, '', 'type', 'external', 'rowid'); print '
'.$langs->trans("ThirdParty").''.$langs->trans("TaskContact").''.$langs->trans("ContactType").''.$langs->trans("Status").''.$langs->trans("Status").' 
'.$tab[$i]['libelle'].''; + print ''; // Activation desativation du contact if ($object->statut >= 0) print ''; print $contactstatic->LibStatut($tab[$i]['status'], 3); @@ -501,7 +501,7 @@ if ($id > 0 || ! empty($ref)) print ''; + print ''; if ($user->rights->projet->creer) { print ' '; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index d9832dbf1a9..49bf3d02ad8 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -206,7 +206,7 @@ if ($object->id > 0) // Categories if($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; print $projectstatic->getLibStatut(1); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$projectstatic->getLibStatut(5).''.$projectstatic->getLibStatut(5).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -821,9 +821,9 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').'
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'; + print ''; print ''; print '   '; print ''; @@ -1079,7 +1079,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; + print ''; print ''; print '   '; print ''; @@ -1162,9 +1162,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } if (! empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'], $_SERVER['PHP_SELF'], 't.task_duration', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'], $_SERVER['PHP_SELF'], 't.task_duration', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center '); /* // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1173,7 +1173,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center" width="80"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -1315,7 +1315,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value spent if (! empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; // invoice_id and invoice_line_id + print ''; // invoice_id and invoice_line_id if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { if ($projectstatic->bill_time) @@ -1513,7 +1513,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { - print ''; + print ''; if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -1529,7 +1529,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value spent if (! empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; + print ''; $valuebilled = price2num($task_time->total_ht); if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); print ''; + print ''; if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -1677,7 +1677,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value spent if (! empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = 0; print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; + print ''; $valuebilled = price2num($task_time->total_ht); if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''.price($totalarray['totalvalue']).''.price($totalarray['totalvaluebilled']).''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''.price($totalarray['totalvalue']).''.price($totalarray['totalvaluebilled']).'
'.$langs->trans("ThirdParty"); print ''.$order->thirdparty->name.''; + print '
'.$langs->trans("ThirdParty"); print ''.$invoice->thirdparty->name.''; + print '
'.$langs->trans("Document"); - print ''; - print $invoice->getDirectExternalLink(1); - print '
'.$langs->trans("Creditor"); print ''.$creditor.''; print ''; print '
'.$langs->trans("Member"); print ''; if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; else print $member->getFullName($langs); print ''; + print '
'.$langs->trans("Designation"); @@ -1343,7 +1334,6 @@ if ($source == 'membersubscription') } // Amount - print '
'.$langs->trans("Amount"); if (empty($amount)) { @@ -1391,7 +1381,6 @@ if ($source == 'membersubscription') print '
'.$langs->trans("PaymentCode"); print ''.$fulltag.''; print ''; @@ -1463,22 +1452,20 @@ if ($source == 'donation') $fulltag=dol_string_unaccent($fulltag); // Creditor - print '
'.$langs->trans("Creditor"); print ''.$creditor.''; print ''; print '
'.$langs->trans("ThirdParty"); print ''; if ($don->morphy == 'mor' && ! empty($don->societe)) print $don->societe; else print $don->getFullName($langs); print ''; + print '
'.$langs->trans("Designation"); @@ -1488,7 +1475,6 @@ if ($source == 'donation') print '
'.$langs->trans("Amount"); if (empty($amount)) { @@ -1536,7 +1522,6 @@ if ($source == 'donation') print '
'.$langs->trans("PaymentCode"); print ''.$fulltag.''; print ''; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 1661807d634..f34c88ad5ce 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -471,7 +471,7 @@ if ($action == "view_ticketlist") if (!empty($arrayfields['category.code']['checked'])) { print ''; - $formTicket->selectAnalyticCodesTickets($search_category, 'search_category', '', 2, 1, 1); + $formTicket->selectGroupTickets($search_category, 'search_category', '', 2, 1, 1); print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
'.$langs->trans("Description").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyReceived").''.$langs->trans("QtyToReceive"); + print ''.$langs->trans("QtyOrdered").''.$langs->trans("QtyReceived").''.$langs->trans("QtyToReceive"); if (empty($conf->productbatch->enabled)) { print '
('.$langs->trans("Fill").''; @@ -1085,7 +1085,7 @@ if ($action == 'create') } // Qty - print '
'.$line->qty; + print ''.$line->qty; print 'id.'\' />'; print ''; print ''; @@ -1093,7 +1093,7 @@ if ($action == 'create') $qtyProdCom=$line->qty; // Qty already received - print ''; + print ''; $quantityDelivered = $object->receptions[$line->id]; @@ -1124,7 +1124,7 @@ if ($action == 'create') // Quantity to send - print ''; + print ''; if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty=GETPOST('qtyl'.$indiceAsked, 'int'); @@ -1416,7 +1416,7 @@ elseif ($id || $ref) print $langs->trans('DateDeliveryPlanned'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print '
'; if ($action == 'editdate_livraison') @@ -1556,7 +1556,7 @@ elseif ($id || $ref) print $langs->trans('ReceptionMethod'); print 'id.'">'.img_edit($langs->trans('SetReceptionMethod'), 1).'id.'">'.img_edit($langs->trans('SetReceptionMethod'), 1).'
'; print ''; if ($action == 'editshipping_method_id') @@ -1594,7 +1594,7 @@ elseif ($id || $ref) print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->reception->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -1637,24 +1637,24 @@ elseif ($id || $ref) // # if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ' '; + print ' '; } // Product/Service print ''.$langs->trans("Products").''; // Comment print ''.$langs->trans("Description").''; // Qty - print ''.$langs->trans("QtyOrdered").''; + print ''.$langs->trans("QtyOrdered").''; if ($origin && $origin_id > 0) { - print ''.$langs->trans("QtyInOtherReceptions").''; + print ''.$langs->trans("QtyInOtherReceptions").''; } if ($action == 'editline') { $editColspan = 3; if (empty($conf->stock->enabled)) $editColspan--; if (empty($conf->productbatch->enabled)) $editColspan--; - print ''; + print ''; if ($object->statut <= 1) { print $langs->trans("QtyToReceive").' - '; @@ -1677,11 +1677,11 @@ elseif ($id || $ref) { if ($object->statut <= 1) { - print ''.$langs->trans("QtyToReceive").''; + print ''.$langs->trans("QtyToReceive").''; } else { - print ''.$langs->trans("QtyReceived").''; + print ''.$langs->trans("QtyReceived").''; } if (! empty($conf->stock->enabled)) { @@ -1693,9 +1693,9 @@ elseif ($id || $ref) print ''.$langs->trans("Batch").''; } } - print ''.$langs->trans("CalculatedWeight").''; - print ''.$langs->trans("CalculatedVolume").''; - //print ''.$langs->trans("Size").''; + print ''.$langs->trans("CalculatedWeight").''; + print ''.$langs->trans("CalculatedVolume").''; + //print ''.$langs->trans("Size").''; if ($object->statut == 0) { print ''; @@ -1775,7 +1775,7 @@ elseif ($id || $ref) // # if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''.($i+1).''; + print ''.($i+1).''; } // Predefined product or service @@ -1834,12 +1834,12 @@ elseif ($id || $ref) // Qty ordered - print ''.$lines[$i]->qty_asked.''; + print ''.$lines[$i]->qty_asked.''; // Qty in other receptions (with reception and warehouse used) if ($origin && $origin_id > 0) { - print ''; + print ''; foreach ($alreadysent as $key => $val) { if ($lines[$i]->fk_commandefourndet == $key) @@ -1871,7 +1871,7 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { // edit mode - print ''; + print '\n"; print "\n"; @@ -149,9 +149,9 @@ if (!$rowid) } print ''; - + if (!empty($stripeacc)) $connect=$stripeacc.'/'; - + // Ref $url='https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; if ($servicestatus) @@ -169,7 +169,7 @@ if (!$rowid) $url='https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; } print ''.img_picto($langs->trans('ShowInStripe'), 'object_globe').' '.$charge->customer.''; - + print "\n"; // Link print "\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Amount - print ""; + print '"; // Status - print ''; @@ -114,7 +114,7 @@ class ActionsStripeconnect $this->resprints.= ''; $this->resprints.= ''; $this->resprints.= ''; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 8cc5b0218b1..fa881a834ea 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -243,13 +243,13 @@ class Stripe extends CommonObject /** * Get the Stripe payment intent * - * @param Societe $object Object tp pay on Stripe - * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() - * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect - * @param int $status Status (0=test, 1=live) - * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt - * @param int $mode automatic=automatic payment, manual=need confirmation - * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found + * @param Societe $object Object to pay with Stripe + * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() + * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int $status Status (0=test, 1=live) + * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt + * @param int $mode automatic=automatic payment, manual=need confirmation + * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found */ public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic') { @@ -284,7 +284,7 @@ class Stripe extends CommonObject $obj = $this->db->fetch_object($resql); $intent = $obj->ext_payment_id; - dol_syslog(get_class($this) . "::customerStripe found stripe customer key_account = ".$tiers); + dol_syslog(get_class($this) . "::customerStripe found record"); // Force to use the correct API key global $stripearrayofkeysbyenv; @@ -308,8 +308,11 @@ class Stripe extends CommonObject if (! in_array($object->multicurrency_code, $arrayzerounitcurrency)) $stripeamount=$object->multicurrency_total_ttc * 100; else $stripeamount = $object->multicurrency_total_ttc; - $fee = round(($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); - if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { + $fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); + if ($fee >= ($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL * 100) && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL>$conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { + $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL * 100); + } + elseif ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); } @@ -328,9 +331,9 @@ class Stripe extends CommonObject { $dataforintent["application_fee"] = $fee; } - if ($societe->email && $usethirdpartyemailforreceiptemail) + if ($usethirdpartyemailforreceiptemail && $object->thirdparty->email) { - $dataforintent["receipt_email"] = $societe->email; + $dataforintent["receipt_email"] = $object->thirdparty->email; } try { @@ -584,9 +587,11 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref")); } } else { - - $fee = round(($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); - if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { + $fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); + if ($fee >= ($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL * 100) && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL>$conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { + $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL * 100); + } + elseif ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); } diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index bf8802f4c89..cf2fa221e85 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -8,7 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -80,22 +80,29 @@ if ($facid > 0) if (! empty($conf->stripe->enabled)) { - $service = 'StripeTest'; - $servicestatus = 0; - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) - { - $service = 'StripeLive'; - $servicestatus = 0; - } - - $stripe=new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) + access_forbidden(); } +if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) +{ + $service = 'StripeTest'; + $servicestatus = '0'; + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); +} +else +{ + $service = 'StripeLive'; + $servicestatus = '1'; +} +$stripeacc = $stripe->getStripeAccount($service); +/*if (empty($stripeaccount)) +{ + print $langs->trans('ErrorStripeAccountNotDefined'); +}*/ + // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('paiementcard','globalcard')); - /* * Actions */ @@ -223,9 +230,9 @@ if (empty($reshook)) $action = 'create'; if (!$source) { setEventMessages($langs->transnoentities('NoSource'), null, 'errors'); - } - $error++; - } + } + $error++; + } // Le reste propre a cette action s'affiche en bas de page. } @@ -626,7 +633,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie foreach ($customerstripe->sources->data as $src) { print ''; - print ''; // Default - print ''; - print ''; // Default - print ''; if ($action != 'editdate_livraison' && ! empty($object->brouillon)) - print ''; + print ''; print '
'; if (! empty($conf->stock->enabled)) { if ($lines[$i]->fk_product > 0) @@ -1912,7 +1912,7 @@ elseif ($id || $ref) else { // Qty to receive or received - print ''; + print ''; // Warehouse source if (! empty($conf->stock->enabled)) @@ -1959,13 +1959,13 @@ elseif ($id || $ref) } // Weight - print ''; // Volume - print ''; @@ -1973,14 +1973,14 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { - print ''; print ''; - print ''; print ''; @@ -219,7 +219,7 @@ if ( $resql ) print ''; - print ''; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 5cb3a100e71..3340a192081 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -647,7 +647,7 @@ if ($resql) // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; } @@ -665,14 +665,14 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } @@ -735,19 +735,19 @@ if ($resql) // Status if (! empty($arrayfields['e.fk_statut']['checked'])) { - print ''; } // Status billed if (! empty($arrayfields['e.billed']['checked'])) { - print ''; } // Action column - print ''; @@ -756,15 +756,15 @@ if ($resql) print ''; if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['e.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, 'align="left"', $sortfield, $sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -775,7 +775,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($extralabels[$key], $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder); + print_liste_field_titre($extralabels[$key], $_SERVER["PHP_SELF"], $sortonfield, "", $param, '', $sortfield, $sortorder, ($align?'"'.$align.' "':'')); } } } @@ -783,11 +783,11 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $i=0; @@ -862,7 +862,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -871,7 +871,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -881,7 +881,7 @@ if ($resql) // Date delivery planed if (! empty($arrayfields['e.date_delivery']['checked'])) { - print ''."\n"; } @@ -920,10 +920,10 @@ if ($resql) { if (! empty($arrayfields["ef.".$key]['checked'])) { - print ''; @@ -938,7 +938,7 @@ if ($resql) // Date creation if (! empty($arrayfields['e.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -946,7 +946,7 @@ if ($resql) // Date modification if (! empty($arrayfields['e.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -954,18 +954,18 @@ if ($resql) // Status if (! empty($arrayfields['e.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Billed if (! empty($arrayfields['e.billed']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; - print ''; + print ''; print '
'.$lines[$i]->qty.''.$lines[$i]->qty.''; + print ''; if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->weight*$lines[$i]->qty.' '.measuring_units_string($lines[$i]->product->weight_units, "weight"); else print ' '; print ''; + print ''; if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->volume*$lines[$i]->qty.' '.measuring_units_string($lines[$i]->product->volume_units, "volume"); else print ' '; print ''; + print ''; print '
'; print '
'; } elseif ($object->statut == 0) { // edit-delete buttons - print '
'; + print ''; print 'id . '">' . img_edit() . ''; print ''; diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index 74cc86f26a5..3b0bb7a05e0 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -160,7 +160,7 @@ if ($resql) print ''; print $companystatic->getNomUrl(1, 'customer', 32); print ''; + print ''; print $orderstatic->getLibStatut(3); print '
'; print $companystatic->getNomUrl(1, 'customer'); print ''; + print ''; print $orderstatic->getLibStatut(3); print '
'; + print ''; print ''; print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusReceptionDraftShort'),'1'=>$langs->trans('StatusReceptionValidatedShort'),'2'=>$langs->trans('StatusReceptionProcessedShort')), $viewstatut, 1); print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; print dol_print_date($db->jdate($obj->date_livraison), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 ) @@ -907,7 +907,7 @@ if ($resql) if (! empty($arrayfields['l.date_delivery']['checked'])) { // Date received - print ''; + print ''; print dol_print_date($db->jdate($obj->date_reception), "day"); print ''; + if ($align) print ' '.$align; + print '">'; $tmpkey='options_'.$key; print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''.$reception->LibStatut($obj->fk_statut, 5).''.$reception->LibStatut($obj->fk_statut, 5).''.yn($obj->billed).''.yn($obj->billed).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index b4034588218..94e77c3c4b5 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -255,7 +255,7 @@ print '
'; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print '
'; print ''; print '

'; @@ -263,10 +263,10 @@ print '
'; print ''; print ''; -print ''; -print ''; -/*print ''; -print '';*/ +print ''; +print ''; +/*print ''; +print '';*/ print ''; $oldyear=0; @@ -279,22 +279,22 @@ foreach ($data as $val) print ''; - print ''; + print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; } print ''; - print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; $oldyear=$year; } @@ -306,7 +306,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("NbOfReceptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").''.$langs->trans("Year").''.$langs->trans("NbOfReceptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.''.$oldyear.'000000
'; + print ''; if ($year) print ''.$year.''; else print $langs->trans("ValidationDateNotDefinedEvenIfReceptionValidated"); print ''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -459,17 +459,17 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ""; print ""; - print '"; - print '"; - print '"; - print '"; - print ''; - print ''; + print '"; + print '"; + print '"; + print '"; + print ''; + print ''; // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); - print ''; } @@ -529,13 +529,13 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -545,7 +545,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; // Print the search button - print ''; @@ -564,24 +564,24 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ""; print ""; - print '"; - print '"; - print '"; - print '"; - print ''; - print ''; + print '"; + print '"; + print '"; + print '"; + print ''; + print ''; // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); - print ''; // Action if ($user->rights->produit->creer || $user->rights->service->creer) { - print '\n"; $i=0; @@ -305,7 +305,7 @@ if ($id > 0 || ! empty($ref)) // End of subscription date if ($datefin) { - print ''; @@ -414,7 +414,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; print ''."\n"; @@ -473,7 +473,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print '\n"; print ''; print ''; if (empty($conf->stripeconnect->enabled)) @@ -195,9 +186,14 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; } else { print ''; @@ -225,9 +221,14 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; } else @@ -272,22 +273,42 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? print ''; } -// Minimal amount for force 3Dsecure if it's optionnal +// Activate Payment Request API +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; +} + +// Activate SEPA DIRECT_DEBIT if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { print ''; + print $langs->trans("STRIPE_SEPA_DIRECT_DEBIT").''; } // Warehouse for automatic decrement -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? -{ - print ''; -} +//if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment +//{ +// print ''; +//} print ''; print ''; print '
'; +print ' - - + - - + - - - - - + + + + + + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ class FormResource $resourcestat = new Dolresource($this->db); - $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter); + $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, 0, $filter); if ($outputmode != 2) { @@ -194,17 +195,17 @@ class FormResource if ($empty && empty($arraytypes['code'])) continue; if ($format == 0) print ''; } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 8e850004669..800c5edcb06 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -226,18 +226,18 @@ if (! empty($arrayfields['ty.label']['checked'])) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Action column -print ''; print "\n"; print ''; -if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'], $_SERVER["PHP_SELF"], "ty.label", "", $param, "", $sortfield, $sortorder); +if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); +if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'], $_SERVER["PHP_SELF"], "ty.label", "", $param, "", $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -266,7 +266,7 @@ if ($ret) $obj = (Object) $resource->array_options; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - print ''."\n"; print ' '; print ' '; print ' '; -print ' '; -print ' '; +print ' '; +print ' '; print "\n"; foreach ($dirsociete as $dirroot) @@ -395,7 +395,7 @@ foreach ($dirsociete as $dirroot) if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file") { - print '\n"; } @@ -403,14 +403,14 @@ 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 ''; } - print ''; @@ -437,8 +437,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; foreach ($dirsociete as $dirroot) @@ -472,17 +472,17 @@ foreach ($dirsociete as $dirroot) if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file") { - print ''; } else { - print ''; } - print ''; @@ -530,9 +530,9 @@ print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); @@ -328,8 +328,8 @@ dol_fiche_end(); // TODO USe code similar to commande/stats/index.php instead of this one. /* print ''; -print ''; -print ''; +print ''; +print ''; $sql = "SELECT count(*) as nb, date_format(date_reception,'%Y') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."reception"; @@ -348,7 +348,7 @@ if ($resql) $nbproduct = $row[0]; $year = $row[1]; print ""; - print ''; + print ''; $i++; } } diff --git a/htdocs/reception/stats/month.php b/htdocs/reception/stats/month.php index e67768e6ceb..84eb9126464 100644 --- a/htdocs/reception/stats/month.php +++ b/htdocs/reception/stats/month.php @@ -65,8 +65,8 @@ if (! $mesg) } print '
'.$langs->trans("Year").''.$langs->trans("NbOfReceptions").'
'.$langs->trans("Year").''.$langs->trans("NbOfReceptions").'
'.$year.''.$nbproduct.'
'.$year.''.$nbproduct.'
'; -print ''; -print ''; +print ''; print '
Nombre d reception par mois'; +print '
Nombre d reception par mois'; print $px->show(); print '
'; diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index bd12cbd2902..9601c661c70 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -41,14 +41,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
trans("Reception"); ?> getNomUrl(1); ?> date_delivery, 'day'); ?>date_delivery, 'day'); ?>rights->reception->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?>getLibStatut(3); ?> + getLibStatut(3); ?> element != 'order_supplier') { @@ -66,11 +66,11 @@ if (count($linkedObjectBlock) > 1)
trans("Total"); ?>
'; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; print ''; print img_edit(); print ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index ba6d8522ccf..4a614c02312 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -356,8 +356,8 @@ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'."\n"; + print ''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "'; + print ''; if (! $disabled) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); if (! $disabled) print ''; print ''; + print ''; $s=$modCodeTiers->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; $s=$modCodeCompta->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print "\n"; foreach ($dirsociete as $dirroot) @@ -577,7 +577,7 @@ foreach ($dirsociete as $dirroot) // Activate / Disable if (in_array($name, $def)) { - print ""; } else { - print ""; } @@ -616,12 +616,12 @@ foreach ($dirsociete as $dirroot) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1); - print ''; // Preview - print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ print 'scandir.'&label='.urlencode($module->name).'">'; @@ -594,13 +594,13 @@ foreach ($dirsociete as $dirroot) { if (versioncompare($module->phpmin, versionphparray()) > 0) { - print "\n"; + print "\n"; print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", join('.', $module->phpmin))), 'switch_off'); print "\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { $linkspec=''.img_object($langs->trans("Preview"), 'bill').''; @@ -653,9 +653,9 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print "\n"; $profid['IDPROF1'][0]=$langs->trans("ProfId1"); @@ -693,39 +693,39 @@ foreach($profid as $key => $val) if ($verif) { - print ''; } else { - print ''; } if ($mandatory) { - print ''; } else { - print ''; } if ($invoice_mandatory) { - print ''; } else { - print ''; } @@ -753,7 +753,7 @@ print '
'; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").''.$langs->trans("MustBeInvoiceMandatory").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").''.$langs->trans("MustBeInvoiceMandatory").'
'; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
'; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // Utilisation formulaire Ajax sur choix societe @@ -762,20 +762,20 @@ print ''; print ''; if (! $conf->use_javascript_ajax) { - print '"; } else { - print '"; } @@ -786,20 +786,20 @@ print ''; print ''; if (! $conf->use_javascript_ajax) { - print '"; } else { - print '"; } @@ -810,7 +810,7 @@ print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; -print ''; print ''; -print ''; print ''; diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index 5007fe32af4..b2921b3108f 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -203,7 +203,7 @@ for ($i=1; $i<=4; $i++) { - +
".$langs->trans("Parameters")."'.$langs->trans("Value").''.$langs->trans("Value").' 
'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"), $langs->trans('UseSearchToSelectCompanyTooltip'), 1).' '; + print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; + print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); - print ''; + print ''; print ''; print "
'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"), $langs->trans('UseSearchToSelectContactTooltip'), 1).''; + print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; + print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); - print ''; + print ''; print ''; print "
'.$langs->trans("AddRefInList").' '; +print ''; if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { print ''; @@ -827,7 +827,7 @@ print '
'.$langs->trans("AddAdressInList").' '; +print ''; if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { print ''; @@ -846,7 +846,7 @@ print '
'.$langs->trans("AskForPreferredShippingMethod").' '; +print ''; if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { print ''; @@ -864,7 +864,7 @@ print '
'.$langs->trans("DisableProspectCustomerType").' '; +print ''; if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print ''; @@ -884,7 +884,7 @@ print ''.$langs->trans("DefaultCustomerType").''; print $formcompany->selectProspectCustomerType($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT, 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; +print ''; print ''; print '
diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index c00264be70c..7cb956e7b8c 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -216,7 +216,7 @@ for ($i=1; $i<=4; $i++) {

-
+
">     "> @@ -224,4 +224,4 @@ for ($i=1; $i<=4; $i++) { - \ No newline at end of file + diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index d75f4ccb464..46990231339 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -183,7 +183,7 @@ for ($i=1; $i<=4; $i++) { -
trans('RIB'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -201,7 +201,7 @@ for ($i=1; $i<=4; $i++) { - @@ -215,7 +215,7 @@ for ($i=1; $i<=4; $i++) {
trans('ParentCompany'); ?> +  
- - +
trans('SalesRepresentatives'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -288,4 +288,4 @@ $result=show_contacts($conf, $langs, $db, $soc); $result=show_projects($conf, $langs, $db, $soc); ?> - \ No newline at end of file + diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index b1d02006f16..9b401cbccb1 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -178,7 +178,7 @@ if (empty($conf) || ! is_object($conf))
diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index a26c834d355..10acd48aca8 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -178,7 +178,7 @@ if ($this->control->tpl['fournisseur']) {

-
+
">     "> @@ -186,4 +186,4 @@ if ($this->control->tpl['fournisseur']) { - \ No newline at end of file + diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index a5b247029c7..72514734fc1 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -142,7 +142,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); - \n"; // Type - print ''; // Last modified date - print '"; - print '"; print "\n"; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 99a7dbd9a1c..cf42b59f558 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -737,21 +737,21 @@ if (! empty($arrayfields['region.nom']['checked'])) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } // Staff if (! empty($arrayfields['staff.code']['checked'])) { - print ''; } @@ -836,7 +836,7 @@ if (! empty($arrayfields['s.tva_intra']['checked'])) // Type (customer/prospect/supplier) if (! empty($arrayfields['customerorsupplier']['checked'])) { - print ''; @@ -844,14 +844,14 @@ if (! empty($arrayfields['customerorsupplier']['checked'])) // Prospect level if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { - print ''; } // Prospect status if (! empty($arrayfields['s.fk_stcomm']['checked'])) { - print ''; } @@ -899,7 +899,7 @@ if (! empty($arrayfields['s.import_key']['checked'])) print ''; } // Action column -print ''; @@ -919,35 +919,35 @@ if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titr if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'class="nowrap"', $sortfield, $sortorder); +if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap '); if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -1057,7 +1057,7 @@ while ($i < min($num, $limit)) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -1066,7 +1066,7 @@ while ($i < min($num, $limit)) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -1075,7 +1075,7 @@ while ($i < min($num, $limit)) // Staff if (! empty($arrayfields['staff.code']['checked'])) { - print ''; @@ -1139,7 +1139,7 @@ while ($i < min($num, $limit)) // Type if (! empty($arrayfields['customerorsupplier']['checked'])) { - print '"; if (! $i) $totalarray['nbfield']++; @@ -1178,7 +1178,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['s.fk_stcomm']['checked'])) { // Prospect status - print ''; if (! $i) $totalarray['nbfield']++; @@ -1219,7 +1219,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['s.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1227,7 +1227,7 @@ while ($i < min($num, $limit)) // Status if (! empty($arrayfields['s.status']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['s.import_key']['checked'])) @@ -1239,7 +1239,7 @@ while ($i < min($num, $limit)) } // Action column - print ''; - print ''; + print ''; print ''; } else @@ -348,7 +348,7 @@ if ($result > 0) if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'sms') print $langs->trans("SMS"); print ''; - print ''; + print ''; print ''; $i++; } @@ -394,7 +394,7 @@ if ($result > 0) print ''; - print ''; + print ''; print ''; }*/ @@ -471,7 +471,7 @@ if ($result > 0) print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "n.type", '', $param, '', $sortfield, $sortorder); //print_liste_field_titre("Object",$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "n.daten", '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "n.daten", '', $param, '', $sortfield, $sortorder, 'right '); print ''; if ($num > 0) @@ -516,7 +516,7 @@ if ($result > 0) } print '';*/ // print - print''; + print''; print ''; $i++; } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 20df70fda70..fff105d5985 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -772,7 +772,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ' '.img_picto($langs->trans('ShowInStripe'), 'object_globe').''; } - print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; // Hook fields @@ -905,7 +905,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; print ''; // Default - print ''; // Default - print '\n"; @@ -1177,7 +1177,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } // Default - print ''; // Generate doc - print ''; // Edit/Delete - print '
trans('RIB'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -160,7 +160,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); - '; } // Facebook - if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - { - print ''; - print ''; - } + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Phone / Fax @@ -1591,6 +1601,7 @@ else $object->skype = GETPOST('skype', 'alpha'); $object->twitter = GETPOST('twitter', 'alpha'); $object->facebook = GETPOST('facebook', 'alpha'); + $object->linkedin = GETPOST('linkedin', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); @@ -1916,6 +1927,12 @@ else print ''; print ''; } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Phone / Fax @@ -2160,7 +2177,7 @@ else dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -2506,7 +2523,7 @@ else print '
'; - print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; @@ -404,13 +404,13 @@ if ($sql_select) // Titles with sort buttons print ''; - print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); - print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('TotalHT', $_SERVER['PHP_SELF'], 'total_ht', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('UnitPrice', $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre('TotalHT', $_SERVER['PHP_SELF'], 'total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre('UnitPrice', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; @@ -432,10 +432,10 @@ if ($sql_select) print ''; - print ''; + print ''; // Status - print ''; - print ''; + print ''; $total_qty+=$objp->prod_qty; - print ''; + print ''; $total_ht+=$objp->total_ht; - print ''; + print ''; print "\n"; $i++; @@ -611,9 +611,9 @@ if ($sql_select) print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "
trans('SalesRepresentatives'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -232,4 +232,4 @@ $result=show_contacts($conf, $langs, $db, $object); $result=show_projects($conf, $langs, $db, $object); ?> - \ No newline at end of file + diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a8a41527af0..e5caac88387 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -146,7 +146,7 @@ if (empty($reshook)) $object->client = $object->client | $soc_origin->client; $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; $listofproperties=array( - 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'url', 'barcode', + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'linkedin', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', @@ -407,6 +407,7 @@ if (empty($reshook)) $object->skype = GETPOST('skype', 'alpha'); $object->twitter = GETPOST('twitter', 'alpha'); $object->facebook = GETPOST('facebook', 'alpha'); + $object->linkedin = GETPOST('linkedin', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); @@ -970,6 +971,7 @@ else $object->skype = GETPOST('skype', 'alpha'); $object->twitter = GETPOST('twitter', 'alpha'); $object->facebook = GETPOST('facebook', 'alpha'); + $object->linkedin = GETPOST('linkedin', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); @@ -1304,13 +1306,21 @@ else print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; - print 'facebook).'">'; - print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; + print 'facebook).'">'; + print '
'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).''; + print 'linkedin).'">'; + print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'
'; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->societe->creer) print ''.img_edit('', 1).''; else print ' '; print '
'; @@ -2545,7 +2562,7 @@ else print ''; - if ($action != 'editparentcompany') print ''; + if ($action != 'editparentcompany') print ''; print '
'; print $langs->trans('ParentCompany'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; print '
'; if ($action == 'editparentcompany') diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 5b29e92b6dd..e6ba5c8beac 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -177,16 +178,17 @@ class Contacts extends DolibarrApi { $num = $db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); + $i = 0; while ($i < $min) { $obj = $db->fetch_object($result); $contact_static = new Contact($db); if ($contact_static->fetch($obj->rowid)) { - if ($includecount) - { - $contact_static->load_ref_elements(); - } + if ($includecount) + { + $contact_static->load_ref_elements(); + } $obj_ret[] = $this->_cleanObjectDatas($contact_static); } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4c964f591d0..1aacca2c895 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -203,6 +203,11 @@ class Societe extends CommonObject * @var string */ public $facebook; + /** + * LinkedIn username + * @var string + */ + public $linkedin; /** * Webpage * @var string @@ -848,6 +853,7 @@ class Societe extends CommonObject $this->skype = trim($this->skype); $this->twitter = trim($this->twitter); $this->facebook = trim($this->facebook); + $this->linkedin = trim($this->linkedin); $this->url = $this->url?clean_url($this->url, 0):''; $this->note_private = trim($this->note_private); $this->note_public = trim($this->note_public); @@ -991,6 +997,7 @@ class Societe extends CommonObject $sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null"); $sql .= ",twitter = ".(! empty($this->twitter)?"'".$this->db->escape($this->twitter)."'":"null"); $sql .= ",facebook = ".(! empty($this->facebook)?"'".$this->db->escape($this->facebook)."'":"null"); + $sql .= ",linkedin = ".(! empty($this->linkedin)?"'".$this->db->escape($this->linkedin)."'":"null"); $sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null"); $sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null"); @@ -1132,6 +1139,7 @@ class Societe extends CommonObject $lmember->skype=$this->skype; $lmember->twitter=$this->twitter; $lmember->facebook=$this->facebook; + $lmember->linkedin=$this->linkedin; $lmember->phone=$this->phone; $result=$lmember->update($user, 0, 1, 1, 1); // Use nosync to 1 to avoid cyclic updates @@ -1235,7 +1243,7 @@ class Societe extends CommonObject $sql .= ', s.status'; $sql .= ', s.price_level'; $sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif'; - $sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur'; + $sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.linkedin, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur'; $sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6'; $sql .= ', s.capital, s.tva_intra'; $sql .= ', s.fk_typent as typent_id'; @@ -1332,6 +1340,7 @@ class Societe extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->url = $obj->url; $this->phone = $obj->phone; $this->fax = $obj->fax; @@ -2010,16 +2019,16 @@ class Societe extends CommonObject $name=$this->name?$this->name:$this->nom; - if(!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ - if(empty($option) && $this->client > 0) $option = 'customer'; - if(empty($option) && $this->fournisseur > 0) $option = 'supplier'; + if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ + if (empty($option) && $this->client > 0) $option = 'customer'; + if (empty($option) && $this->fournisseur > 0) $option = 'supplier'; } if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { $code = ''; - if (($this->client) && (! empty ($this->code_client)) + if (($this->client) && (! empty($this->code_client)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 ) @@ -2028,7 +2037,7 @@ class Societe extends CommonObject $code = $this->code_client . ' - '; } - if (($this->fournisseur) && (! empty ($this->code_fournisseur)) + if (($this->fournisseur) && (! empty($this->code_fournisseur)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 ) @@ -2176,7 +2185,7 @@ class Societe extends CommonObject } $result.=$linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1); + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valignmiddle"'), 0, 0, $notooltip?0:1); if ($withpicto != 2) $result.=($maxlen?dol_trunc($name, $maxlen):$name); $result.=$linkend; @@ -3337,6 +3346,7 @@ class Societe extends CommonObject $this->skype=$member->skype; $this->twitter=$member->twitter; $this->facebook=$member->facebook; + $this->linkedin=$member->linkedin; $this->client = 1; // A member is a customer by default $this->code_client = ($customercode?$customercode:-1); @@ -3480,6 +3490,7 @@ class Societe extends CommonObject $this->skype='tom.hanson'; $this->twitter='tomhanson'; $this->facebook='tomhanson'; + $this->linkedin='tomhanson'; $this->url='http://www.specimen.com'; $this->phone='0909090901'; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 89960a69aee..80d98875e39 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -401,17 +401,6 @@ class SocieteAccount extends CommonObject return $result; } - /** - * Return link to download file from a direct external access - * - * @param int $withpicto Add download picto into link - * @return string HTML link to file - */ - function getDirectExternalLink($withpicto = 0) - { - return 'todo'; - } - /** * Retourne le libelle du status d'un user (actif, inactif) * diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 225dacd4a38..5d7bd6e70ad 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -380,23 +380,23 @@ if ($sql_select) // Filters print '
'; + print ''; print ''; print ''; // date print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle'); $formother->select_year($year?$year:-1, 'year', 1, 20, 1); print ''; + print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; print $documentstatic->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dateprint), 'day').''.dol_print_date($db->jdate($objp->dateprint), 'day').''; + print ''; if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); @@ -596,13 +596,13 @@ if ($sql_select) //print ''.$prodreftxt.''.$objp->prod_qty.''.$objp->prod_qty.''.price($objp->total_ht).''.price($objp->total_ht).''.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).''.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).'
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '' . $total_qty . '' . price($total_ht) . '' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '
"; print ''; @@ -629,11 +629,11 @@ elseif (empty($type_element) || $type_element == -1) print ''."\n"; // Titles with sort buttons print ''; - print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); - print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; print ''; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a4ef83cde45..2404c11861e 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -132,7 +132,7 @@ print '
'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'
'."\n"; print ''; if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) { - print '"; - $statstring.= ''; + $statstring.= ''; $statstring.= ""; } if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { $statstring.= ""; - $statstring.= ''; + $statstring.= ''; $statstring.= ""; } if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { $statstring2 = ""; - $statstring2.= ''; + $statstring2.= ''; $statstring2.= ""; } print $statstring; print $statstring2; } -print ''; print '
'.$langs->trans("Statistics").'
'; + print '
'; $dataseries=array(); if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array($langs->trans("Prospects"), round($third['prospect'])); if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array($langs->trans("Customers"), round($third['customer'])); @@ -154,25 +154,25 @@ else if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = "
'.$langs->trans("Prospects").''.round($third['prospect']).''.$langs->trans("Prospects").''.round($third['prospect']).'
'.$langs->trans("Customers").''.round($third['customer']).''.$langs->trans("Customers").''.round($third['customer']).'
'.$langs->trans("Suppliers").''.round($third['supplier']).''.$langs->trans("Suppliers").''.round($third['supplier']).'
'.$langs->trans("UniqueThirdParties").''; +print '
'.$langs->trans("UniqueThirdParties").''; print $total; print '
'; @@ -188,7 +188,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS print '
'; print ''; print ''; - print ''; - print ''; print '
'.$langs->trans("Categories").'
'; + print '
'; $sql = "SELECT c.label, count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; @@ -249,7 +249,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS } } print '
'.$langs->trans("Total").''; + print '
'.$langs->trans("Total").''; print $total; print '
'; @@ -321,7 +321,7 @@ if ($result) print $thirdparty_static->getNomUrl(1); print "
'; + print ''; if ($thirdparty_static->client==1 || $thirdparty_static->client==3) { $thirdparty_static->name=$langs->trans("Customer"); @@ -341,10 +341,10 @@ if ($result) } print ''; + print ''; print dol_print_date($thirdparty_static->datem, 'day'); print "'; + print ''; print $thirdparty_static->getLibStatut(3); print "
'; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, $sort, 'maxwidth100'); print ''; + print ''; if ($type != '') print ''; print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list'); print ''; + print ''; print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2); print ''; + print ''; $arraystcomm=array(); foreach($prospectstatic->cacheprospectstatus as $key => $val) { @@ -862,7 +862,7 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) } if (! empty($arrayfields['s2.nom']['checked'])) { - print ''; + print ''; print ''; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; if (! is_array($staffArray) || count($staffArray)==0) $staffArray = $formcompany->effectif_array(1); print $staffArray[$obj->staff_code]; print ''; + print ''; $s=''; if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { @@ -1169,7 +1169,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level - print ''; + print ''; print $companystatic->getLibProspLevel(); print "
'; + print '
'; print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); print '
-
'; foreach($prospectstatic->cacheprospectstatus as $key => $val) @@ -1193,7 +1193,7 @@ while ($i < min($num, $limit)) // Parent company if (! empty($arrayfields['s2.nom']['checked'])) { - print '
'; + print ''; if ($companystatic->fk_parent > 0) { $companyparent->fetch($companystatic->fk_parent); @@ -1211,7 +1211,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['s.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$companystatic->getLibStatut(3).''.$companystatic->getLibStatut(3).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 47f25172e59..59c43551f41 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -260,7 +260,7 @@ if ($result > 0) $type=array('email'=>$langs->trans("EMail")); print $form->selectarray("typeid", $type); print '
'.img_delete().''.img_delete().'
'; print $langs->trans("Email"); print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
'.dol_print_date($db->jdate($obj->daten), 'dayhour').''.dol_print_date($db->jdate($obj->daten), 'dayhour').'
'; + print ''; if (empty($stripecu)) { print '
'; @@ -829,7 +829,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'.$langs->trans('Type').''.$langs->trans('Informations').''.$langs->trans('Default').''.$langs->trans('Default').''.$langs->trans('Note').''.$langs->trans('DateModification').''; + print ''; if (empty($companypaymentmodetemp->default_rib)) { print ''; @@ -927,7 +927,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($user->rights->societe->creer) { if ($stripecu && empty($companypaymentmodetemp->stripe_card_ref)) @@ -1034,7 +1034,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ''; + print ''; if (($customerstripe->default_source != $src->id)) { print ''; @@ -1057,7 +1057,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($user->rights->societe->creer) { print ''; @@ -1103,8 +1103,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print print_liste_field_titre("RUM"); print print_liste_field_titre("WithdrawMode"); } - print_liste_field_titre("DefaultRIB", '', '', '', '', 'align="center"'); - print_liste_field_titre('', '', '', '', '', 'align="center"'); + print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre('', '', '', '', '', '', '', '', 'center '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "
'; + print ''; if (!$rib->default_rib) { print ''; print img_picto($langs->trans("Disabled"), 'off'); @@ -1188,7 +1188,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; + print ''; $buttonlabel = $langs->trans("BuildDoc"); $forname='builddocrib'.$rib->id; @@ -1244,7 +1244,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; + print ''; if ($user->rights->societe->creer) { print ''; @@ -1436,7 +1436,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -1483,7 +1483,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer) dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index c9342e2f41e..11930b3e009 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -319,7 +319,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
'; - print '
'; + print '
'; print ''; print '     '; print ''; @@ -440,13 +440,13 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print ''; print $userstatic->getLoginUrl(1); print '
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
 '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print ''; print $userstatic->getLoginUrl(1); print ''; + print ''; print 'id . '&prodid=' . $line->fk_product . '">'; print img_info(); print ''; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index c86a23c9827..193703a8468 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -249,7 +249,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre("Person", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", '', $sortfield, $sortorder, 'center '); print "
'; + print ''; print dol_print_date($datefin, 'day'); if ($memberstatic->hasDelay()) { print " ".img_warning($langs->trans("SubscriptionLate")); @@ -314,7 +314,7 @@ if ($id > 0 || ! empty($ref)) } else { - print ''; + print ''; if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index ce25f23694f..d106e42aa3f 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -389,7 +389,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 ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 100a85f6c30..5e2c27dd392 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -78,9 +78,6 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); - if (! $result > 0) - $error ++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; @@ -97,9 +94,9 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error ++; // Stock decrement - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_WAREHOUSE", (GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') > 0 ? GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - if (! $result > 0) - $error ++; + //$result = dolibarr_set_const($db, "ONLINE_PAYMENT_WAREHOUSE", (GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') > 0 ? GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); + //if (! $result > 0) + // $error ++; // Payment token for URL $result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", GETPOST('PAYMENT_SECURITY_TOKEN', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -166,18 +163,12 @@ print "
'; print $langs->trans("StripeLiveEnabled").''; -if (!empty($conf->global->STRIPE_LIVE)) -{ - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; -} -else -{ - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_LIVE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); + } print '
'; - print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; - print ''; + print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; + $url = dol_buildpath('/public/stripe/ipn.php?test', 2); + $out.= ''; + $out.= ajax_autoselect("onlinetestwebhookurl", 0); + print '
'.$out; print '
'.$langs->trans("StripeConnect").'
'; - print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; - print ''; + print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").'
'; + $url = dol_buildpath('/public/stripe/ipn.php', 2); + $out.= ''; + $out.= ajax_autoselect("onlinelivewebhookurl", 0); + print '
'.$out; print '
'; + print $langs->trans("STRIPE_PAYMENT_REQUEST_API").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); + } + print '
'; - print $langs->trans("STRIPE_MINIMAL_3DSECURE").''; - print ''.$langs->getCurrencySymbol($conf->currency).'
'; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_SEPA_DIRECT_DEBIT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); + } + print '
'; - print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; - print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); - print '
'; +// print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; +// print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); +// print '
'; print $langs->trans("CSSUrlForPaymentForm").''; @@ -329,7 +350,12 @@ print '
'; print $langs->trans("SecurityTokenIsUnique").''; -print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE", (empty($conf->global->PAYMENT_SECURITY_TOKEN)?0:$conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE), 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PAYMENT_SECURITY_TOKEN_UNIQUE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PAYMENT_SECURITY_TOKEN_UNIQUE", $arrval, $conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE); +} print '
'; diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 83cbe2755a1..fb122948dd0 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -101,10 +101,10 @@ if (!$rowid) print_liste_field_titre("StripeCustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print "
"; @@ -199,7 +199,7 @@ if (!$rowid) } else print $FULLTAG; print "'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."'; if ($charge->source->object=='card') @@ -213,9 +213,9 @@ if (!$rowid) } print '".price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'.price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'; + print ''; if ($charge->refunded=='1'){ print img_picto($langs->trans("refunded"), 'statut6'); } elseif ($charge->paid=='1'){ diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 408d47a407c..598cb19dd62 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -95,7 +95,7 @@ class ActionsStripeconnect $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('StripeCustomer'); - $this->resprints.= ''; + $this->resprints.= ''; // $this->resprints.= ''.img_edit().''; $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('StripeCustomer'); - $this->resprints.= ''; + $this->resprints.= ''; $this->resprints.= '
'; $this->resprints.= '
'; @@ -132,7 +132,7 @@ class ActionsStripeconnect $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('SubscriptionStripe'); - $this->resprints.= ''; + $this->resprints.= ''; $this->resprints.= '
'; $this->resprints.= '
'; @@ -151,7 +151,7 @@ class ActionsStripeconnect $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('PlanStripe'); - $this->resprints.= ''; + $this->resprints.= ''; // $this->resprints.= ''.img_edit().''; $this->resprints.= '
'; $this->resprints.= '
id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"'; } @@ -690,7 +697,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"'; } @@ -709,7 +716,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (($account->type=='custom' or $account->type=='express') && $entity==1) { print '
getStripeCustomerAccount($facture->socid)!=$source) { print'class="opacitymedium"'; } @@ -738,7 +745,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print 'id!=$source) { print'class="opacitymedium"'; } @@ -816,21 +823,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; - print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''; } - print ''; + print ''; print "\n"; $total=0; @@ -871,20 +878,20 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print "\n"; // Date - print '\n"; + print '\n"; // Currency - if (!empty($conf->multicurrency->enabled)) print '\n"; + if (!empty($conf->multicurrency->enabled)) print '\n"; // Multicurrency Price if (!empty($conf->multicurrency->enabled)) { - print ''; // Multicurrency Price - print ''; // Multicurrency Price - print ''; } // Price - print ''; + print ''; // Received or paid back - print ''; // Remain to take or to pay back - print ''; + print ''; //$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)); // Amount - print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (!empty($conf->multicurrency->enabled)) { print ''; - print ''; - print ''; + print ''; + print ''; } - print ''; - print ''; + print ''; print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (!empty($conf->multicurrency->enabled)) { print ''; } print "\n"; @@ -1011,7 +1018,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $db->free($resql); } else - { + { dol_print_error($db); } @@ -1044,9 +1051,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($totalpayment)) { $text = $langs->trans('ConfirmCustomerPayment', $totalpayment, $langs->trans("Currency".$conf->currency)); } - if (!empty($multicurrency_totalpayment)) { - $text.='
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency")); - } + if (!empty($multicurrency_totalpayment)) { + $text.='
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency")); + } if (GETPOST('closepaidinvoices')) { $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); @@ -1098,7 +1105,7 @@ if (! GETPOST('action')) print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'ref', '', '', '', $sortfield, $sortorder); print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'dp', '', '', '', $sortfield, $sortorder); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'libelle', '', '', '', $sortfield, $sortorder); - print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -1109,7 +1116,7 @@ if (! GETPOST('action')) print '\n"; print '\n"; print '\n"; - print ''; + print ''; $parameters=array(); $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 2fec924c2bf..0149775c360 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -103,12 +103,12 @@ if (! $rowid) { //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("DateOperation", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateOperation", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print "\n"; print "\n"; @@ -198,16 +198,16 @@ if (! $rowid) { //} //print "\n"; // Date payment - print '\n"; + print '\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Amount - print ""; - print ""; + print '"; + print '"; // Status - print "\n"; print "\n"; @@ -162,7 +161,7 @@ if (! $rowid) { // Ref if (!empty($stripeacc)) $connect=$stripeacc.'/'; - + // Ref if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; @@ -208,20 +207,21 @@ if (! $rowid) { //} //print "\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Amount - print ""; - print ""; + print '"; + print '"; // Status - print "'; print "\n"; } diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php index 3a0f1eed273..1b5c08119d1 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php @@ -76,13 +76,13 @@ $extrafields->fetch_name_optionals_label($elementtype); print "
'.$arraytitle.''.$langs->trans('Date').''.$langs->trans('Date').''.$langs->trans('Currency').''.$langs->trans('MulticurrencyAmountTTC').''.$multicurrencyalreadypayedlabel.''.$multicurrencyremaindertopay.''.$langs->trans('MulticurrencyAmountTTC').''.$multicurrencyalreadypayedlabel.''.$multicurrencyremaindertopay.''.$langs->trans('AmountTTC').''.$alreadypayedlabel.''.$remaindertopay.''.$langs->trans('PaymentAmount').''.$langs->trans('AmountTTC').''.$alreadypayedlabel.''.$remaindertopay.''.$langs->trans('PaymentAmount').''.$langs->trans('MulticurrencyPaymentAmount').''.$langs->trans('MulticurrencyPaymentAmount').'  
'.dol_print_date($db->jdate($objp->df), 'day')."'.dol_print_date($db->jdate($objp->df), 'day')."'.$objp->multicurrency_code."'.$objp->multicurrency_code."'; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $objp->multicurrency_total_ttc); print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($sign * $multicurrency_payment); @@ -894,26 +901,26 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); print ''.price($sign * $objp->total_ttc).''.price($sign * $objp->total_ttc).''.price($sign * $paiement); + print ''.price($sign * $paiement); if ($creditnotes) print '+'.price($creditnotes); if ($deposits) print '+'.price($deposits); print ''.price($sign * $remaintopay).''.price($sign * $remaintopay).''; + print ''; // Add remind amount $namef = 'amount_'.$objp->facid; @@ -936,7 +943,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Multicurrency Price if (! empty($conf->multicurrency->enabled)) { - print ''; + print ''; // Add remind multicurrency amount $namef = 'multicurrency_amount_'.$objp->facid; @@ -961,7 +968,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Warning - print ''; + print ''; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."
"; if ($amounts[$invoice->id] && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id])) || $multicurrency_amounts[$invoice->id] && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id]))) @@ -988,19 +995,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Print total print '
'.$langs->trans('TotalTTC').''.price($sign * $total_ttc).''.price($sign * $totalrecu); + print ''.price($sign * $total_ttc).''.price($sign * $totalrecu); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'
'.$objp->ref."'.dol_print_date($db->jdate($objp->dp))."'.$objp->paiement_type.' '.$objp->num_paiement."'.price($objp->amount).' '.price($objp->amount).' 
' . dol_print_date($payout->created, '%d/%m/%Y %H:%M') . "' . dol_print_date($payout->created, '%d/%m/%Y %H:%M') . "' . dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M') . "' . dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M') . "' . $payout->description . '" . price(($payout->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "" . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "' . price(($payout->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "' . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . ""; + print ""; if ($payout->status=='paid') { print img_picto($langs->trans("".$payout->status.""), 'statut4'); } elseif ($payout->status=='pending') { diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 467d242a0c8..d1ab2ebe50d 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -71,7 +71,6 @@ else $service = 'StripeLive'; $servicestatus = '1'; } - $stripeacc = $stripe->getStripeAccount($service); /*if (empty($stripeaccount)) { @@ -103,11 +102,11 @@ if (! $rowid) { //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right_'); print "
' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "' . $txn->type . '" . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "' . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "' . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; - if ($txn->status=='available') - {print img_picto($langs->trans("".$txn->status.""), 'statut4');} - elseif ($txn->status=='pending') - {print img_picto($langs->trans("".$txn->status.""), 'statut7');} - elseif ($txn->status=='failed') - {print img_picto($langs->trans("".$txn->status.""), 'statut8');} + print ""; + if ($txn->status=='available') { + print img_picto($langs->trans("".$txn->status.""), 'statut4'); + } elseif ($txn->status=='pending') { + print img_picto($langs->trans("".$txn->status.""), 'statut7'); + } elseif ($txn->status=='failed') { + print img_picto($langs->trans("".$txn->status.""), 'statut8'); + } print '
"; print ''; -print ''; +print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "\n"; @@ -93,10 +93,10 @@ foreach($extrafields->attribute_type as $key => $value) print "\n"; print "\n"; print "\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; print ""; // $i++; diff --git a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php index 99a00668926..b3b0e482f62 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php @@ -84,9 +84,9 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "\n"; @@ -96,10 +96,10 @@ foreach($extrafields->attribute_type as $key => $value) print "\n"; print "\n"; print "\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; print ""; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b742b0379c5..c8a161d7b90 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1084,7 +1084,7 @@ if ($action == 'create') } else { print ''; } print '' . "\n"; @@ -1165,7 +1165,7 @@ if ($action == 'create') print ''; print ''; @@ -1468,7 +1468,7 @@ if ($action == 'create') print $langs->trans('PaymentConditionsShort'); print ''; if ($action != 'editconditions' && ! empty($object->brouillon)) - print ''; + print ''; print '
'.$langs->trans("Position").''.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print ''.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; print "  ".img_delete()."
'.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print ''.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; print "  ".img_delete()."
'; print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; 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 '
id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '
'; print '
'; if ($action == 'editconditions') { @@ -1486,7 +1486,7 @@ if ($action == 'create') print $langs->trans('DeliveryDate'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1) . '
'; print ''; if ($action == 'editdate_livraison') { @@ -1509,7 +1509,7 @@ if ($action == 'create') print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && ! empty($object->brouillon)) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . ''; print ''; print ''; if ($action == 'editmode') { @@ -1529,7 +1529,7 @@ if ($action == 'create') print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencycode') { @@ -1546,7 +1546,7 @@ if ($action == 'create') print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { @@ -1571,7 +1571,7 @@ if ($action == 'create') // Outstanding Bill print ''; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print ''; @@ -1586,7 +1586,7 @@ if ($action == 'create') print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->supplier_proposal->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; print ''; print ''; if ($action == 'editbankaccount') { @@ -1739,7 +1739,7 @@ if ($action == 'create') if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '

'.$langs->trans('SupplierProposalRefFournNotice').'

'; // TODO Suggest a permanent checkbox instead of option $form_close .= ''; $form_close .= ''; - $form_close .= ''; - $form_close .= ''; - $form_close .= ''; print ''; - print ''; + print ''; print "\n"; } } if ($conf->use_javascript_ajax) { - print ''; } - print ''; + print ''; print "
' . $langs->trans("CloseAs") . ''; + $form_close .= '
' . $langs->trans("CloseAs") . ''; $form_close .= ''; $form_close .= ''; $form_close .= '
' . $langs->trans('Note') . '
'; + $form_close .= '
'; $form_close .= ''; $form_close .= '   '; $form_close .= ' '; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a5c6ee84e86..5e01c29c1fc 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1226,7 +1226,7 @@ class SupplierProposal extends CommonObject $sql.= ", p.date_livraison as date_livraison"; $sql.= ", p.model_pdf, p.extraparams"; $sql.= ", p.note_private, p.note_public"; - $sql.= ", p.fk_projet, p.fk_statut"; + $sql.= ", p.fk_projet as fk_project, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; $sql.= ", p.fk_cond_reglement"; $sql.= ", p.fk_mode_reglement"; @@ -1266,7 +1266,7 @@ class SupplierProposal extends CommonObject $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total; $this->socid = $obj->fk_soc; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->modelpdf = $obj->model_pdf; $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 38146c95645..5a2e6df2f29 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -125,13 +125,13 @@ if ($resql) { print '
'.$supplier_proposalstatic->LibStatut($status, 0).''.(isset($vals[$status])?$vals[$status]:0).''.(isset($vals[$status])?$vals[$status]:0).'
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -146,7 +146,7 @@ if ($resql) print '
'.$langs->trans("Total").''.$total.'
'.$langs->trans("Total").''.$total.'

"; } else @@ -256,7 +256,7 @@ if ($resql) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -272,7 +272,7 @@ if ($resql) print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.dol_print_date($db->jdate($obj->datec), 'day').''; - print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).''; print ''; $i++; } @@ -333,7 +333,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos print ''; if ($db->jdate($obj->dfv) < ($now - $conf->supplier_proposal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->supplier_proposalid; @@ -348,10 +348,10 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos $companystatic->canvas=$obj->canvas; print ''.$companystatic->getNomUrl(1, 'customer', 44).''."\n"; - print ''; + print ''; print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; - print ''.price($obj->total_ttc).''; - print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).''."\n"; + print ''.price($obj->total_ttc).''; + print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).''."\n"; print ''."\n"; $i++; $total += $obj->total_ttc; @@ -362,7 +362,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos } elseif ($total>0) { - print ''.$langs->trans("Total")."".price($total)." "; + print ''.$langs->trans("Total").''.price($total)." "; } print "
"; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 38741bfaf5a..17dc033361e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -476,7 +476,7 @@ if ($resql) } if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; print ''; print ''; } @@ -492,21 +492,21 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } // Date if (! empty($arrayfields['sp.date_valid']['checked'])) { - print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -517,7 +517,7 @@ if ($resql) // Date if (! empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -529,28 +529,28 @@ if ($resql) if (! empty($arrayfields['sp.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['sp.total_vat']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['sp.total_ttc']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['u.login']['checked'])) { // Author - print ''; + print ''; print ''; print ''; } @@ -575,12 +575,12 @@ if ($resql) // Status if (! empty($arrayfields['sp.fk_statut']['checked'])) { - print ''; + print ''; $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'supplier', 'search_status'); print ''; } // Action column - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -594,24 +594,24 @@ if ($resql) if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.date_valid']['checked'])) print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['sp.date_valid']['checked'])) print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['sp.datec']['checked'])) print_liste_field_titre($arrayfields['sp.datec']['label'], $_SERVER["PHP_SELF"], "sp.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.tms']['checked'])) print_liste_field_titre($arrayfields['sp.tms']['label'], $_SERVER["PHP_SELF"], "sp.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.fk_statut']['checked'])) print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['sp.datec']['checked'])) print_liste_field_titre($arrayfields['sp.datec']['label'], $_SERVER["PHP_SELF"], "sp.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['sp.tms']['checked'])) print_liste_field_titre($arrayfields['sp.tms']['label'], $_SERVER["PHP_SELF"], "sp.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap'); + if (! empty($arrayfields['sp.fk_statut']['checked'])) print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print ''."\n"; $now = dol_now(); @@ -654,7 +654,7 @@ if ($resql) print ''; } // Other picto tool - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -707,7 +707,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; @@ -716,7 +716,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; @@ -726,7 +726,7 @@ if ($resql) // Date proposal if (! empty($arrayfields['sp.date_valid']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_valid), 'day'); print "\n"; if (! $i) $totalarray['nbfield']++; @@ -735,7 +735,7 @@ if ($resql) // Date delivery if (! empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->dp), 'day'); print "\n"; if (! $i) $totalarray['nbfield']++; @@ -744,7 +744,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['sp.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -752,7 +752,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['sp.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -760,7 +760,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['sp.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -772,7 +772,7 @@ if ($resql) // Author if (! empty($arrayfields['u.login']['checked'])) { - print ''; + print ''; if ($userstatic->id) print $userstatic->getLoginUrl(1); else print ' '; print "\n"; @@ -788,7 +788,7 @@ if ($resql) // Date creation if (! empty($arrayfields['sp.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -796,7 +796,7 @@ if ($resql) // Date modification if (! empty($arrayfields['sp.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -804,12 +804,12 @@ if ($resql) // Status if (! empty($arrayfields['sp.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5)."\n"; + print ''.$objectstatic->LibStatut($obj->fk_statut, 5)."\n"; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -845,9 +845,9 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; else print ''; } print ''; diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index 4a2a028777e..bd2a94d1c32 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -47,14 +47,14 @@ foreach($linkedObjectBlock as $key => $objectlink) trans("SupplierProposal"); ?> trans("ShowSupplierProposal"), "supplier_proposal").' '.$objectlink->ref; ?> - datec, 'day'); ?> - datec, 'day'); ?> + rights->supplier_proposal->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> 1) trans("Total"); ?> - - - - - + + + + + $val) //Printer1 print ''; -print ''; $nbofentries=(count($data) - 1); print ''; @@ -163,7 +163,7 @@ print '

'; //Printer2 print '
'.$langs->trans("Printer").' 1'; +print '
'.$langs->trans("Printer").' 1'; print '
'; -print ''; $nbofentries=(count($data) - 1); print ''; diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index 5871d27a618..4b16cc9ec81 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -42,21 +42,21 @@ $term = GETPOST('term', 'alpha'); * View */ -if ($action=="getProducts"){ - $object = new Categorie($db); - $result=$object->fetch($category); - $prods = $object->getObjectsInCateg("product"); - echo json_encode($prods); +if ($action=="getProducts") { + $object = new Categorie($db); + $result=$object->fetch($category); + $prods = $object->getObjectsInCateg("product"); + echo json_encode($prods); } -if ($action=="search"){ - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; - $sql.= ' WHERE entity IN ('.getEntity('product').')'; - $sql .= natural_search(array('label','barcode'), $term); - $resql = $db->query($sql); - $rows = array(); - while($row = $db->fetch_array ($resql)){ - $rows[] = $row; - } - echo json_encode($rows); +if ($action=="search") { + $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; + $sql .= ' WHERE entity IN ('.getEntity('product').')'; + $sql .= natural_search(array('label','barcode'), $term); + $resql = $db->query($sql); + $rows = array(); + while ($row = $db->fetch_array($resql)) { + $rows[] = $row; + } + echo json_encode($rows); } diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 87c74c8952d..cac9a23a8d9 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -110,6 +110,18 @@ div.description{ text-align:center; } +div.catwatermark{ + position:absolute; + top:3%; + left:3%; + width:20%; + background-color:black; + color:white; + text-align:center; + font-size: 20px; + display: none; +} + @media only screen and (max-aspect-ratio: 6/4) { div.description{ min-height:20%; diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 7ca0a40ca74..ceb8c73f211 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -45,7 +45,7 @@ if ($action=="getTables"){ $sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; $resql = $db->query($sql); $rows = array(); - while($row = $db->fetch_array ($resql)){ + while($row = $db->fetch_array($resql)){ $rows[] = $row; } echo json_encode($rows); @@ -62,15 +62,15 @@ if ($action=="update") if ($action=="updatename") { - $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars - if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars + $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars + if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); } if ($action=="add") { $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); - $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } // Title @@ -175,4 +175,4 @@ $( document ).ready(function() { - \ No newline at end of file + diff --git a/htdocs/takepos/genimg/add.jpg b/htdocs/takepos/genimg/add.jpg deleted file mode 100644 index 976fd10697d..00000000000 Binary files a/htdocs/takepos/genimg/add.jpg and /dev/null differ diff --git a/htdocs/takepos/genimg/empty.jpg b/htdocs/takepos/genimg/empty.jpg deleted file mode 100644 index 8883f7c9957..00000000000 Binary files a/htdocs/takepos/genimg/empty.jpg and /dev/null differ diff --git a/htdocs/takepos/genimg/empty.png b/htdocs/takepos/genimg/empty.png new file mode 100644 index 00000000000..63163e9f869 Binary files /dev/null and b/htdocs/takepos/genimg/empty.png differ diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index d5dee43ffa8..506c067790a 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -27,10 +27,10 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../../main.inc.php'; // Load $user and permissions -$id= GETPOST('id'); -$w= GETPOST('w'); -$h= GETPOST('h'); -$query= GETPOST('query'); +$id = GETPOST('id', 'int'); +$w = GETPOST('w', 'int'); +$h = GETPOST('h', 'int'); +$query= GETPOST('query', 'alpha'); @@ -38,7 +38,6 @@ $query= GETPOST('query'); * View */ -header('Content-Type: image/jpeg'); header('Cache-Control: max-age=604800, public, must-revalidate'); header('Pragma: cache'); @@ -49,39 +48,26 @@ if ($query=="cat") $object = new Categorie($db); $result = $object->fetch($id); + $upload_dir = $conf->categorie->multidir_output[$object->entity]; $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/"; $dir = $upload_dir.'/'.$pdir; + foreach ($object->liste_photos($dir) as $key => $obj) { - $filename=$obj['photo']; + if ($obj['photo_vignette']) + { + $filename=$obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + $file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); + header('Location: '.$file); + exit; } - - // The file - $filename = $dir.$filename; - if (!file_exists($filename)) $filename="empty.jpg"; - - // Dimensions - list($width, $height) = getimagesize($filename); - $new_width = $w; - $new_height = $h; - - // Resample - $image_p = imagecreatetruecolor($new_width, $new_height); - $image = imagecreatefromjpeg($filename); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - - // Add icon - $icon = imagecreatefromjpeg('add.jpg'); - list($width, $height) = getimagesize('add.jpg'); - $new_width = $w*0.3; - $new_height = $h*0.3; - $icon_p = imagecreatetruecolor($new_width, $new_height); - imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); - - // Output - imagejpeg($image_p, null, 100); + header('Location: ../../public/theme/common/nophoto.png'); } elseif ($query=="pro") { @@ -89,42 +75,17 @@ elseif ($query=="pro") $objProd = new Product($db); $objProd->fetch($id); + $image=$objProd->show_photos('product', $conf->product->multidir_output[$entity], 'small', 1); - $dir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; - $pdir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; - - foreach ($objProd->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - $filename = $dir.$filename; - - if (!file_exists($filename)){ - $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; - foreach ($objProd->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - $filename = $dir.$filename; - } - - if (!file_exists($filename)) $filename="empty.jpg"; - - // Dimensions - list($width, $height) = getimagesize($filename); - $new_width = $w; - $new_height = $h; - - // Resample - $image_p = imagecreatetruecolor($new_width, $new_height); - $image = imagecreatefromjpeg($filename); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - - // Output - imagejpeg($image_p, null, 100); + preg_match('@src="([^"]+)"@', $image, $match); + $file = array_pop($match); + if ($file=="") header('Location: ../../public/theme/common/nophoto.png'); + else header('Location: '.$file); } else { + // TODO We don't need this. Size of image must be defined on HTML page, image must NOT be resize when downloaded. + // The file $filename = $query.".jpg"; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 2f2df5b8085..33524b80a8c 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -39,7 +39,7 @@ $place = GETPOST('place', 'int'); $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); -$row = $db->fetch_array ($resql); +$row = $db->fetch_array($resql); $placeid=$row[0]; if (! $placeid) $placeid=0; // Invoice not exist else{ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 456ddcefdb5..d43c3195b92 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -34,7 +34,7 @@ $place=GETPOST('place', 'int'); if ($place>0){ $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array ($resql); + $row = $db->fetch_array($resql); $facid=$row[0]; } $object=new Facture($db); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 4edab6c9bee..fe6bf6b0a19 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -93,8 +93,9 @@ function PrintCategories(first){ for (i = 0; i < 14; i++) { if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") break; $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']); - $("#catimg"+i).attr("src","genimg/?query=cat&w=55&h=50&id="+categories[parseInt(i)+parseInt(first)]['rowid']); + $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']); $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']); + $("#catwatermark"+i).show(); } } @@ -117,12 +118,14 @@ function MoreCategories(moreorless){ for (i = 0; i < 14; i++) { if (typeof (categories[i+(14*pagecategories)]) == "undefined"){ $("#catdesc"+i).text(""); - $("#catimg"+i).attr("src",""); + $("#catimg"+i).attr("src","genimg/empty.png"); + $("#catwatermark"+i).hide(); continue; } $("#catdesc"+i).text(categories[i+(14*pagecategories)]['label']); - $("#catimg"+i).attr("src","genimg/?query=cat&w=55&h=50&id="+categories[i+(14*pagecategories)]['rowid']); + $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(14*pagecategories)]['rowid']); $("#catdiv"+i).data("rowid",categories[i+(14*pagecategories)]['rowid']); + $("#catwatermark"+i).show(); } } @@ -131,16 +134,17 @@ function LoadProducts(position, issubcat=false){ $('#catimg'+position).animate({opacity: '1'}, 100); if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid'); else currentcat=$('#catdiv'+position).data('rowid'); - if (currentcat=="") return; + if (currentcat==undefined) return; pageproducts=0; ishow=0; //product to show counter jQuery.each(subcategories, function(i, val) { if (currentcat==val.fk_parent){ $("#prodesc"+ishow).text(val.label); - $("#proimg"+ishow).attr("src","genimg/?query=cat&w=55&h=50&id="+val.rowid); + $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); $("#prodiv"+ishow).data("iscat",1); + $("#prowatermark"+ishow).show(); ishow++; } }); @@ -150,18 +154,19 @@ function LoadProducts(position, issubcat=false){ while (idata < 30 && ishow < 30) { if (typeof (data[idata]) == "undefined") { $("#prodesc"+ishow).text(""); - $("#proimg"+ishow).attr("src",""); + $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); - $("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']); + $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); ishow++; //Next product to show after print data product } + $("#prowatermark"+ishow).hide(); idata++; //Next data everytime } }); @@ -189,18 +194,19 @@ function MoreProducts(moreorless){ while (idata < (30*pageproducts)+30) { if (typeof (data[idata]) == "undefined") { $("#prodesc"+ishow).text(""); - $("#proimg"+ishow).attr("src",""); + $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); - $("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']); + $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); ishow++; //Next product to show after print data product } + $("#prowatermark"+ishow).hide(); idata++; //Next data everytime } }); @@ -261,12 +267,12 @@ function Search2(){ for (i = 0; i < 30; i++) { if (typeof (data[i]) == "undefined"){ $("#prodesc"+i).text(""); - $("#proimg"+i).attr("src",""); + $("#proimg"+i).attr("src","genimg/empty.png"); $("#prodiv"+i).data("rowid",""); continue; } $("#prodesc"+i).text(data[parseInt(i)]['label']); - $("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i]['rowid']); + $("#proimg"+i).attr("src","genimg/?query=pro&id="+data[i]['rowid']); $("#prodiv"+i).data("rowid",data[i]['rowid']); $("#prodiv"+i).data("iscat",0); } @@ -491,10 +497,11 @@ foreach($menus as $menu) { { ?>
id='catdiv'> - width="98%" id='catimg'/> + width="100%" height="85%" id='catimg'/>
+
+
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > - width="95%" id='proimg'/> + width="100%" height="85%" id='proimg'/>
+
+
!important; } -a.tab { font-weight: bold !important; } +a.tab { font-weight: 500 !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } @@ -692,6 +692,7 @@ select.selectarrowonleft option { .width100 { width: 100px; } .width200 { width: 200px; } .minwidth100 { min-width: 100px; } + .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } @@ -709,6 +710,7 @@ select.selectarrowonleft option { .width50 { width: 50px; } .width75 { width: 75px; } .width100 { width: 100px; } +.width150 { width: 150px; } .width200 { width: 200px; } .maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } @@ -1930,8 +1932,8 @@ input.vmenusearchselectcombo[type=text] { .searchform input { font-size: 16px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu { white-space: nowrap; font-family: ; text-align: ; font-weight: bold; } -font.vmenudisabled { font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu { white-space: nowrap; font-family: ; text-align: ; font-weight: bold; } /* bold = 600, 500 is ko with Edge on 1200x960 */ +font.vmenudisabled { font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } /* bold = 600, 500 is ko with Edge on 1200x960 */ a.vmenu:link, a.vmenu:visited { color: #; } a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 6px; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3d150be6ea8..251524c9445 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -33,4 +33,4 @@ require_once __DIR__ . '/_global.css.php'; -if (is_object($db)) $db->close(); +if (is_object($db)) $db->close(); \ No newline at end of file diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c7485d7fd99..5bd5c386641 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -264,7 +264,7 @@ body { .thumbstat { font-weight: bold !important; } th a { font-weight: !important; } -a.tab { font-weight: bold !important; } +a.tab { font-weight: 500 !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } @@ -919,6 +919,7 @@ select.selectarrowonleft option { .width100 { width: 100px; } .width200 { width: 200px; } .minwidth100 { min-width: 100px; } + .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } @@ -933,10 +934,10 @@ select.selectarrowonleft option { } .widthauto { width: auto; } .width25 { width: 25px; } -.width75 { width: 75px; } .width50 { width: 50px; } .width75 { width: 75px; } .width100 { width: 100px; } +.width150 { width: 150px; } .width200 { width: 200px; } .maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 631ee0d3c41..c71a2211e7f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -322,12 +322,12 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' '; if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' : '; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 0) . ' : '; } if ($action == 'editcustomer') { $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); } else { - $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); } } @@ -447,7 +447,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print $langs->trans('Progression') . ''; if ($action != 'progression' && $object->fk_statut < 8 && !$user->societe_id) { - print ''; + print ''; } print '
'.$langs->trans("Printer").' 2'; +print '
'.$langs->trans("Printer").' 2'; print '
'; print '' . img_edit($langs->trans('Modify')) . '' . img_edit($langs->trans('Modify')) . '
'; print ''; @@ -551,7 +551,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print ''; print $langs->trans('TicketChangeCategory'); print ''; - print $formticket->selectAnalyticCodesTickets($object->category_code, 'update_value_category', '', 2); + print $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2); print ''; print ''; } else { @@ -571,8 +571,8 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd }*/ print ''; - // Category - print '' . $langs->trans("AnalyticCode") . ''; + // Group + print '' . $langs->trans("TicketGroup") . ''; print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); /*if ($user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); @@ -604,7 +604,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
' . $langs->trans("Contacts") . '
' . $langs->trans("ContactType") . '
' . $langs->trans("Phone") . '
-
' . $langs->trans("Status") . '
'; +
' . $langs->trans("Status") . '
'; print '
'; // Contact list @@ -620,7 +620,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $var = !$var; print '
'; - print '
'; + print '
'; if ($tab[$i]['source'] == 'internal') { echo $langs->trans("User"); } @@ -630,7 +630,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } print '
'; - print '
'; + print '
'; if ($tab[$i]['socid'] > 0) { $companystatic->fetch($tab[$i]['socid']); @@ -672,7 +672,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } print '
'; - print '
'; + print '
'; if ($object->statut >= 0) { echo ''; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 618eb654b1c..806bed19064 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -186,7 +186,7 @@ class Ticket extends CommonObject 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), - 'category_code' => array('type'=>'varchar(32)', 'label'=>'Category', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), + 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 7466a0308e1..2e9f76ff8a3 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -354,8 +354,8 @@ if ($result) { print $objp->severity_label; print ""; - print ''; - print $tickesupstatic->getLibStatut(3); + print ''; + print $tickesupstatic->getLibStatut(5); print ""; print "\n"; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index b9bf46ef83a..0b3a1c101e8 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -82,6 +82,8 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (! $sortorder) $sortorder="ASC"; +if (GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][]='openall'; // For backward compatibility + // Initialize array of search criterias $search_all=trim(GETPOST("search_all", 'alpha')); $search=array(); @@ -211,11 +213,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; else $sql.=" WHERE 1 = 1"; + foreach($search as $key => $val) { if ($key == 'fk_statut') { - if ($search_fk_status == 'non_closed') $sql.= " AND ".$key." IN (0, 1, 3, 4, 5, 6)"; + $tmpstatus=''; + if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'0', '1', '3', '4', '5', '6'"; + if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'8', '9'"; + if ($tmpstatus) $sql.=" AND fk_statut IN (".$tmpstatus.")"; elseif (is_array($search[$key]) && count($search[$key])) $sql.=natural_search($key, join(',', $search[$key]), 2); continue; } @@ -225,8 +231,10 @@ foreach($search as $key => $val) if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc, 2); if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project, 2); -if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { - $sql.= " AND t.fk_user_assign=".$user->id; +if (! $user->societe_id && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { + $sql.= " AND (t.fk_user_assign = ".$user->id; + if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql.=" OR t.fk_user_create = ".$user->id; + $sql.=")"; } // Add where from extra fields @@ -461,7 +469,7 @@ if ($user->rights->ticket->write) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_ticket', 0, $newcardbutton, '', $limit); -if ($mode == 'my_assign') { +if ($mode == 'mine') { print '
' . $langs->trans('TicketAssignedToMeInfos') . '

'; } // Add code for pre mass action (confirmation or email presend form) @@ -477,17 +485,6 @@ if ($sall) print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; } -print '
'; -if ($search_fk_status == 'non_closed') { - print ''; - $param .= '&search_fk_status=non_closed'; -} else { - print ''; - $param .= '&search_fk_status=-1'; -} -print '
'; - - $moreforfilter = ''; /*$moreforfilter.='
'; $moreforfilter.= $langs->trans('MyFilter') . ': '; @@ -525,19 +522,31 @@ foreach($object->fields as $key => $val) if (! empty($arrayfields['t.'.$key]['checked'])) { if ($key == 'type_code') { print ''; - $formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth200')); + $formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth150')); print ''; } elseif ($key == 'category_code') { print ''; - $formTicket->selectAnalyticCodesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth200')); + $formTicket->selectGroupTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth150')); print ''; } elseif ($key == 'severity_code') { print ''; - $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth200')); + $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth150')); print ''; + } elseif ($key == 'fk_user_assign') { + print ''; + print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css']?$val['css']:'maxwidth150')); + print ''; } elseif ($key == 'fk_statut') { - print ''; - print Form::multiselectarray('search_fk_statut', $object->statuts_short, $search[$key], 0, 0, '', 1, 0, '', '', ''); + $arrayofstatus = array(); + $arrayofstatus['openall']='-- '.$langs->trans('OpenAll').' --'; + foreach ($object->statuts_short as $key2 => $val2) + { + $arrayofstatus[$key2] = $val2; + if ($key2 == '6') $arrayofstatus['closeall']='-- '.$langs->trans('ClosedAll').' --'; + } + print ''; + //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, array_values($search[$key]), 0, 0, 'minwidth150', 1, 0, '', '', ''); print ''; } else { @@ -553,7 +562,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 ''; @@ -580,7 +589,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; print ''."\n"; @@ -610,6 +619,7 @@ while ($i < min($num, $limit)) { if (isset($obj->$key)) $object->$key = $obj->$key; } + $langs->load("ticket"); // Show here line of result print ''; @@ -629,7 +639,8 @@ while ($i < min($num, $limit)) print $val['css']; if ($cssforfield || $val['css']) print '"'; print '>'; - print $object->showOutputField($val, $key, $obj->$key, ''); + if ($key == 'fk_statut') print $object->getLibStatut(5); + else print $object->showOutputField($val, $key, $obj->$key, ''); print ''; if (! $i) $totalarray['nbfield']++; if (! empty($val['isameasure'])) @@ -646,7 +657,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -669,7 +680,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; else { if ($i == 1) diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 2366ac30610..5eb206057c3 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -260,16 +260,16 @@ if (! in_array($nowyear, $arrayyears)) $arrayyears[$nowyear]=$nowyear; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; -print ''; +print ''; print ''; print ''; print '

'; print '
'; -print ''; +print '
'; print ''; -print ''; +print ''; print ''; print ''; //print ''; @@ -287,7 +287,7 @@ foreach ($data as $val) $oldyear--; print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -299,7 +299,7 @@ foreach ($data as $val) print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -318,7 +318,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("Year").''.$langs->trans("NbOfTickets").'%'.$langs->trans("AmountTotal").'
0?'&userid='.$userid:'').'">'.$oldyear.'0?'&userid='.$userid:'').'">'.$oldyear.'00
0?'&userid='.$userid:'').'">'.$year.'0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'], 'MT'), 1).'
'; +print ''; } + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + print ''; + } + // EMail print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; + // Default warehouse + if (! empty($conf->stock->enabled)) + { + print ''; + } if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) @@ -1518,6 +1554,17 @@ else print ''; print ''."\n"; + // Default warehouse + if (! empty($conf->stock->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php'; + $warehousestatic=new Entrepot($db); + $warehousestatic->fetch($object->fk_warehouse); + print ''; + } + //$childids = $user->getAllChildIds(1); if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) @@ -1781,18 +1828,25 @@ else } } - // Activer + // Enable user if ($user->id <> $id && $candisableuser && $object->statut == 0 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { print ''; } - // Desactiver + // Disable user if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { print ''; } + else + { + if ($user->id == $id) + { + print ''; + } + } // Delete if ($user->id <> $id && $candisableuser && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) @@ -2286,7 +2340,7 @@ else print ''; } - // Skype + // Facebook if (! empty($conf->socialnetworks->enabled)) { print ''; @@ -2303,6 +2357,23 @@ else print ''; } + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + print ''; + } + // EMail print "".'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; + // Default warehouse + if (! empty($conf->stock->enabled)) + { + print ''; + } + if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a6bc202d17f..aeb43905b4f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -73,6 +73,7 @@ class User extends CommonObject public $skype; public $twitter; public $facebook; + public $linkedin; public $job; // job position public $signature; @@ -173,6 +174,8 @@ class User extends CommonObject public $default_c_exp_tax_cat; public $default_range; + + public $fk_warehouse; public $fields = array( 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), @@ -227,7 +230,7 @@ class User extends CommonObject $login=trim($login); // Get user - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.twitter, u.facebook,"; + $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.twitter, u.facebook, u.linkedin,"; $sql.= " u.signature, u.office_phone, u.office_fax, u.user_mobile,"; $sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; $sql.= " u.admin, u.login, u.note,"; @@ -248,6 +251,7 @@ class User extends CommonObject $sql.= " u.weeklyhours,"; $sql.= " u.color,"; $sql.= " u.dateemployment, u.dateemploymentend,"; + $sql.= " u.fk_warehouse,"; $sql.= " u.ref_int, u.ref_ext,"; $sql.= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode $sql.= " c.code as country_code, c.label as country,"; @@ -335,6 +339,7 @@ class User extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->job = $obj->job; $this->signature = $obj->signature; $this->admin = $obj->admin; @@ -368,6 +373,7 @@ class User extends CommonObject $this->default_range = $obj->default_range; $this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat; + $this->fk_warehouse = $obj->fk_warehouse; // Protection when module multicompany was set, admin was set to first entity and then, the module was disabled, // in such case, this admin user must be admin for ALL entities. @@ -1252,6 +1258,7 @@ class User extends CommonObject $this->skype = $contact->skype; $this->twitter = $contact->twitter; $this->facebook = $contact->facebook; + $this->linkedin = $contact->linkedin; $this->office_phone = $contact->phone_pro; $this->office_fax = $contact->fax; $this->user_mobile = $contact->phone_mobile; @@ -1469,6 +1476,7 @@ class User extends CommonObject $this->skype = trim($this->skype); $this->twitter = trim($this->twitter); $this->facebook = trim($this->facebook); + $this->linkedin = trim($this->linkedin); $this->job = trim($this->job); $this->signature = trim($this->signature); @@ -1482,6 +1490,7 @@ class User extends CommonObject $this->color = empty($this->color)?'':$this->color; $this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment; $this->dateemploymentend = empty($this->dateemploymentend)?'':$this->dateemploymentend; + $this->fk_warehouse = trim(empty($this->fk_warehouse)?'':$this->fk_warehouse); // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1521,6 +1530,7 @@ class User extends CommonObject $sql.= ", skype = '".$this->db->escape($this->skype)."'"; $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; + $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; @@ -1539,6 +1549,7 @@ class User extends CommonObject $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); $sql.= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); + $sql.= ", fk_warehouse = ".($this->fk_warehouse?"'".$this->db->escape($this->fk_warehouse)."'":"null"); $sql.= " WHERE rowid = ".$this->id; @@ -1609,6 +1620,7 @@ class User extends CommonObject $adh->skype=$this->skype; $adh->twitter=$this->twitter; $adh->facebook=$this->facebook; + $adh->linkedin=$this->linkedin; $adh->phone=$this->office_phone; $adh->phone_mobile=$this->user_mobile; @@ -1661,6 +1673,7 @@ class User extends CommonObject $tmpobj->skype=$this->skype; $tmpobj->twitter=$this->twitter; $tmpobj->facebook=$this->facebook; + $tmpobj->linkedin=$this->linkedin; $tmpobj->phone_pro=$this->office_phone; $tmpobj->phone_mobile=$this->user_mobile; @@ -1977,7 +1990,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } -$mailfile = new CMailFile( + $mailfile = new CMailFile( $subject, $this->email, $conf->global->MAIN_MAIL_EMAIL_FROM, @@ -2528,7 +2541,8 @@ $mailfile = new CMailFile( 'LDAP_FIELD_SID' => 'ldap_sid', 'LDAP_FIELD_SKYPE' => 'skype', 'LDAP_FIELD_TWITTER' => 'twitter', - 'LDAP_FIELD_FACEBOOK' => 'facebook' + 'LDAP_FIELD_FACEBOOK' => 'facebook', + 'LDAP_FIELD_LINKEDIN' => 'linkedin' ); // Champs @@ -2642,6 +2656,7 @@ $mailfile = new CMailFile( $this->skype='skypepseudo'; $this->twitter='twitterpseudo'; $this->facebook='facebookpseudo'; + $this->linkedin='linkedinpseudo'; $this->office_phone='0999999999'; $this->office_fax='0999999998'; $this->user_mobile='0999999997'; @@ -2796,6 +2811,7 @@ $mailfile = new CMailFile( $this->skype=$ldapuser->{$conf->global->LDAP_FIELD_SKYPE}; $this->twitter=$ldapuser->{$conf->global->LDAP_FIELD_TWITTER}; $this->facebook=$ldapuser->{$conf->global->LDAP_FIELD_FACEBOOK}; + $this->linkedin=$ldapuser->{$conf->global->LDAP_FIELD_LINKEDIN}; $this->ldap_sid=$ldapuser->{$conf->global->LDAP_FIELD_SID}; $this->job=$ldapuser->{$conf->global->LDAP_FIELD_TITLE}; diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index a41345820b4..25ee449b889 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -35,12 +35,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $canreadperms=($user->admin || $user->rights->user->user->lire); $caneditperms=($user->admin || $user->rights->user->user->creer); $candisableperms=($user->admin || $user->rights->user->user->supprimer); +$feature2 = 'user'; + // Advanced permissions if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadperms=($user->admin || $user->rights->user->group_advance->read); $caneditperms=($user->admin || $user->rights->user->group_advance->write); $candisableperms=($user->admin || $user->rights->user->group_advance->delete); + $feature2 = 'group_advance'; } // Load translation files required by page @@ -55,7 +58,7 @@ $contextpage = GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'groupc $userid = GETPOST('user', 'int'); // Security check -$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); +$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); // Users/Groups management only in master entity if transverse mode if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 5d8f0fe11ce..c53193411ff 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -1,7 +1,7 @@ - * Copyright (C) 2017 Laurent Destailleur - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2016 Marcos García + * Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,9 +29,9 @@ $langs->loadLangs(array("products", "other")); $id = GETPOST('id', 'int'); $valueid = GETPOST('valueid', 'int'); -$ref = GETPOST('ref'); -$weight_impact = (float) GETPOST('weight_impact'); -$price_impact = (float) GETPOST('price_impact'); +$ref = GETPOST('ref', 'alpha'); +$weight_impact = GETPOST('weight_impact', 'alpha'); +$price_impact = GETPOST('price_impact', 'alpha'); $price_impact_percent = (bool) GETPOST('price_impact_percent'); $form = new Form($db); @@ -763,7 +763,7 @@ if (! empty($id) || ! empty($ref)) '; + print ''; @@ -802,7 +802,7 @@ if (! empty($id) || ! empty($ref)) '; + print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); diff --git a/htdocs/ticket/tpl/linkedobjectblock.tpl.php b/htdocs/ticket/tpl/linkedobjectblock.tpl.php index 21fe9aa78d8..3391437dbb1 100644 --- a/htdocs/ticket/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticket/tpl/linkedobjectblock.tpl.php @@ -37,9 +37,9 @@ print load_fiche_titre($langs->trans('RelatedTickets')); - - - + + + trans("ShowTicket"), "ticket") . ' ' . (! empty($object->subject) ? ' '.$object->subject : ''); ?> - + socid = $object->fk_soc; $object->fetch_thirdparty(); ?> - - + +
trans("Subject"); ?>trans("DateCreation"); ?>trans("Customer"); ?>trans("Status"); ?>trans("DateCreation"); ?>trans("Customer"); ?>trans("Status"); ?>
datec, 'day'); ?>datec, 'day'); ?> thirdparty->getNomUrl(1); ?>getLibstatut(2); ?>thirdparty->getNomUrl(1); ?>getLibstatut(2); ?>
diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 9de64588931..46fc74626bb 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -48,6 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -91,7 +92,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); // Load translation files required by page -$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm')); +$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks')); $object = new User($db); $extrafields = new ExtraFields($db); @@ -214,6 +215,7 @@ if (empty($reshook)) { $object->skype = GETPOST("skype", 'alphanohtml'); $object->twitter = GETPOST("twitter", 'alphanohtml'); $object->facebook = GETPOST("facebook", 'alphanohtml'); + $object->linkedin = GETPOST("linkedin", 'alphanohtml'); $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha')); $object->job = GETPOST("job", 'alpha'); @@ -237,6 +239,8 @@ if (empty($reshook)) { $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth'), GETPOST('dateemploymentendday'), GETPOST('dateemploymentendyear')); $object->dateemploymentend = $dateemploymentend; + $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { @@ -364,6 +368,7 @@ if (empty($reshook)) { $object->skype = GETPOST("skype", 'alpha'); $object->twitter = GETPOST("twitter", 'alpha'); $object->facebook = GETPOST("facebook", 'alpha'); + $object->linkedin = GETPOST("linkedin", 'alpha'); $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha')); $object->job = GETPOST("job", 'alpha'); $object->signature = GETPOST("signature", 'none'); @@ -384,6 +389,11 @@ if (empty($reshook)) { $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth', 'int'), GETPOST('dateemploymentendday', 'int'), GETPOST('dateemploymentendyear', 'int')); $object->dateemploymentend = $dateemploymentend; + if (! empty($conf->stock->enabled)) + { + $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); + } + if (! empty($conf->multicompany->enabled)) { if (! empty($_POST["superadmin"])) @@ -606,6 +616,7 @@ if (empty($reshook)) { $ldap_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE]; $ldap_twitter = $attribute[$conf->global->LDAP_FIELD_TWITTER]; $ldap_facebook = $attribute[$conf->global->LDAP_FIELD_FACEBOOK]; + $ldap_linkedin = $attribute[$conf->global->LDAP_FIELD_LINKEDIN]; $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; } @@ -639,6 +650,7 @@ $form = new Form($db); $formother=new FormOther($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); +if (! empty($conf->stock->enabled)) $formproduct = new FormProduct($db); llxHeader('', $langs->trans("UserCard")); @@ -1067,6 +1079,23 @@ if ($action == 'create' || $action == 'adduserldap') print '
'.$langs->trans("LinkedIn").''; + if (! empty($ldap_linkedin)) + { + print ''; + print $ldap_linkedin; + } + else + { + print ''; + } + print '
'; @@ -1165,6 +1194,13 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print '
'.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print '
'.$object->job.'
'.$langs->trans("DefaultWarehouse").''; + print $warehousestatic->getNomUrl(); + print '
'.$langs->trans("Facebook").'
'.$langs->trans("LinkedIn").''; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->linkedin; + } + print '
'; @@ -2519,6 +2590,15 @@ else } print '
'.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ' '.$langs->trans("AddWarehouse").''; + print '
trans('OnBuy') ?> '; $searchpicto=$form->showCheckAddButtons('checkforselect', 1); print $searchpicto; print ' '; if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/test/phpunit/BillOfMaterialsTest.php b/test/phpunit/BillOfMaterialsTest.php new file mode 100644 index 00000000000..a03d8523b99 --- /dev/null +++ b/test/phpunit/BillOfMaterialsTest.php @@ -0,0 +1,110 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file test/unit/BillOfMaterialsTest.php + * \ingroup billofmaterials + * \brief PHPUnit test for BillOfMaterials class. + */ + +namespace test\unit; + +/** + * Class BillOfMaterialsTest + * @package Testbillofmaterials + */ +class BillOfMaterialsTest extends \PHPUnit_Framework_TestCase +{ + /** + * Global test setup + * @return void + */ + public static function setUpBeforeClass() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Unit test setup + * @return void + */ + protected function setUp() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Verify pre conditions + * @return void + */ + protected function assertPreConditions() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * A sample test + * @return bool + */ + public function testSomething() + { + fwrite(STDOUT, __METHOD__ . "\n"); + // TODO: test something + $this->assertTrue(true); + } + + /** + * Verify post conditions + * @return void + */ + protected function assertPostConditions() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Unit test teardown + * @return void + */ + protected function tearDown() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Global test teardown + * @return void + */ + public static function tearDownAfterClass() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Unsuccessful test + * + * @param Exception $e Exception + * @return void + * @throws Exception + */ + protected function onNotSuccessfulTest(Exception $e) + { + fwrite(STDOUT, __METHOD__ . "\n"); + throw $e; + } +}