diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml index 861f6ccd4b0..3cfc4f8ba23 100644 --- a/.github/workflows/exakat.yml +++ b/.github/workflows/exakat.yml @@ -13,5 +13,5 @@ jobs: - name: Exakat uses: docker://exakat/exakat-ga with: - ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant' - ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' \ No newline at end of file + ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant' + ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test' \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 0aa5594790a..639183de6ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,11 +108,11 @@ install: echo "Updating Composer" rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.lock + composer -V composer self-update - # To have composer making parallel downloads - composer global require hirak/prestissimo composer -n init composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes echo - | @@ -146,7 +146,10 @@ install: - | echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/vendor/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/vendor + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin echo @@ -177,7 +180,7 @@ before_script: # Check PHP echo "PHP version" php -i | head - - # Check Parallel-lin version + # Check Parallel-lint version echo "Parallel-lint version" which parallel-lint parallel-lint -V @@ -300,7 +303,7 @@ script: echo - | - echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also for some jobs to avoid duplicate tests)" + echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)" # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file diff --git a/doc/install/README-DE b/doc/install/README-DE index c7ece3891f3..047e1915d18 100644 --- a/doc/install/README-DE +++ b/doc/install/README-DE @@ -1,33 +1,45 @@ README (deutsch / german / allemand) --------------------------------- +------------------------------------ --------------------------------- +------------------------------------ Download / Herunterladen --------------------------------- +------------------------------------ * Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website + https://www.dolibarr.org/downloads - oder direkt von Sourceforge + + oder direkt bei Sourceforge + https://sourceforge.net/projects/dolibarr/files/ + herunterladen. - - -* Die meisten externen Module/Themens sind über den DoliStore verfügbar: - https://www.dolistore.com/de/ --------------------------------- -Installation --------------------------------- -* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis. +------------------------------------ +Installation / Hilfe +------------------------------------ + +* Für eine kurze Einleitung schau in die README Datei im Hauptverzeichnis. * Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden: https://wiki.dolibarr.org/index.php/Hauptseite * eine Deutsche Community bietet der Dolibarr e.V. unter https://www.dolibarr.de/ + + + + +------------------------------------ +Zusatzmodule +------------------------------------ + +* Die meisten externen Module/Themen sind über den offiziellen DoliStore verfügbar: + + https://www.dolistore.com/de/ - + diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 16aa51beded..b5620f3ec25 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -4,7 +4,7 @@ * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 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 @@ -41,7 +41,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 51577218eb9..8acf1f1b191 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -7,7 +7,8 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2020 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 @@ -39,7 +40,12 @@ $langs->loadLangs(array("admin", "members")); if (!$user->admin) accessforbidden(); -$type = array('yesno', 'texte', 'chaine'); +$choices = array('yesno', 'texte', 'chaine'); + +$value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scandir', 'alpha'); +$type = 'member'; $action = GETPOST('action', 'aZ09'); @@ -48,8 +54,50 @@ $action = GETPOST('action', 'aZ09'); * Actions */ -// -if ($action == 'updateall') { +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if ($action == 'set_default') { + $ret = addDocumentModel($value, $type, $label, $scandir); + $res = true; +} elseif ($action == 'del_default') { + $ret = delDocumentModel($value, $type); + if ($ret > 0) { + if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") { + dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity); + } + } + $res = true; +} elseif ($action == 'setdoc') { + // Set default model + if (dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity)) { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->MEMBER_ADDON_PDF_ODT = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) { + $ret = addDocumentModel($value, $type, $label, $scandir); + } + $res = true; +} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { + $code = $reg[1]; + if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { + $code = $reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} elseif ($action == 'updateall') { $db->begin(); $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); @@ -86,7 +134,7 @@ if ($action == 'update' || $action == 'add') { $consttype = GETPOST('consttype', 'alpha'); $constnote = GETPOST('constnote'); - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity); if (!$res > 0) $error++; @@ -245,6 +293,137 @@ $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL_ $helptext .= '__YEAR__, __MONTH__, __DAY__'; form_constantes($constantes, 0, $helptext); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + +// Defini tableau def des modeles +$def = array(); +$sql = "SELECT nom"; +$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql .= " WHERE type = '".$db->escape($type)."'"; +$sql .= " AND entity = ".$conf->entity; +$resql = $db->query($sql); +if ($resql) { + $i = 0; + $num_rows = $db->num_rows($resql); + while ($i < $num_rows) { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} else { + dol_print_error($db); +} + +print load_fiche_titre($langs->trans("MembersDocModules"), '', ''); + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) { + foreach (array('', '/doc') as $valdir) { + $dir = dol_buildpath($reldir."core/modules/member".$valdir); + if (is_dir($dir)) { + $handle = opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + $filelist[] = $file; + } + closedir($handle); + arsort($filelist); + foreach ($filelist as $file) { + if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { + if (file_exists($dir.'/'.$file)) { + $name = substr($file, 4, dol_strlen($file) - 14); + $classname = substr($file, 0, dol_strlen($file) - 10); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + $modulequalified = 0; + } + + if ($modulequalified) { + print ''; + + // Active + if (in_array($name, $def)) { + print ''; + } else { + print '"; + } + + // Defaut + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); + if ($module->type == 'pdf') { + $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); + $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name) ? $name : $module->name); + print "\n"; + if (method_exists($module, 'info')) { + print $module->info($langs); + } else { + print $module->description; + } + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print "'; + if ($conf->global->MEMBER_ADDON_PDF == $name) { + print img_picto($langs->trans("Default"), 'on'); + } else { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"), 'contract').''; + } else { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
'; +print "
"; print dol_get_fiche_end(); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bd3ad481cd8..fe6f27ef8b6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2020 Philippe Grand * Copyright (C) 2015-2018 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -1564,7 +1564,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); } else { if ($object->user_id) { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); + $linkeduser = new User($db); + $linkeduser->fetch($object->user_id); + print $linkeduser->getNomUrl(-1); } else { print $langs->trans("NoDolibarrAccess"); } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 009c73cf318..9bedb1a39ca 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2404,6 +2404,7 @@ class Adherent extends CommonObject global $conf, $langs; $info = array(); + $socialnetworks = getArrayOfSocialNetworks(); $keymodified = false; // Object classes @@ -2418,8 +2419,13 @@ class Adherent extends CommonObject } // Possible LDAP KEY (constname => varname) - $ldapkey = array('LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', 'LDAP_MEMBER_FIELD_NAME' => 'lastname', 'LDAP_MEMBER_FIELD_LOGIN' => 'login', 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login', - 'LDAP_MEMBER_FIELD_MAIL' => 'email'); + $ldapkey = array( + 'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', + 'LDAP_MEMBER_FIELD_NAME' => 'lastname', + 'LDAP_MEMBER_FIELD_LOGIN' => 'login', + 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login', + 'LDAP_MEMBER_FIELD_MAIL' => 'email' + ); // Member foreach ($ldapkey as $constname => $varname) { @@ -2439,10 +2445,11 @@ class Adherent extends CommonObject if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; 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->linkedin && !empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin; + foreach ($socialnetworks as $key => $value) { + if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) { + $info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']]; + } + } 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; @@ -2455,8 +2462,12 @@ class Adherent extends CommonObject // When password is modified if (!empty($this->pass)) { - if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + } + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) + } } // Set LDAP password if possible elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index e3006635b39..a3e015b2d44 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -378,9 +378,8 @@ if ($result) print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { - print ''.img_edit().''; - print '   '; - print ''.img_delete().''; + print ''.img_edit().''; + print ''.img_delete().''; } else { print ''; print ''; diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 00e8672f6d5..0bd03301389 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -221,7 +221,9 @@ class PrestaShopWebservice * Load XML from string. Can throw exception * * @param string $response String from a CURL response - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response + * + * @throw PrestaShopWebserviceException */ protected function parseXML($response) { @@ -250,7 +252,9 @@ class PrestaShopWebservice * Examples are given in the tutorial

* * @param array $options Options - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response + * + * @throw PrestaShopWebserviceException */ public function add($options) { @@ -268,10 +272,10 @@ class PrestaShopWebservice } else { throw new PrestaShopWebserviceException('Bad parameters given'); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); - self::checkStatusCode($request['status_code']); - return self::parseXML($request['response']); + $this->checkStatusCode($request['status_code']); + return $this->parseXML($request['response']); } /** @@ -300,7 +304,9 @@ class PrestaShopWebservice * ?> * * @param array $options Array representing resource to get. - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response + * + * @throw PrestaShopWebserviceException */ public function get($options) { @@ -326,9 +332,9 @@ class PrestaShopWebservice throw new PrestaShopWebserviceException('Bad parameters given '); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); - self::checkStatusCode($request['status_code']); // check the response validity - return self::parseXML($request['response']); + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); + $this->checkStatusCode($request['status_code']); // check the response validity + return $this->parseXML($request['response']); } /** @@ -336,6 +342,8 @@ class PrestaShopWebservice * * @param array $options Array representing resource for head request. * @return SimpleXMLElement status_code, response + * + * @throw PrestaShopWebserviceException */ public function head($options) { @@ -358,8 +366,8 @@ class PrestaShopWebservice } else { throw new PrestaShopWebserviceException('Bad parameters given'); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); - self::checkStatusCode($request['status_code']); // check the response validity + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); + $this->checkStatusCode($request['status_code']); // check the response validity return $request['header']; } /** @@ -371,7 +379,9 @@ class PrestaShopWebservice * Examples are given in the tutorial

* * @param array $options Array representing resource to edit. - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response + * + * @throw PrestaShopWebserviceException */ public function edit($options) { @@ -390,9 +400,9 @@ class PrestaShopWebservice throw new PrestaShopWebserviceException('Bad parameters given'); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); - self::checkStatusCode($request['status_code']); // check the response validity - return self::parseXML($request['response']); + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); + $this->checkStatusCode($request['status_code']); // check the response validity + return $this->parseXML($request['response']); } } diff --git a/htdocs/admin/dolistore/class/index.html b/htdocs/admin/dolistore/class/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/admin/dolistore/class/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/admin/dolistore/index.html b/htdocs/admin/dolistore/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/admin/dolistore/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index b75606f739c..7af8d547a0c 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -118,7 +118,7 @@ foreach ($eventstolog as $key => $arr) print ''.$arr['id'].''; print ''; $key = 'MAIN_LOGEVENTS_'.$arr['id']; - $value = $conf->global->$key; + $value = empty($conf->global->$key) ? '' : $conf->global->$key; print ''; print ''."\n"; } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 75681ad36c0..4008fad141d 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -51,35 +51,33 @@ if ($cancel) { if ($action == 'update') { - dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 6fc37f45734..134aeb663b4 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -483,13 +483,15 @@ if ($virtualdiffersfromphysical) print ''."\n"; print ''; - print ''.$langs->trans("UseVirtualStockByDefault").''; + print ''; + print $form->textwithpicto($langs->trans("UseRealStockByDefault"), $langs->trans("ReplenishmentCalculation")); + print ''; print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); + print ajax_constantonoff('STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); + print $form->selectarray("STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval, $conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT); } print "\n"; print "\n"; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 11d0dbc49cf..78146b85a76 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -105,36 +105,21 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["main print ''; print 'Sessions support'; - if (!function_exists("session_id")) { print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); } else { print 'Ok '.$langs->trans("PHPSupportSessions"); } - print ''; print 'UTF-8 support'; - if (!function_exists("utf8_encode")) { print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8"); } else { print 'Ok '.$langs->trans("PHPSupport", "UTF8"); } - -print ''; - -print 'MBString support'; - -if (!function_exists("mb_check_encoding")) -{ - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring"); -} else { - print 'Ok '.$langs->trans("PHPSupport", "mbstring"); -} - print ''; print ''; @@ -153,6 +138,28 @@ print ''.$langs->trans("FunctionTest").''; print ''.$langs->trans("Result").''; print ''; +$functions = ["mb_check_encoding"]; +$name = "MBString"; + +print ""; +print "".$name.""; +//print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; + +$functions = ["json_decode"]; +$name = "JSON"; + +print ""; +print "".$name.""; +//print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; + $functions = ["imagecreate"]; $name = "GD"; @@ -186,7 +193,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc print getTableColumn($name, $loadedExtensions); print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); - print ""; } @@ -225,7 +231,7 @@ foreach ($phparray as $key => $value) print ''.$keyparam.''; $valtoshow = $keyvalue; if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80); - print ''; + print ''; if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow))); @@ -425,7 +431,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function } $html = ""; - $html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name); + $html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport".$name); $html .= ""; return $html; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 2f0978ed266..f978c0dcd81 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; // Load translation files required by the page $langs->loadLangs(array("install", "other", "admin")); @@ -52,7 +53,7 @@ print load_fiche_titre($langs->trans("Security"), '', 'title_setup'); print ''.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').' ('.$langs->trans("Reload").')
'; print '
'; -print load_fiche_titre($langs->trans("PHPSetup"), '', ''); +print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder'); // Get version of PHP $phpversion = version_php(); @@ -77,7 +78,7 @@ else { print '
'; print '
'; -print load_fiche_titre($langs->trans("ConfigFile"), '', ''); +print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder'); print ''.$langs->trans("dolibarr_main_prod").': '.$dolibarr_main_prod; if (empty($dolibarr_main_prod)) { @@ -94,7 +95,7 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("Permissions"), '', ''); +print load_fiche_titre($langs->trans("Permissions"), '', 'folder'); print ''.$langs->trans("PermissionsOnFilesInWebRoot").': '; // TODO Check permission are read only except for custom dir @@ -109,7 +110,7 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("DolibarrModules"), '', ''); +print load_fiche_titre($langs->trans("Modules"), '', 'folder'); // Module log print ''.$langs->trans("Syslog").': '; @@ -133,10 +134,12 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', ''); +print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder'); //print ''.$langs->trans("PasswordEncryption").': '; -print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."   (Recommanded value: 'password_hash')
"; +print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')."   "; +print '   If unset: \'md5\' '; +print ' - Recommanded value: \'password_hash\'
'; print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT.'
'; print '
'; // TODO @@ -153,10 +156,20 @@ print '
'; print '
'; -print ''.$langs->trans("SecurityAudit").': '; -// TODO Disabled or enabled ? -print '
'; +$securityevent = new Events($db); +$eventstolog = $securityevent->eventstolog; +print ''.$langs->trans("LogEvents").': '; +// Loop on each event type +foreach ($eventstolog as $key => $arr) +{ + if ($arr['id']) + { + $key = 'MAIN_LOGEVENTS_'.$arr['id']; + $value = empty($conf->global->$key) ? '' : $conf->global->$key; + if ($value) print $key.', '; + } +} diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index a96ea4e16aa..ea39cc1dce9 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2020 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,6 +43,8 @@ $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scandir', 'alpha'); $type = 'user'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index b838aac8cd9..192acc22d83 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -92,8 +92,10 @@ class BOM extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1), - 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), + //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassembly')), + 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), + 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), @@ -113,6 +115,7 @@ class BOM extends CommonObject public $rowid; public $ref; public $label; + public $bomtype; public $description; public $note_public; public $note_private; diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 19736d4b46a..d97056470f1 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -32,7 +32,7 @@ $conf_db_base = $dolibarr_main_db_name; $conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0); // Identifiant unique correspondant a l'entrepot a utiliser $conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0); -if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable stock decrease is on, we set warehouse id to 0. +if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0. // Identifiant unique correspondant au compte caisse / liquide $conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0); @@ -46,6 +46,3 @@ $conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSI // View parameters $conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes - -// Add hidden option to force decrease of stock whatever is user setup -if (!empty($conf->global->CASHDESK_FORCE_STOCK_ON_BILL)) $conf->global->STOCK_CALCULATE_ON_BILL = 1; diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 01afdb8a49c..3b932b2f59c 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -43,16 +43,36 @@ class CActionComm */ public $id; + /** + * @var string code + */ public $code; + + /** + * @var string type + */ public $type; - public $libelle; // deprecated + + /** + * @var string label + * @deprecated + * @see $label + */ + public $libelle; /** * @var string Type of agenda event label */ public $label; + /** + * @var int active + */ public $active; + + /** + * @var string color hex + */ public $color; /** @@ -60,6 +80,9 @@ class CActionComm */ public $picto; + /** + * @var array array of type_actions + */ public $type_actions = array(); @@ -76,14 +99,14 @@ class CActionComm /** * Load action type from database * - * @param int $id id or code of action type to read - * @return int 1=ok, 0=not found, -1=error + * @param int|string $id id or code of action type to read + * @return int 1=ok, 0=not found, -1=error */ public function fetch($id) { $sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; - if (is_numeric($id)) $sql .= " WHERE id=".$id; + if (is_numeric($id)) $sql .= " WHERE id=".(int) $id; else $sql .= " WHERE code='".$this->db->escape($id)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -138,7 +161,9 @@ class CActionComm $sql = "SELECT id, code, libelle as label, module, type, color, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql .= " WHERE 1=1"; - if ($active != '') $sql .= " AND active=".$active; + if ($active != '') { + $sql .= " AND active=".(int) $active; + } if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'"; if ($morefilter) $sql .= " AND ".$morefilter; $sql .= " ORDER BY module, position, type"; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9977910518b..3a80ae22306 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -171,19 +171,21 @@ if (empty($reshook)) GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int') ); - if (!empty($object->date_livraison) && !empty($date_delivery)) + $date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + if (!empty($date_delivery_old) && !empty($date_delivery)) { //Attempt to get the date without possible hour rounding errors $old_date_delivery = dol_mktime(12, 0, 0, - dol_print_date($object->date_livraison, '%m'), - dol_print_date($object->date_livraison, '%d'), - dol_print_date($object->date_livraison, '%Y') + dol_print_date($date_delivery_old, '%m'), + dol_print_date($date_delivery_old, '%d'), + dol_print_date($date_delivery_old, '%Y') ); //Calculate the difference and apply if necessary $difference = $date_delivery - $old_date_delivery; if ($difference != 0) { $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; foreach ($object->lines as $line) { if (isset($line->date_start)) $line->date_start = $line->date_start + $difference; @@ -340,7 +342,9 @@ if (empty($reshook)) if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) { $object->ref = GETPOST('ref'); $object->datep = $datep; - $object->date_livraison = $date_delivery; + $object->date = $datep; + $object->date_livraison = $date_delivery; // deprecated + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -354,8 +358,9 @@ if (empty($reshook)) $object->socid = GETPOST('socid', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); - $object->model_pdf = GETPOST('model'); + $object->model_pdf = GETPOST('model', 'alphanohtml'); $object->author = $user->id; // deprecated + $object->user_author_id = $user->id; $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); $object->statut = Propal::STATUS_DRAFT; @@ -371,7 +376,9 @@ if (empty($reshook)) $object->ref = GETPOST('ref'); $object->ref_client = GETPOST('ref_client'); $object->datep = $datep; + $object->date = $datep; $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id', 'int'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -1822,8 +1829,8 @@ if ($action == 'create') // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) ); - if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { - $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); + if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { + $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); } // Incomplete payment. We ask if reason = discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); @@ -2047,9 +2054,9 @@ if ($action == 'create') // Delivery date $langs->load('deliveries'); print ''; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d81c0fd288a..4f2159a200e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -152,9 +152,15 @@ class Propal extends CommonObject public $datep; /** - * @var integer|string $delivery_date; + * @var int Date expected for delivery + * @deprecated */ - public $delivery_date; + public $date_livraison; // deprecated; Use delivery_date instead. + + /** + * @var integer|string $delivery_date; + */ + public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) public $fin_validite; @@ -985,6 +991,9 @@ class Propal extends CommonObject $this->multicurrency_tx = 1; } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + dol_syslog(get_class($this)."::create"); // Check parameters @@ -1072,7 +1081,7 @@ class Propal extends CommonObject $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", '".$this->db->escape($this->ref_client)."'"; - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL"); + $sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".$this->availability_id; $sql .= ", ".$this->demand_reason_id; @@ -1435,7 +1444,7 @@ class Propal extends CommonObject $sql .= ", p.date_valid as datev"; $sql .= ", p.datep as dp"; $sql .= ", p.fin_validite as dfv"; - $sql .= ", p.date_livraison as date_livraison"; + $sql .= ", p.date_livraison as delivery_date"; $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; @@ -1517,7 +1526,8 @@ class Propal extends CommonObject $this->date = $this->db->jdate($obj->dp); // Proposal date $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); - $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; @@ -2104,6 +2114,7 @@ class Propal extends CommonObject { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -3566,16 +3577,24 @@ class Propal extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_client)) + } + if (!empty($this->ref_client)) { $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e69b2dfb8da..cb629e2c1f9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -120,6 +120,8 @@ if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WA $error = 0; +$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + /* * Actions @@ -274,7 +276,8 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated + $object->delivery_date = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); @@ -538,10 +541,10 @@ if (empty($reshook)) } } elseif ($action == 'setdate_livraison' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->setDeliveryDate($user, $datedelivery); + $result = $object->setDeliveryDate($user, $date_delivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -1506,7 +1509,8 @@ if ($action == 'create' && $usercancreate) $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); + if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); if (!empty($conf->multicurrency->enabled)) { @@ -1619,8 +1623,7 @@ if ($action == 'create' && $usercancreate) // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -2137,12 +2140,12 @@ if ($action == 'create' && $usercancreate) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a86a751dcb5..3f6c9d956a5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -180,6 +180,12 @@ class Commande extends CommonOrder */ public $date_commande; + /** + * @var int Date expected for delivery + * @deprecated + */ + public $date_livraison; // deprecated; Use delivery_date instead. + public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) /** @@ -880,8 +886,9 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - // $date_commande is deprecated + // Set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); @@ -954,7 +961,7 @@ class Commande extends CommonOrder $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", ".($this->availability_id > 0 ? $this->availability_id : "null"); $sql .= ", ".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null"); - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL'); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL'); @@ -1353,7 +1360,8 @@ class Commande extends CommonOrder $this->fk_account = $object->fk_account; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; + $this->date_livraison = $object->date_livraison; // deprecated + $this->delivery_date = $object->date_livraison; $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; $this->fk_delivery_address = $object->fk_delivery_address; @@ -1777,7 +1785,7 @@ class Commande extends CommonOrder $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql .= ', c.fk_account'; $sql .= ', c.date_commande, c.date_valid, c.tms'; - $sql .= ', c.date_livraison'; + $sql .= ', c.date_livraison as delivery_date'; $sql .= ', c.fk_shipping_method'; $sql .= ', c.fk_warehouse'; $sql .= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; @@ -1863,7 +1871,8 @@ class Commande extends CommonOrder $this->availability = $obj->availability_label; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; - $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $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->fk_delivery_address = $obj->fk_delivery_address; @@ -2005,7 +2014,7 @@ class Commande extends CommonOrder $sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql .= ' l.fk_unit,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,'; + $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch,'; $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units'; $sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; @@ -2068,6 +2077,8 @@ class Commande extends CommonOrder $line->libelle = $objp->product_label; $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; + $line->product_tosell = $objp->product_tosell; + $line->product_tobuy = $objp->product_tobuy; $line->product_tobatch = $objp->product_tobatch; $line->fk_product_type = $objp->fk_product_type; // Produit ou service $line->fk_unit = $objp->fk_unit; @@ -2595,6 +2606,7 @@ class Commande extends CommonOrder { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -3495,7 +3507,9 @@ class Commande extends CommonOrder $generic_commande->statut = $obj->fk_statut; $generic_commande->date_commande = $this->db->jdate($obj->date_commande); + $generic_commande->date = $this->db->jdate($obj->date_commande); $generic_commande->date_livraison = $this->db->jdate($obj->delivery_date); + $generic_commande->delivery_date = $this->db->jdate($obj->delivery_date); if ($generic_commande->hasDelay()) { $response->nbtodolate++; @@ -3649,6 +3663,9 @@ class Commande extends CommonOrder if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $linkclose = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 05c6089bfff..3e7a8d416cf 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -931,7 +931,8 @@ if ($resql) $generic_commande->statut = $obj->fk_statut; $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); - $generic_commande->date_livraison = $db->jdate($obj->date_delivery); + $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated + $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; $generic_commande->total_ht = $obj->total_ht; $generic_commande->total_tva = $obj->total_tva; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 437516df50b..f8b978ca4c8 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1093,7 +1093,7 @@ if ($resql) } print ''; - print ''; + print ''; print ' '."\n"; } @@ -7364,8 +7331,7 @@ abstract class CommonObject */ protected function isArray($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['type']) && $info['type'] == 'array') return true; else return false; } @@ -7392,8 +7358,7 @@ abstract class CommonObject */ public function isDuration($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['type']) && ($info['type'] == 'duration')) return true; else return false; } else return false; @@ -7407,8 +7372,7 @@ abstract class CommonObject */ public function isInt($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['type']) && ($info['type'] == 'int' || preg_match('/^integer/i', $info['type']))) return true; else return false; } else return false; @@ -7422,8 +7386,7 @@ abstract class CommonObject */ public function isFloat($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['type']) && (preg_match('/^(double|real|price)/i', $info['type']))) return true; else return false; } @@ -7438,8 +7401,7 @@ abstract class CommonObject */ public function isText($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['type']) && $info['type'] == 'text') return true; else return false; } @@ -7454,8 +7416,7 @@ abstract class CommonObject */ protected function canBeNull($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['notnull']) && $info['notnull'] != '1') return true; else return false; } @@ -7470,8 +7431,7 @@ abstract class CommonObject */ protected function isForcedToNullIfZero($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['notnull']) && $info['notnull'] == '-1') return true; else return false; } @@ -7486,8 +7446,7 @@ abstract class CommonObject */ protected function isIndex($info) { - if (is_array($info)) - { + if (is_array($info)) { if (isset($info['index']) && $info['index'] == true) return true; else return false; } @@ -7574,8 +7533,7 @@ abstract class CommonObject { foreach ($this->fields as $field => $info) { - if ($this->isDate($info)) - { + if ($this->isDate($info)) { if (empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0; else $this->{$field} = strtotime($obj->{$field}); } elseif ($this->isArray($info)) @@ -7587,12 +7545,10 @@ abstract class CommonObject } else { $this->{$field} = array(); } - } elseif ($this->isInt($info)) - { + } elseif ($this->isInt($info)) { if ($field == 'rowid') $this->id = (int) $obj->{$field}; else { - if ($this->isForcedToNullIfZero($info)) - { + if ($this->isForcedToNullIfZero($info)) { if (empty($obj->{$field})) $this->{$field} = null; else $this->{$field} = (double) $obj->{$field}; } else { @@ -7603,10 +7559,8 @@ abstract class CommonObject } } } - } elseif ($this->isFloat($info)) - { - if ($this->isForcedToNullIfZero($info)) - { + } elseif ($this->isFloat($info)) { + if ($this->isForcedToNullIfZero($info)) { if (empty($obj->{$field})) $this->{$field} = null; else $this->{$field} = (double) $obj->{$field}; } else { @@ -8365,8 +8319,8 @@ abstract class CommonObject /** * Trim object parameters - * @param string[] $parameters array of parameters to trim * + * @param string[] $parameters array of parameters to trim * @return void */ public function trimParameters($parameters) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c41c61be536..380b7a1ad17 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1035,10 +1035,9 @@ class FormFile public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1) { // phpcs:enable - global $user, $conf, $langs, $hookmanager; + global $user, $conf, $langs, $hookmanager, $form; global $sortfield, $sortorder, $maxheightmini; global $dolibarr_main_url_root; - global $form; if ($disablecrop == -1) { @@ -1222,7 +1221,6 @@ class FormFile // Size $sizetoshow = dol_print_size($file['size'], 1, 1); $sizetoshowbytes = dol_print_size($file['size'], 0, 1); - print ''; if ($sizetoshow == $sizetoshowbytes) print $sizetoshow; else { @@ -1407,9 +1405,9 @@ class FormFile // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Show list of documents in a directory + * Show list of documents in a directory of ECM module. * - * @param string $upload_dir Directory that was scanned + * @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files * @param array $filearray Array of files loaded by dol_dir_list function before calling this function * @param string $modulepart Value for modulepart used by download wrapper * @param string $param Parameters on sort links @@ -1427,9 +1425,10 @@ class FormFile public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permissiontodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0) { // phpcs:enable - global $user, $conf, $langs, $form; + global $user, $conf, $langs, $hookmanager, $form; global $sortfield, $sortorder; global $search_doc_ref; + global $dolibarr_main_url_root; dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart); @@ -1547,6 +1546,23 @@ class FormFile $object_instance = new Mo($this->db); } + //var_dump($filearray); + + // Get list of files stored into database for same relative directory + $relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir); + if ($relativepathfromroot) + { + completeFileArrayWithDatabaseInfo($filearray, $relativepathfromroot.'/%'); + + //var_dump($sortfield.' - '.$sortorder); + if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + { + $filearray = dol_sort_array($filearray, $sortfield, $sortorder); + } + } + + //var_dump($filearray); + foreach ($filearray as $key => $file) { if (!is_dir($file['name']) @@ -1558,7 +1574,7 @@ class FormFile // Define relative path used to store the file $relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']); - $id = 0; $ref = ''; $label = ''; + $id = 0; $ref = ''; // To show ref or specific information according to view to show (defined by $module) $reg = array(); @@ -1590,7 +1606,7 @@ class FormFile { $found = 1; } else { - //print 'Fetch '.$id." - ".$ref.'
'; + //print 'Fetch '.$id." - ".$ref.' class='.get_class($object_instance).'
'; if ($id) { $result = $object_instance->fetch($id); @@ -1619,13 +1635,12 @@ class FormFile else print $langs->trans("ObjectDeleted", ($id ? $id : $ref)); //$modulesubdir=dol_sanitizeFileName($ref); - $modulesubdir = dirname($relativefile); + //$modulesubdir = dirname($relativefile); //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); - $filedir = $file['path']; + //$filedir = $file['path']; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //print $formfile->getDocumentsLink($modulepart, $filename, $filedir); - print ''; // File @@ -1639,12 +1654,43 @@ class FormFile print ''; //print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$'); + print $this->showPreview($file, $modulepart, $file['relativename']); print "\n"; - print ''.dol_print_size($file['size'], 1, 1).''; + + // Size + $sizetoshow = dol_print_size($file['size'], 1, 1); + $sizetoshowbytes = dol_print_size($file['size'], 0, 1); + print ''; + if ($sizetoshow == $sizetoshowbytes) print $sizetoshow; + else { + print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1); + } + print ''; + + // Date print ''.dol_print_date($file['date'], "dayhour").''; + + // Share link print ''; + if ($file['share']) { + // 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 + + //print ''.$langs->trans("Hash").' : '.$file['share'].''; + $forcedownload = 0; + $paramlink = ''; + if (!empty($file['share'])) $paramlink .= ($paramlink ? '&' : '').'hashp='.$file['share']; // Hash for public share + if ($forcedownload) $paramlink .= ($paramlink ? '&' : '').'attachment=1'; + + $fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : ''); + + print img_picto($langs->trans("FileSharedViaALink"), 'globe').' '; + print ''; + } //if (! empty($useinecm) && $useinecm != 6) print ''; diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index 0d382a78589..b2a265c47d5 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -101,7 +101,7 @@ class SimpleOpenID /** * SetRequiredFields * - * @param string $a Server + * @param string|array $a Server * @return void */ public function SetRequiredFields($a) @@ -118,7 +118,7 @@ class SimpleOpenID /** * SetOptionalFields * - * @param string $a Server + * @param string|array $a Server * @return void */ public function SetOptionalFields($a) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index dd74ce70a64..0be1cfbc3bc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -228,8 +228,12 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s $sql .= " date_c, tms as date_m, fk_user_c, fk_user_m, acl, position, share"; if ($mode) $sql .= ", description"; $sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; - $sql .= " WHERE filepath = '".$db->escape($path)."'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " WHERE entity = ".$conf->entity; + if (preg_match('/%$/', $path)) { + $sql .= " AND filepath LIKE '".$db->escape($path)."'"; + } else { + $sql .= " AND filepath = '".$db->escape($path)."'"; + } $resql = $db->query($sql); if ($resql) @@ -242,6 +246,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s $obj = $db->fetch_object($resql); if ($obj) { + $reg = array(); preg_match('/([^\/]+)\/[^\/]+$/', DOL_DATA_ROOT.'/'.$obj->filepath.'/'.$obj->filename, $reg); $level1name = (isset($reg[1]) ? $reg[1] : ''); $file_list[] = array( @@ -289,7 +294,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s * Complete $filearray with data from database. * This will call doldir_list_indatabase to complate filearray. * - * @param array $filearray Array of files get using dol_dir_list + * @param array $filearray Array of files obtained using dol_dir_list * @param string $relativedir Relative dir from DOL_DATA_ROOT * @return void */ @@ -315,19 +320,19 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) } } - //var_dump($filearray); - //var_dump($filearrayindatabase); + /*var_dump($relativedir); + var_dump($filearray); + var_dump($filearrayindatabase);*/ // Complete filearray with properties found into $filearrayindatabase foreach ($filearray as $key => $val) { $tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']); - $found = 0; // Search if it exists into $filearrayindatabase foreach ($filearrayindatabase as $key2 => $val2) { - if ($filearrayindatabase[$key2]['name'] == $tmpfilename) + if (($filearrayindatabase[$key2]['path'] == $filearray[$key]['path']) && ($filearrayindatabase[$key2]['name'] == $tmpfilename)) { $filearray[$key]['position_name'] = ($filearrayindatabase[$key2]['position'] ? $filearrayindatabase[$key2]['position'] : '0').'_'.$filearrayindatabase[$key2]['name']; $filearray[$key]['position'] = $filearrayindatabase[$key2]['position']; @@ -348,6 +353,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) $filearray[$key]['acl'] = ''; $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filearray[$key]['fullname']); + if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filename)) // If not a tmp file { dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it"); @@ -379,8 +385,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) } } } - - /*var_dump($filearray);*/ + //var_dump($filearray); var_dump($relativedir.' - tmpfilename='.$tmpfilename.' - found='.$found); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 18d98ffd8a0..76ed140870f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3190,7 +3190,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building', 'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cubes', - 'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'external-link-alt', 'external-link-square-alt', + 'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group', 'help', 'holiday', 'intervention', 'label', 'language', 'list', 'listlight', 'lot', @@ -6260,7 +6260,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '')) : ''); $birthday = dol_print_date($object->birth, 'day'); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 09232fbd012..909e51dc6d7 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -90,16 +90,6 @@ function product_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id; - $head[$h][1] = $langs->trans('Statistics'); - $head[$h][2] = 'stats'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id; - $head[$h][1] = $langs->trans('Referers'); - $head[$h][2] = 'referers'; - $h++; - if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { global $db; @@ -149,6 +139,16 @@ function product_prepare_head($object) } } + $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id; + $head[$h][1] = $langs->trans('Referers'); + $head[$h][2] = 'referers'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id; + $head[$h][1] = $langs->trans('Statistics'); + $head[$h][2] = 'stats'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index ee2dc1cd095..dc7766dbdfa 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -239,7 +239,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ } print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index c464d36c5c1..9277ebbd81b 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -137,7 +137,7 @@ function user_prepare_head($object) if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)) || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) - || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all)) + || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall)) ) { // Bank $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8f7501e3fce..ab6c072b1be 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1800,7 +1800,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); } $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); } diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 56c538af8a6..e4531140f8f 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -93,7 +93,7 @@ class pdf_ban extends ModeleBankAccountDoc /** * Fonction generant le projet sur le disque * - * @param Project $object Object project a generer + * @param Account $object Object Account to generate * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ @@ -114,8 +114,7 @@ class pdf_ban extends ModeleBankAccountDoc //$nblines = count($object->lines); // This is set later with array of tasks // Definition of $dir and $file - if ($object->specimen) - { + if ($object->specimen) { $dir = $conf->bank->dir_output; $file = $dir."/SPECIMEN.pdf"; } else { @@ -151,7 +150,7 @@ class pdf_ban extends ModeleBankAccountDoc $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -293,7 +292,7 @@ class pdf_ban extends ModeleBankAccountDoc * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Project $object Object to show + * @param Account $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -378,7 +377,7 @@ class pdf_ban extends ModeleBankAccountDoc * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Project $object Object to show + * @param Account $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return integer @@ -388,7 +387,7 @@ class pdf_ban extends ModeleBankAccountDoc // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; //return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 2b8987958f4..a07592d339a 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -90,16 +90,16 @@ class pdf_sepamandate extends ModeleBankAccountDoc // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Fonction generant le projet sur le disque + * Function to create pdf of company bank account sepa mandate * - * @param Project $object Object project a generer - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details (not used for this template) - * @param int $hidedesc Do not show desc (not used for this template) - * @param int $hideref Do not show ref (not used for this template) - * @param null|array $moreparams More parameters - * @return int 1 if OK, <=0 if KO + * @param CompanyBankAccount $object Object bank account to generate document for + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details (not used for this template) + * @param int $hidedesc Do not show desc (not used for this template) + * @param int $hideref Do not show ref (not used for this template) + * @param null|array $moreparams More parameters + * @return int 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -157,7 +157,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -447,10 +447,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $posy Y - * @param Translate $outputlangs Langs object + * @param TCPDF $pdf Object PDF + * @param CompanyBankAccount $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object * @return void */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) @@ -485,11 +485,11 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Show area for the customer to sign * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice - * @param int $posy Position depart - * @param Translate $outputlangs Objet langs - * @return int Position pour suite + * @param TCPDF $pdf Object PDF + * @param CompanyBankAccount $object Object invoice + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ protected function _signature_area(&$pdf, $object, $posy, $outputlangs) { @@ -527,10 +527,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Show top header of page. * - * @param TCPDF $pdf Object PDF - * @param Project $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output + * @param TCPDF $pdf Object PDF + * @param CompanyBankAccount $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output * @return void */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) @@ -615,20 +615,20 @@ class pdf_sepamandate extends ModeleBankAccountDoc // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** - * Show footer of page. Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Project $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return integer + * @param TCPDF $pdf PDF + * @param CompanyBankAccount $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return integer */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 17ae82145df..f3ea817fa73 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -132,7 +132,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -399,9 +399,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $default_font_size = pdf_getPDFFontSize($outputlangs); - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; // Line of free text $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index da95eeabb19..114a3906392 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -7,7 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2018 Ferran Marcet - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 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 @@ -204,7 +204,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Commande $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -280,7 +280,7 @@ class pdf_einstein extends ModelePDFCommandes $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -343,7 +343,7 @@ class pdf_einstein extends ModelePDFCommandes // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -655,7 +655,7 @@ class pdf_einstein extends ModelePDFCommandes * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object order + * @param Commande $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -671,7 +671,7 @@ class pdf_einstein extends ModelePDFCommandes * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int @@ -741,7 +741,7 @@ class pdf_einstein extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -750,12 +750,12 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; - } elseif ($object->availability_code || $object->availability) // Show availability conditions - { + } elseif ($object->availability_code || $object->availability) { + // Show availability conditions $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; @@ -859,7 +859,7 @@ class pdf_einstein extends ModelePDFCommandes * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Commande $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -1242,7 +1242,7 @@ class pdf_einstein extends ModelePDFCommandes * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -1495,7 +1495,7 @@ class pdf_einstein extends ModelePDFCommandes * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1504,7 +1504,7 @@ class pdf_einstein extends ModelePDFCommandes { // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 73410935540..1f266851a0c 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -7,7 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 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 @@ -188,7 +188,7 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Commande $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -381,7 +381,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -876,7 +876,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object order + * @param Commande $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -889,7 +889,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int Pos y @@ -958,7 +958,7 @@ class pdf_eratosthene extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -967,7 +967,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1074,8 +1074,8 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Commande $object Object to show * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -1404,7 +1404,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -1658,7 +1658,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1667,7 +1667,7 @@ class pdf_eratosthene extends ModelePDFCommandes { // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } @@ -1676,7 +1676,7 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Define Array Column Field * - * @param object $object common object + * @param Commande $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index d1df957b453..fa555db2ced 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -63,7 +63,7 @@ class pdf_proforma extends pdf_eratosthene * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 264d48449e2..08fefaf5634 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -6,7 +6,7 @@ * Copyright (C) 2011 Fabrice CHERRIER * Copyright (C) 2013-2020 Philippe Grand * Copyright (C) 2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -164,8 +164,8 @@ class pdf_strato extends ModelePDFContract /** * Function to build pdf onto disk * - * @param CommonObject $object Id of object to generate - * @param object $outputlangs Lang output object + * @param Contrat $object Object to generate + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc @@ -226,7 +226,7 @@ class pdf_strato extends ModelePDFContract $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -580,7 +580,7 @@ class pdf_strato extends ModelePDFContract * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param CommonObject $object Object to show + * @param Contrat $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -756,7 +756,7 @@ class pdf_strato extends ModelePDFContract * Show footer of page. Need this->emetteur object * * @param PDF $pdf PDF - * @param CommonObject $object Object to show + * @param Contrat $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return integer @@ -764,7 +764,7 @@ class pdf_strato extends ModelePDFContract protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 08c354562c8..e6da731fb21 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -285,7 +285,7 @@ class pdf_storm extends ModelePDFDeliveryOrder $heightforinfotot = 30; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -346,7 +346,7 @@ class pdf_storm extends ModelePDFDeliveryOrder // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -652,7 +652,7 @@ class pdf_storm extends ModelePDFDeliveryOrder * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -730,7 +730,7 @@ class pdf_storm extends ModelePDFDeliveryOrder * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -906,8 +906,8 @@ class pdf_storm extends ModelePDFDeliveryOrder /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param TCPDF $pdf PDF + * @param Delivery $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -915,7 +915,7 @@ class pdf_storm extends ModelePDFDeliveryOrder protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } @@ -924,7 +924,7 @@ class pdf_storm extends ModelePDFDeliveryOrder /** * Define Array Column Field * - * @param object $object common object + * @param Delivery $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 2239745d407..8b7c899af91 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -175,7 +175,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Delivery $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -240,7 +240,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $heightforinfotot = 30; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -318,7 +318,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -628,7 +628,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -723,7 +723,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -897,7 +897,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -905,7 +905,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index df1a15598b1..ca0de68a670 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -139,7 +139,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder return 0; } - $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison); + $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->delivery_date); return $numFinal; } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index ac960635576..7e88a739a73 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -146,7 +146,7 @@ class pdf_espadon extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Expedition $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -270,7 +270,7 @@ class pdf_espadon extends ModelePdfExpedition $heightforinfotot = 8; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -319,7 +319,7 @@ class pdf_espadon extends ModelePdfExpedition // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -672,7 +672,7 @@ class pdf_espadon extends ModelePdfExpedition * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Expedition $object Object expedition * @param int $deja_regle Amount already paid * @param int $posy Start Position * @param Translate $outputlangs Objet langs @@ -823,7 +823,7 @@ class pdf_espadon extends ModelePdfExpedition * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1066,7 +1066,7 @@ class pdf_espadon extends ModelePdfExpedition * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1074,14 +1074,14 @@ class pdf_espadon extends ModelePdfExpedition protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } /** * Define Array Column Field * - * @param object $object common object + * @param Expedition $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index fa243b57626..56b4147f7e9 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -146,7 +146,7 @@ class pdf_merou extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Expedition $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -227,7 +227,7 @@ class pdf_merou extends ModelePdfExpedition $heightforinfotot = 0; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -481,7 +481,7 @@ class pdf_merou extends ModelePdfExpedition * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return void @@ -510,7 +510,7 @@ class pdf_merou extends ModelePdfExpedition * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index e570a506eca..86785540265 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -178,7 +178,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Expedition $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -291,7 +291,7 @@ class pdf_rouget extends ModelePdfExpedition $heightforinfotot = 8; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -338,7 +338,7 @@ class pdf_rouget extends ModelePdfExpedition // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -662,8 +662,8 @@ class pdf_rouget extends ModelePdfExpedition /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Expedition $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -858,7 +858,7 @@ class pdf_rouget extends ModelePdfExpedition * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1101,7 +1101,7 @@ class pdf_rouget extends ModelePdfExpedition * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1109,7 +1109,7 @@ class pdf_rouget extends ModelePdfExpedition protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 003e134faba..176b09264d4 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016-2019 Philippe Grand - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Francis Appels * Copyright (C) 2019 Markus Welters * Copyright (C) 2019 Rafael Ingenleuf @@ -199,13 +199,13 @@ class pdf_standard extends ModeleExpenseReport /** * Function to build pdf onto disk * - * @param Object $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param ExpenseReport $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -260,7 +260,7 @@ class pdf_standard extends ModeleExpenseReport $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 12; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); @@ -558,13 +558,13 @@ class pdf_standard extends ModeleExpenseReport } /** - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $linenumber line number - * @param int $curY current y position - * @param int $default_font_size default siez of font - * @param Translate $outputlangs Object lang for output - * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) + * @param TCPDF $pdf Object PDF + * @param ExpenseReport $object Object to show + * @param int $linenumber line number + * @param int $curY current y position + * @param int $default_font_size default siez of font + * @param Translate $outputlangs Object lang for output + * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @return void */ protected function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0) @@ -644,10 +644,10 @@ class pdf_standard extends ModeleExpenseReport /** * Show top header of page. * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output + * @param TCPDF $pdf Object PDF + * @param ExpenseReport $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output * @return void */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) @@ -981,11 +981,11 @@ class pdf_standard extends ModeleExpenseReport /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object invoice - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @return int <0 if KO, >0 if OK + * @param TCPDF $pdf Object PDF + * @param ExpenseReport $object Object expensereport + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @return int <0 if KO, >0 if OK */ protected function tablePayments(&$pdf, $object, $posy, $outputlangs) { @@ -1093,16 +1093,16 @@ class pdf_standard extends ModeleExpenseReport /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param TCPDF $pdf PDF + * @param ExpenseReport $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'EXPENSEREPORT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 82149032c86..63d12a7516a 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -220,7 +220,7 @@ class pdf_crabe extends ModelePDFFactures /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Facture $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -276,9 +276,9 @@ class pdf_crabe extends ModelePDFFactures { $object->fetch_thirdparty(); - $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); + $deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Definition of $dir and $file if ($object->specimen) @@ -322,9 +322,10 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part + if ($heightforinfotot > 220) $heightforinfotot = 220; $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -419,7 +420,7 @@ class pdf_crabe extends ModelePDFFactures $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (! empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -781,7 +782,7 @@ class pdf_crabe extends ModelePDFFactures * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object invoice + * @param Facture $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @param int $heightforfooter height for footer @@ -966,7 +967,7 @@ class pdf_crabe extends ModelePDFFactures * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -1587,7 +1588,7 @@ class pdf_crabe extends ModelePDFFactures * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1890,7 +1891,7 @@ class pdf_crabe extends ModelePDFFactures * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1898,7 +1899,7 @@ class pdf_crabe extends ModelePDFFactures protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 61e5007e6c8..532afbdab6e 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -197,7 +197,7 @@ class pdf_sponge extends ModelePDFFactures /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Facture $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -422,7 +422,7 @@ class pdf_sponge extends ModelePDFFactures // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -926,7 +926,7 @@ class pdf_sponge extends ModelePDFFactures * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object invoice + * @param Facture $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -1064,7 +1064,7 @@ class pdf_sponge extends ModelePDFFactures * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int Pos y @@ -1829,7 +1829,7 @@ class pdf_sponge extends ModelePDFFactures * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -2150,7 +2150,7 @@ class pdf_sponge extends ModelePDFFactures * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -2158,14 +2158,14 @@ class pdf_sponge extends ModelePDFFactures protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } /** * Define Array Column Field * - * @param object $object common object + * @param Facture $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index d76c0969761..c79b2ac4137 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -156,7 +156,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Fichinter $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -222,7 +222,7 @@ class pdf_soleil extends ModelePDFFicheinter $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -537,7 +537,7 @@ class pdf_soleil extends ModelePDFFicheinter * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Fichinter $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -710,7 +710,7 @@ class pdf_soleil extends ModelePDFFicheinter * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Fichinter $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return integer @@ -718,7 +718,7 @@ class pdf_soleil extends ModelePDFFicheinter protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php new file mode 100644 index 00000000000..cfa8c75ec11 --- /dev/null +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -0,0 +1,427 @@ + + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2018 Frédéric France +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* or see https://www.gnu.org/ +*/ + +/** + * \file htdocs/core/modules/member/doc/doc_generic_member_odt.modules.php + * \ingroup societe + * \brief File of class to build ODT documents for members + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_member.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; + + +/** + * Class to build documents using ODF templates generator + */ +class doc_generic_member_odt extends ModelePDFMember +{ + /** + * @var Societe Issuer + */ + public $emetteur; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.6 = array(5, 6) + */ + public $phpmin = array(5, 6); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc; + + // Load translation files required by the page + $langs->loadLangs(array("main", "companies")); + + $this->db = $db; + $this->name = "ODT templates"; + $this->description = $langs->trans("DocumentModelOdt"); + $this->scandir = 'MEMBER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan + + // Page size for A4 format + $this->type = 'odt'; + $this->page_largeur = 0; + $this->page_hauteur = 0; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = 0; + $this->marge_droite = 0; + $this->marge_haute = 0; + $this->marge_basse = 0; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva MEMBER_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 0; // Support add of a watermark on drafts + + // Recupere emetteur + $this->emetteur = $mysoc; + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined + } + + + /** + * Return description of a module + * + * @param Translate $langs Lang object to use for output + * @return string Description + */ + public function info($langs) + { + global $conf, $langs; + + // Load translation files required by the page + $langs->loadLangs(array('companies', 'errors')); + + $form = new Form($this->db); + + $texte = $this->description.".
\n"; + $texte .= '
'; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + + // List of directories area + $texte .= ''; + + $texte .= ''; + $texte .= ''; + + $texte .= '
'; + $texttitle = $langs->trans("ListOfDirectories"); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MEMBER_ADDON_PDF_ODT_PATH))); + $listoffiles = array(); + foreach ($listofdir as $key=>$tmpdir) + { + $tmpdir = trim($tmpdir); + $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); + if (!$tmpdir) { + unset($listofdir[$key]); continue; + } + if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); + else { + $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); + if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); + } + } + $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT"); + // Add list of substitution keys + $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; + $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + + // Scan directories + if (count($listofdir)) + { + $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + $texte .= ''; + } + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; + $texte .= '
'; + $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte .= '
'; + $texte .= '
'; + + return $texte; + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param Adherent $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param string $mode Tell if doc module is called for 'member', ... + * @param int $nooutput 1=Generate only file on disk and do not return it on response + * @return int 1 if OK, <=0 if KO + */ + public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0) + { + // phpcs:enable + global $user, $langs, $conf, $mysoc, $hookmanager; + + if (empty($srctemplatepath)) { + dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); + return -1; + } + + // Add odtgeneration hook + if (!is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + + if (!is_object($outputlangs)) $outputlangs = $langs; + $sav_charset_output = $outputlangs->charset_output; + $outputlangs->charset_output = 'UTF-8'; + + // Load translation files required by the page + $outputlangs->loadLangs(array("main", "companies", "bills", "dict")); + + if ($conf->adherent->dir_output) { + // If $object is id instead of object + if (!is_object($object)) { + $id = $object; + $object = new User($this->db); + $result = $object->fetch($id); + if ($result < 0) { + dol_print_error($this->db, $object->error); + return -1; + } + } + + $object->fetch_thirdparty(); + + $dir = $conf->adherent->dir_output; + $objectref = dol_sanitizeFileName($object->ref); + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; + $file = $dir."/".$objectref.".odt"; + + if (!file_exists($dir)) { + if (dol_mkdir($dir) < 0) { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return -1; + } + } + + if (file_exists($dir)) { + //print "srctemplatepath=".$srctemplatepath; // Src filename + $newfile = basename($srctemplatepath); + $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); + $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); + + $newfiletmp = $objectref.'_'.$newfiletmp; + + // Get extension (ods or odt) + $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); + if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { + $format = $conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format = '%Y%m%d%H%M%S'; + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; + } else { + $filename = $newfiletmp.'.'.$newfileformat; + } + $file = $dir.'/'.$filename; + //print "newdir=".$dir; + //print "newfile=".$newfile; + //print "file=".$file; + //print "conf->adherent->dir_temp=".$conf->adherent->dir_temp; + + dol_mkdir($conf->adherent->dir_temp); + + + // If CUSTOMER contact defined on member, we use it + $usecontact = false; + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); + if (count($arrayidcontact) > 0) { + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); + } + + // Recipient name + if (!empty($usecontact)) { + // On peut utiliser le nom de la societe du contact + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $socobject = $object->contact; + } else { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } + } else { + $socobject = $object->thirdparty; + } + + // Open and load template + require_once ODTPHP_PATH.'odf.php'; + try { + $odfHandler = new odf( + $srctemplatepath, + array( + 'PATH_TO_TMP' => $conf->adherent->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' + ) + ); + } catch (Exception $e) + { + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); + return -1; + } + + // Make substitutions into odt + $array_member = $this->getSubstitutionarrayMember($object, $outputlangs); + $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); + $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); + $array_other = $this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in object as contact_xxx tags + $array_thirdparty_contact = array(); + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); + + $tmparray = array_merge($array_member, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); + complete_substitutions_array($tmparray, $outputlangs, $object); + $tags = ''; + foreach ($tmparray as $key => $value) { + $tags .= '{' . $key . '} => ' . $value ."\n"; + } + $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); + // Call the ODTSubstitution hook + $parameters = array( + 'file'=>$file, + 'object'=>$object, + 'outputlangs'=>$outputlangs, + 'substitutionarray'=>&$tmparray + ); + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + foreach ($tmparray as $key=>$value) { + try { + if (preg_match('/logo$/', $key)) { + // Image + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } else { + // Text + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); + } + } + + // Replace labels translated + $tmparray = $outputlangs->get_translations_for_substitutions(); + foreach ($tmparray as $key=>$value) + { + try { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } catch (OdfException $e) + { + dol_syslog($e->getMessage(), LOG_WARNING); + } + } + + // Call the beforeODTSave hook + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + + // Write new file + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { + try { + $odfHandler->exportAsAttachedPDF($file); + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); + return -1; + } + } else { + try { + $odfHandler->saveToDisk($file); + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); + return -1; + } + } + + $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $odfHandler = null; // Destroy object + + $this->result = array('fullpath'=>$file); + + return 1; // Success + } else { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return -1; + } + } + + return -1; + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * get substitution array for object + * + * @param Adherent $object member + * @param Translate $outputlangs translation object + * @param string $array_key key for array + * @return array array of substitutions + */ + public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') + { + // phpcs:enable + $array_other = array(); + foreach ($object as $key => $value) { + if (!is_array($value) && !is_object($value)) { + $array_other[$array_key.'_'.$key] = $value; + } + } + return $array_other; + } +} diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php new file mode 100644 index 00000000000..2166fd9ccb7 --- /dev/null +++ b/htdocs/core/modules/member/modules_member.class.php @@ -0,0 +1,66 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + + +/** + * \class ModeleProductCode + * \brief Parent class for product code generators + */ + +/** + * \file htdocs/core/modules/member/modules_member.php + * \ingroup members + * \brief File with parent class for generating members to PDF + */ + + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +/** + * Parent class to manage intervention document templates + */ +abstract class ModelePDFMember extends CommonDocGenerator +{ + /** + * @var string Error code (or message) + */ + public $error = ''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + public static function liste_modeles($db, $maxfilenamelength = 0) + { + // phpcs:enable + + $type = 'member'; + $list = array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $list = getListOfModels($db, $type, $maxfilenamelength); + return $list; + } +} diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index d9a4f72465d..1db3e2b7d50 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -60,7 +60,10 @@ class modAdherent extends DolibarrModules $this->picto = 'member'; // Data directories to create when module is enabled - $this->dirs = array("/adherent/temp"); + $this->dirs = array( + "/adherent/temp", + "/doctemplates/members", + ); // Config pages $this->config_page_url = array("adherent.php@adherents"); @@ -178,6 +181,13 @@ class modAdherent extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "MEMBER_ADDON_PDF_ODT_PATH"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/members"; + $this->const[$r][3] = ""; + $this->const[$r][4] = 0; + $r++; + // Boxes //------- diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index a146a855ccb..6c6eaba69e0 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -140,14 +140,14 @@ class modHoliday extends DolibarrModules $r = 0; $this->rights[$r][0] = 20001; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read your own leave requests'; // Permission label + $this->rights[$r][1] = 'Read leave requests (yours and your subordinates)'; // Permission label $this->rights[$r][3] = 0; // 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->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20002; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/modify your own leave requests'; // Permission label + $this->rights[$r][1] = 'Create/modify leave requests'; // Permission label $this->rights[$r][3] = 0; // 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->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) @@ -170,7 +170,7 @@ class modHoliday extends DolibarrModules $this->rights[$r][0] = 20004; // Permission id (must not be already used) $this->rights[$r][1] = 'Read leave requests for everybody'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'read_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][4] = 'readall'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; @@ -201,7 +201,7 @@ class modHoliday extends DolibarrModules $this->export_code[$r] = 'leaverequest_'.$r; $this->export_label[$r] = 'ListeCP'; $this->export_icon[$r] = 'holiday'; - $this->export_permission[$r] = array(array("holiday", "read_all")); + $this->export_permission[$r] = array(array("holiday", "readall")); $this->export_fields_array[$r] = array( 'd.rowid'=>"LeaveId", 'd.fk_type'=>'TypeOfLeaveId', 't.code'=>'TypeOfLeaveCode', 't.label'=>'TypeOfLeaveLabel', 'd.fk_user'=>'UserID', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.halfday'=>'HalfDay', 'none.num_open_days'=>'NbUseDaysCP', diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 0e96b8d4c11..0d1353076ec 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -246,9 +246,9 @@ class modResource extends DolibarrModules $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid'; $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')'; diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index 7159ca634d5..23c892333d8 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -101,7 +101,7 @@ class modSalaries extends DolibarrModules $r++; $this->rights[$r][0] = 511; - $this->rights[$r][1] = 'Read payments of employee salaries'; + $this->rights[$r][1] = 'Read payments of employee salaries (yours and your subordinates)'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; @@ -125,6 +125,13 @@ class modSalaries extends DolibarrModules $r++; $this->rights[$r][0] = 517; + $this->rights[$r][1] = 'Read payments of salariests of every employee'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'readall'; + + $r++; + $this->rights[$r][0] = 519; $this->rights[$r][1] = 'Export payments of employee salaries'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; @@ -132,6 +139,7 @@ class modSalaries extends DolibarrModules $this->rights[$r][5] = ''; + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index b45fdd1b48a..694c77b8881 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -255,13 +255,16 @@ class modUser extends DolibarrModules 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" ); + $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (empty($conf->adherent->enabled)) - { - unset($this->export_fields_array[$r]['u.fk_member']); - unset($this->export_entities_array[$r]['u.fk_member']); - } + { + unset($this->export_fields_array[$r]['u.fk_member']); + unset($this->export_entities_array[$r]['u.fk_member']); + } $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object'; $this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')'; // Imports diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index c37e0cc60a7..5917cb85042 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -1156,7 +1156,7 @@ class pdf_stdandard extends ModelePDFMovement protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 0a9cb1210ee..5d840cb5ca3 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2020 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -141,6 +141,8 @@ class printing_printipp extends PrintingDriver $ipp->setPort($this->port); $ipp->setJobName($file, true); $ipp->setUserName($this->userid); + // Set default number of copy + $ipp->setCopies(1); if (!empty($this->user)) $ipp->setAuthentication($this->user, $this->password); // select printer uri for module order, propal,... @@ -148,10 +150,11 @@ class printing_printipp extends PrintingDriver $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - if ($obj) - { + if ($obj) { dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id); $ipp->setPrinterURI($obj->printer_id); + // Set number of copy + $ipp->setCopies($obj->copy); } else { if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) { @@ -167,8 +170,6 @@ class printing_printipp extends PrintingDriver dol_print_error($this->db); } - // Set number of copy - $ipp->setCopies($obj->copy); $fileprint = $conf->{$module}->dir_output; if ($subdir != '') $fileprint .= '/'.$subdir; $fileprint .= '/'.$file; diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 9ac05a98561..a4032c6a13a 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -221,7 +221,7 @@ class pdf_standard extends ModelePDFProduct $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -690,7 +690,7 @@ class pdf_standard extends ModelePDFProduct * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Product $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document @@ -837,7 +837,7 @@ class pdf_standard extends ModelePDFProduct * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Product $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -845,7 +845,7 @@ class pdf_standard extends ModelePDFProduct protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 84cc5829571..6baf416ed64 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -38,26 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class pdf_baleine extends ModelePDFProjects { - /** - * @var DoliDb Database handler - */ - public $db; - - /** - * @var string model name - */ - public $name; - - /** - * @var string model description (short text) - */ - public $description; - - /** - * @var string document type - */ - public $type; - /** * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.6 = array(5, 6) @@ -70,44 +50,9 @@ class pdf_baleine extends ModelePDFProjects */ public $version = 'dolibarr'; - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - /** * Issuer - * @var Societe object that emits + * @var Societe Object that emits */ public $emetteur; @@ -149,10 +94,10 @@ class pdf_baleine extends ModelePDFProjects // Define position of columns $this->posxref = $this->marge_gauche + 1; $this->posxlabel = $this->marge_gauche + 25; - $this->posxworkload = $this->marge_gauche + 120; - $this->posxprogress = $this->marge_gauche + 140; - $this->posxdatestart = $this->marge_gauche + 152; - $this->posxdateend = $this->marge_gauche + 170; + $this->posxworkload = $this->marge_gauche + 117; + $this->posxprogress = $this->marge_gauche + 137; + $this->posxdatestart = $this->marge_gauche + 147; + $this->posxdateend = $this->marge_gauche + 169; if ($this->page_largeur < 210) // To work with US executive format { $this->posxref -= 20; @@ -224,7 +169,7 @@ class pdf_baleine extends ModelePDFProjects $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -420,7 +365,8 @@ class pdf_baleine extends ModelePDFProjects // Progress $pdf->SetXY($this->posxprogress, $curY); $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R'); - // Date + + // Date start and end $pdf->SetXY($this->posxdatestart, $curY); $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C'); $pdf->SetXY($this->posxdateend, $curY); @@ -538,7 +484,7 @@ class pdf_baleine extends ModelePDFProjects // Draw rect of all tab (title + lines). Rect takes a length in 3rd parameter $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); - // line takes a position y in 3rd parameter + // Line takes a position y in 3rd parameter $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); $pdf->SetTextColor(0, 0, 0); @@ -556,11 +502,13 @@ class pdf_baleine extends ModelePDFProjects $pdf->SetXY($this->posxprogress, $tab_top + 1); $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R'); + // Date start $pdf->SetXY($this->posxdatestart, $tab_top + 1); - $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C'); + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->trans("Start"), 0, 'C'); + // Date end $pdf->SetXY($this->posxdateend, $tab_top + 1); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $outputlangs->trans("End"), 0, 'C'); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore @@ -667,7 +615,7 @@ class pdf_baleine extends ModelePDFProjects protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 1309f329e30..0f877428052 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -111,14 +111,14 @@ class pdf_beluga extends ModelePDFProjects if ($this->orientation == 'L' || $this->orientation == 'Landscape') { $this->posxref = $this->marge_gauche + 1; $this->posxdate = $this->marge_gauche + 105; - $this->posxsociety = $this->marge_gauche + 125; + $this->posxsociety = $this->marge_gauche + 126; $this->posxamountht = $this->marge_gauche + 190; $this->posxamountttc = $this->marge_gauche + 215; $this->posxstatut = $this->marge_gauche + 245; } else { $this->posxref = $this->marge_gauche + 1; $this->posxdate = $this->marge_gauche + 25; - $this->posxsociety = $this->marge_gauche + 45; + $this->posxsociety = $this->marge_gauche + 46; $this->posxamountht = $this->marge_gauche + 110; $this->posxamountttc = $this->marge_gauche + 135; $this->posxstatut = $this->marge_gauche + 165; @@ -196,7 +196,7 @@ class pdf_beluga extends ModelePDFProjects $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -818,7 +818,7 @@ class pdf_beluga extends ModelePDFProjects protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 3f30391117b..5426e076d33 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -37,9 +37,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class pdf_timespent extends ModelePDFProjects { + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.6 = array(5, 6) + */ + public $phpmin = array(5, 6); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + /** * Issuer - * @var Societe + * @var Societe Object that emits */ public $emetteur; @@ -81,25 +93,26 @@ class pdf_timespent extends ModelePDFProjects // Define position of columns $this->posxref = $this->marge_gauche + 1; $this->posxlabel = $this->marge_gauche + 25; + $this->posxworkload = $this->marge_gauche + 100; $this->posxtimespent = $this->marge_gauche + 120; //$this->posxprogress=$this->marge_gauche+140; - $this->posxdatestart = $this->marge_gauche + 152; - $this->posxdateend = $this->marge_gauche + 170; + $this->posxuser = $this->marge_gauche + 147; + //$this->posxdateend = $this->marge_gauche + 169; if ($this->page_largeur < 210) // To work with US executive format { $this->posxref -= 20; $this->posxlabel -= 20; $this->posxtimespent -= 20; //$this->posxprogress-=20; - $this->posxdatestart -= 20; - $this->posxdateend -= 20; + $this->posxuser -= 20; + //$this->posxdateend -= 20; } } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Fonction generant le projet sur le disque + * Function to build pdf project onto disk * * @param Project $object Object project a generer * @param Translate $outputlangs Lang output object @@ -156,6 +169,7 @@ class pdf_timespent extends ModelePDFProjects $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -227,7 +241,7 @@ class pdf_timespent extends ModelePDFProjects // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); + $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; @@ -240,6 +254,10 @@ class pdf_timespent extends ModelePDFProjects $curY = $tab_top + $heightoftitleline + 1; $nexY = $tab_top + $heightoftitleline + 1; + $tmpuser = new User($this->db); + + // TODO We should loop on record of times spent grouped by user instead of lines of tasks + // Loop on each lines for ($i = 0; $i < $nblines; $i++) { @@ -340,22 +358,24 @@ class pdf_timespent extends ModelePDFProjects $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // Ref of task $pdf->SetXY($this->posxref, $curY); $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); // timespent $pdf->SetXY($this->posxtimespent, $curY); - $pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $duration ? $duration : '', 0, 'R'); + $pdf->MultiCell($this->posxuser - $this->posxtimespent, 3, $duration ? $duration : '', 0, 'R'); // Progress //$pdf->SetXY($this->posxprogress, $curY); - //$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R'); - // Date - $pdf->SetXY($this->posxdatestart, $curY); - $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C'); - $pdf->SetXY($this->posxdateend, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $dateend, 0, 'C'); + //$pdf->MultiCell($this->posxuser-$this->posxprogress, 3, $progress, 0, 'R'); + + // User spending time + /*var_dump($object->lines[$i]);exit; + $tmpuser->fetch($object->lines[$i]->fk_user); + $pdf->SetXY($this->posxuser, $curY); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxuser, 3, $tmpuser->getFullName($outputlangs, 0, -1, 20), 0, 'C'); + */ // Add line if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) @@ -408,7 +428,7 @@ class pdf_timespent extends ModelePDFProjects else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; - // Pied de page + // Footer of the page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -469,7 +489,7 @@ class pdf_timespent extends ModelePDFProjects // Draw rect of all tab (title + lines). Rect takes a length in 3rd parameter $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); - // line prend une position y en 3eme param + // Line takes a position y in 3rd parameter $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); $pdf->SetTextColor(0, 0, 0); @@ -482,16 +502,13 @@ class pdf_timespent extends ModelePDFProjects $pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); $pdf->SetXY($this->posxtimespent, $tab_top + 1); - $pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R'); + $pdf->MultiCell($this->posxuser - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R'); //$pdf->SetXY($this->posxprogress, $tab_top+1); - //$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R'); + //$pdf->MultiCell($this->posxuser - $this->posxprogress, 3, '%', 0, 'R'); - $pdf->SetXY($this->posxdatestart, $tab_top + 1); - $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->transnoentities("Date"), 0, 'C'); - - $pdf->SetXY($this->posxdateend, $tab_top + 1); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); + $pdf->SetXY($this->posxuser, $tab_top + 1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxuser, 3, '', 0, 'C'); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore @@ -598,7 +615,7 @@ class pdf_timespent extends ModelePDFProjects protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 72a86ba7ca4..6f174a27d7a 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -31,6 +31,61 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFProjects extends CommonDocGenerator { + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; + + /** + * @var int page_largeur + */ + public $page_largeur; + + /** + * @var int page_hauteur + */ + public $page_hauteur; + + /** + * @var array format + */ + public $format; + + /** + * @var int marge_gauche + */ + public $marge_gauche; + + /** + * @var int marge_droite + */ + public $marge_droite; + + /** + * @var int marge_haute + */ + public $marge_haute; + + /** + * @var int marge_basse + */ + public $marge_basse; + /** * @var string Error code (or message) */ diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index a74286e4cdc..3405b6a2774 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -204,7 +204,7 @@ class pdf_azur extends ModelePDFPropales /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Propal $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -383,7 +383,7 @@ class pdf_azur extends ModelePDFPropales $heightforsignature = empty($conf->global->PROPAL_DISABLE_SIGNATURE) ? (pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities("ProposalCustomerSignature")) + 10) : 0; $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); @@ -396,7 +396,7 @@ class pdf_azur extends ModelePDFPropales $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -827,8 +827,8 @@ class pdf_azur extends ModelePDFPropales /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object proposal + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -844,7 +844,7 @@ class pdf_azur extends ModelePDFPropales * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -870,7 +870,7 @@ class pdf_azur extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -879,7 +879,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1415,7 +1415,7 @@ class pdf_azur extends ModelePDFPropales * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1666,7 +1666,7 @@ class pdf_azur extends ModelePDFPropales * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1674,7 +1674,7 @@ class pdf_azur extends ModelePDFPropales protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } @@ -1684,7 +1684,7 @@ class pdf_azur extends ModelePDFPropales * Show area for the customer to sign * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Propal $object Object invoice * @param int $posy Position depart * @param Translate $outputlangs Objet langs * @return int Position pour suite diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 324f52c1ca0..8199f3ac11e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -187,7 +187,7 @@ class pdf_cyan extends ModelePDFPropales /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Propal $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -384,7 +384,7 @@ class pdf_cyan extends ModelePDFPropales // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -967,8 +967,8 @@ class pdf_cyan extends ModelePDFPropales /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object proposal + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -981,7 +981,7 @@ class pdf_cyan extends ModelePDFPropales * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int Pos y @@ -1006,7 +1006,7 @@ class pdf_cyan extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -1015,7 +1015,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1158,8 +1158,8 @@ class pdf_cyan extends ModelePDFPropales /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -1507,7 +1507,7 @@ class pdf_cyan extends ModelePDFPropales * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -1553,8 +1553,7 @@ class pdf_cyan extends ModelePDFPropales } else { $logo = $logodir.'/logos/'.$this->emetteur->logo; } - if (is_readable($logo)) - { + if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -1762,7 +1761,7 @@ class pdf_cyan extends ModelePDFPropales * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1770,15 +1769,15 @@ class pdf_cyan extends ModelePDFPropales protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } /** * Show area for the customer to sign * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $posy Position depart * @param Translate $outputlangs Objet langs * @return int Position pour suite @@ -1813,7 +1812,7 @@ class pdf_cyan extends ModelePDFPropales /** * Define Array Column Field * - * @param object $object common object + * @param Propal $object object proposal * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index a95d7594458..446b03daf0a 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -254,7 +254,7 @@ class pdf_squille extends ModelePdfReception // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -1012,7 +1012,7 @@ class pdf_squille extends ModelePdfReception protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'RECEPTION_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 4b4be2de5b3..55923d68a79 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -912,7 +912,7 @@ class pdf_standard extends ModelePDFStock protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 83733dc1d33..517f96a99d6 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -275,7 +275,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -336,7 +336,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -1263,7 +1263,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index c0b849fad67..681b5316682 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -292,7 +292,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -342,7 +342,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -1276,11 +1276,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $posy += 4; $pdf->SetXY($posx - 90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) @@ -1425,7 +1425,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index f6e27499dc2..13111da6fa9 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -308,7 +308,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -370,7 +370,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) @@ -1190,11 +1190,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $posy += 4; $pdf->SetXY($posx - 90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) @@ -1338,7 +1338,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } 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 388ee06f7a9..19e78eb4ff9 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -267,7 +267,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -798,7 +798,7 @@ class pdf_standard extends ModelePDFSuppliersPayments protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } 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 06bdb462b18..8a3880dc93e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -297,7 +297,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -724,7 +724,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -733,7 +733,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -745,7 +745,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - //$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); + //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true); $pdf->MultiCell(80, 4, '', 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1325,7 +1325,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R'); */ if ($object->thirdparty->code_fournisseur) @@ -1469,7 +1469,7 @@ class pdf_aurore extends ModelePDFSupplierProposal protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } 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 2f534f86813..771231e6041 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 @@ -1,7 +1,7 @@ * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -114,7 +114,7 @@ class doc_generic_user_odt extends ModelePDFUser $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= '
'; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -187,7 +187,17 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= ""; $texte .= ''; } + $texte .= ''; } + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/user/doc/index.html b/htdocs/core/modules/user/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 012c39c126d..98be97ac5bb 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -145,7 +145,7 @@ if ($permission) $newcardbutton = ''; if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer) { - $newcardbutton .= ''; + $newcardbutton .= ''; } print $newcardbutton; ?> diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d177ce7637c..401e1079d35 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -693,7 +693,8 @@ if (!empty($usemargins) && $user->rights->margins->creer) $("#buying_price").val("").show(); /* Call post to load content of combo list fournprice_predef */ - $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': '' }, function(data) { + var token = ''; // For AJAX Call we use old 'token' and not 'newtoken' + $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': token }, function(data) { if (data && data.length > 0) { var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 6b3639d65eb..b7f0b8d5da1 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -434,7 +434,8 @@ jQuery(document).ready(function() }); /* Init field buying_price and fournprice */ - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': ''}, function(data) { + var token = ''; // For AJAX Call we use old 'token' and not 'newtoken' + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': token }, function(data) { if (data && data.length > 0) { var options = ''; var trouve=false; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 25816cd591e..fd082884ce2 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -77,6 +77,11 @@ class InterfaceActionsAuto extends DolibarrTriggers { if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing + // Do not log events when trigger is for creating event (infinite loop) + if (preg_match('/^ACTION_/', $action)) { + return 0; + } + $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; //var_dump($action.' - '.$conf->global->$key);exit; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 94ddecc48ba..452f06efb0a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -310,23 +310,23 @@ $sectionauto = array(); if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } - if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } - if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); } - if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } - if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } - if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBySupplierProposals")); } - if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } - if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } - if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } - if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } - if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); } - if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); } - if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsByBankAccount")); } - if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsByMO")); } - if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsByCandidature")); } - $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); + if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } + if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); } + if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); } + if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); } + if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); } + if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); } + if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); } + if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); } + if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); } + if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); } + if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); } + if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); } + if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); } + if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); } + if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); } + if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); } + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users"))); } $head = ecm_prepare_dasboard_head(''); diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 6f9f264994b..a3c242cb787 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -97,14 +97,23 @@ $userstatic = new User($db); // Ajout rubriques automatiques $rowspan = 0; $sectionauto = array(); -if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>$conf->product->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } -if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } -if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); } -if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } -if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } -if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); } -if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } -if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } +if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } +if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } +if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); } +if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); } +if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); } +if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); } +if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); } +if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); } +if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); } +if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); } +if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); } +if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); } +if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); } +if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); } +if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); } +if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); } +if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); } //*********************** diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 77e25704a6b..2cef2c39320 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -105,6 +105,8 @@ $hookmanager->initHooks(array('expeditioncard', 'globalcard')); $permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -201,8 +203,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver $classname = ucfirst($object->origin); $objectsrc = new $classname($db); @@ -936,8 +936,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -1048,7 +1047,7 @@ if ($action == 'create') $i++; } print '}); - jQuery("#autoreset").click(function() {'; + jQuery("#autoreset").click(function() { console.log("Reset values to 0"); '; $i = 0; while ($i < $numAsked) { @@ -1076,12 +1075,12 @@ if ($action == 'create') print ''.$langs->trans("QtyToShip"); if (empty($conf->productbatch->enabled)) { - print '
'.$langs->trans("Fill").''; + print '
'.$langs->trans("Fill").''; print ' / '; } else { print '
'; } - print ''.$langs->trans("Reset").''; + print ''.img_picto($langs->trans("Reset"), 'eraser').''; print ''; if (!empty($conf->stock->enabled)) { @@ -1115,7 +1114,7 @@ if ($action == 'create') if (!empty($line->date_start)) $type = 1; if (!empty($line->date_end)) $type = 1; - print ''."\n"; + print ''."\n"; print ''."\n"; // Product label @@ -1126,13 +1125,16 @@ if ($action == 'create') //var_dump($product->stock_warehouse[1]); print ''; - print ''; // ancre pour retourner sur la ligne + print ''; // ancre pour retourner sur la ligne // Show product and description $product_static->type = $line->fk_product_type; $product_static->id = $line->fk_product; $product_static->ref = $line->ref; + $product_static->status = $line->product_tosell; + $product_static->status_buy = $line->product_tobuy; $product_static->status_batch = $line->product_tobatch; + $text = $product_static->getNomUrl(1); $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc)); @@ -2049,7 +2051,7 @@ if ($action == 'create') $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; - $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; + $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; @@ -2076,7 +2078,10 @@ if ($action == 'create') if ($obj) { // $obj->rowid is rowid in $origin."det" table - $alreadysent[$obj->rowid][$obj->shipmentline_id] = array('shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); + $alreadysent[$obj->rowid][$obj->shipmentline_id] = array( + 'shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, + 'product_tosell'=>$obj->product_tosell, 'product_tobuy'=>$obj->product_tobuy, 'product_tobatch'=>$obj->product_tobatch, + 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); } $i++; } @@ -2085,6 +2090,7 @@ if ($action == 'create') } print ''; + // Loop on each product to send/sent for ($i = 0; $i < $num_prod; $i++) { @@ -2120,6 +2126,8 @@ if ($action == 'create') $product_static->type = $lines[$i]->fk_product_type; $product_static->id = $lines[$i]->fk_product; $product_static->ref = $lines[$i]->ref; + $product_static->status = $lines[$i]->product_tosell; + $product_static->status_buy = $lines[$i]->product_tobuy; $product_static->status_batch = $lines[$i]->product_tobatch; $product_static->weight = $lines[$i]->weight; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bc97a26d7ff..6c2faa0624d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -619,10 +619,8 @@ class Expedition extends CommonObject // Tracking url $this->getUrlTrackingStatus($obj->tracking_number); - /* - * Thirdparty - */ - $result = $this->fetch_thirdparty(); + // Thirdparty + $result = $this->fetch_thirdparty(); // TODO Remove this // Retrieve extrafields $this->fetch_optionals(); @@ -919,6 +917,7 @@ class Expedition extends CommonObject $line->entrepot_id = $entrepot_id; $line->origin_line_id = $id; + $line->fk_origin_line = $id; $line->qty = $qty; $orderline = new OrderLine($this->db); @@ -931,31 +930,37 @@ class Expedition extends CommonObject { $fk_product = $orderline->fk_product; - if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) - { + if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) { $langs->load("errors"); $this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); return -1; } - if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) - { - // Check must be done for stock of product into warehouse if $entrepot_id defined + if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) { $product = new Product($this->db); - $result = $product->fetch($fk_product); + $product->fetch($fk_product); + // Check must be done for stock of product into warehouse if $entrepot_id defined if ($entrepot_id > 0) { $product->load_stock('warehouseopen'); $product_stock = $product->stock_warehouse[$entrepot_id]->real; - } else $product_stock = $product->stock_reel; + } else { + $product_stock = $product->stock_reel; + } $product_type = $product->type; - if ($product_type == 0 && $product_stock < $qty) - { - $langs->load("errors"); - $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); - $this->db->rollback(); - return -3; + if ($product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $isavirtualproduct = ($product->hasFatherOrChild(1) > 0); + // The product is qualified for a check of quantity (must be enough in stock to be added into shipment). + if (!$isavirtualproduct || empty($conf->global->PRODUIT_SOUSPRODUITS) || ($isavirtualproduct && empty($conf->global->STOCK_EXCLUDE_VIRTUAL_PRODUCTS))) { // If STOCK_EXCLUDE_VIRTUAL_PRODUCTS is set, we do not manage stock for kits/virtual products. + if ($product_stock < $qty) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); + $this->errorhidden = 'ErrorStockIsNotEnoughToAddProductOnShipment'; + $this->db->rollback(); + return -3; + } + } } } } @@ -1060,13 +1065,13 @@ class Expedition extends CommonObject // Clean parameters if (isset($this->ref)) $this->ref = trim($this->ref); - if (isset($this->entity)) $this->entity = trim($this->entity); + if (isset($this->entity)) $this->entity = (int) $this->entity; if (isset($this->ref_customer)) $this->ref_customer = trim($this->ref_customer); - if (isset($this->socid)) $this->socid = trim($this->socid); - if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author); - if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid); - if (isset($this->fk_delivery_address)) $this->fk_delivery_address = trim($this->fk_delivery_address); - if (isset($this->shipping_method_id)) $this->shipping_method_id = trim($this->shipping_method_id); + if (isset($this->socid)) $this->socid = (int) $this->socid; + if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; + if (isset($this->fk_user_valid)) $this->fk_user_valid = (int) $this->fk_user_valid; + if (isset($this->fk_delivery_address)) $this->fk_delivery_address = (int) $this->fk_delivery_address; + if (isset($this->shipping_method_id)) $this->shipping_method_id = (int) $this->shipping_method_id; if (isset($this->tracking_number)) $this->tracking_number = trim($this->tracking_number); if (isset($this->statut)) $this->statut = (int) $this->statut; if (isset($this->trueDepth)) $this->trueDepth = trim($this->trueDepth); @@ -1122,15 +1127,11 @@ class Expedition extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SHIPPING_MODIFY', $user); - if ($result < 0) { $error++; } - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SHIPPING_MODIFY', $user); + if ($result < 0) { $error++; } + // End call triggers } // Commit or rollback @@ -1171,21 +1172,16 @@ class Expedition extends CommonObject // Add a protection to refuse deleting if shipment has at least one delivery $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment - if (count($this->linkedObjectsIds) > 0) - { + if (count($this->linkedObjectsIds) > 0) { $this->error = 'ErrorThereIsSomeDeliveries'; $error++; } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SHIPPING_CANCEL', $user); - if ($result < 0) { $error++; } - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SHIPPING_CANCEL', $user); + if ($result < 0) { $error++; } + // End call triggers } // Stock control @@ -1383,15 +1379,11 @@ class Expedition extends CommonObject $error++; } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SHIPPING_DELETE', $user); - if ($result < 0) { $error++; } - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SHIPPING_DELETE', $user); + if ($result < 0) { $error++; } + // End call triggers } // Stock control @@ -1589,7 +1581,7 @@ class Expedition extends CommonObject $sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang"; $sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; - $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; + $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch"; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; $sql .= " WHERE ed.fk_expedition = ".$this->id; @@ -1651,6 +1643,8 @@ class Expedition extends CommonObject $line->product_ref = $obj->product_ref; $line->product_label = $obj->product_label; $line->libelle = $obj->product_label; // TODO deprecated + $line->product_tosell = $obj->product_tosell; + $line->product_tobuy = $obj->product_tobuy; $line->product_tobatch = $obj->product_tobatch; $line->label = $obj->custom_label; $line->description = $obj->description; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 09cec584c43..77a62bf8561 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -212,7 +212,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -618,6 +618,7 @@ if ($resql) $object = new Expedition($db); $object->fetch($obj->rowid); + print ''; // Ref @@ -705,7 +706,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "dayhour"); + print dol_print_date($db->jdate($obj->delivery_date), "dayhour"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 62e6181abcf..39772360227 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -354,7 +354,7 @@ if ($id > 0 || !empty($ref)) print ''.$langs->trans('Date').''; print ''; print dol_print_date($object->date, 'day'); - if ($object->hasDelay() && empty($object->date_livraison)) { + if ($object->hasDelay() && empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ''; @@ -374,12 +374,12 @@ if ($id > 0 || !empty($ref)) print ''; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'dayhour'); - if ($object->hasDelay() && !empty($object->date_livraison)) { + print dol_print_date($object->delivery_date, 'dayhour'); + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9b927360025..5f2771594de 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -114,6 +114,12 @@ class CommandeFournisseur extends CommonOrder public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set public $date_commande; + /** + * @var int Date expected for delivery + * @deprecated See delivery_date + */ + public $date_livraison; + /** * Delivery date */ @@ -313,7 +319,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " c.localtax1, c.localtax2, "; $sql .= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,"; $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; - $sql .= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; + $sql .= " c.date_commande as date_commande, c.date_livraison as delivery_date, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; $sql .= " c.fk_account,"; $sql .= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,"; $sql .= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,"; @@ -369,7 +375,8 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier - $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->remise_percent = $obj->remise_percent; $this->methode_commande_id = $obj->fk_input_method; $this->methode_commande = $obj->methode_commande; @@ -771,16 +778,24 @@ class CommandeFournisseur extends CommonOrder if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_supplier)) + } + if (!empty($this->ref_supplier)) { $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $picto = 'order'; @@ -1250,9 +1265,10 @@ class CommandeFournisseur extends CommonOrder $error = 0; $now = dol_now(); - // $date_commande is deprecated + // set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set if (empty($date)) $date = $now; + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Clean parameters if (empty($this->source)) $this->source = 0; @@ -1301,7 +1317,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".$this->socid; $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", '".$this->db->idate($date)."'"; - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".$user->id; $sql .= ", ".self::STATUS_DRAFT; $sql .= ", ".$this->db->escape($this->source); @@ -2313,6 +2329,7 @@ class CommandeFournisseur extends CommonOrder { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -2889,7 +2906,7 @@ class CommandeFournisseur extends CommonOrder } $sql .= $clause." c.entity = ".$conf->entity; if ($mode === 'awaiting') { - $sql .= " AND c.fk_statut = ".self::STATUS_ORDERSENT; + $sql .= " AND c.fk_statut IN (".self::STATUS_ORDERSENT.", ".self::STATUS_RECEIVED_PARTIALLY.")"; } else { $sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; } @@ -2910,14 +2927,15 @@ class CommandeFournisseur extends CommonOrder if ($mode === 'awaiting') { $response->label = $langs->trans("SuppliersOrdersAwaitingReception"); $response->labelShort = $langs->trans("AwaitingReception"); - $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers'; + $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3,4&mainmenu=commercial&leftmenu=orders_suppliers'; } while ($obj = $this->db->fetch_object($resql)) { $response->nbtodo++; - $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); + $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $commandestatic->delivery_date = $this->db->jdate($obj->delivery_date); $commandestatic->date_commande = $this->db->jdate($obj->date_commande); $commandestatic->statut = $obj->fk_statut; @@ -3070,12 +3088,12 @@ class CommandeFournisseur extends CommonOrder { global $conf; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility $now = dol_now(); - $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; + $date_to_test = empty($this->delivery_date) ? $this->date_commande : $this->delivery_date; - return ($this->statut > 0 && $this->statut < 4) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); + return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); } /** @@ -3087,9 +3105,9 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility - if (empty($this->date_delivery)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + if (empty($this->delivery_date)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day'); $text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today"); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 600e60265d5..b4f3570ff34 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1145,7 +1145,8 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated + $object->delivery_date = $datelivraison; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); @@ -1199,7 +1200,8 @@ if (empty($reshook)) $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $object->setDeliveryDate($user, $srcobject->date_livraison); + $tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison); + $object->setDeliveryDate($user, $tmpdate); $object->set_id_projet($user, $srcobject->fk_project); $lines = $srcobject->lines; @@ -1551,7 +1553,7 @@ if ($action == 'create') $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '')); if (!empty($conf->multicurrency->enabled)) { @@ -2000,9 +2002,9 @@ if ($action == 'create') if ($object->methode_commande_id > 0) { print ''.$langs->trans("Date").''; - if ($object->date_commande) - { - print dol_print_date($object->date_commande, "dayhour")."\n"; + print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin) : ''; + if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ""; @@ -2160,14 +2162,14 @@ if ($action == 'create') print ''; $usehourmin = 0; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 1; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); print ''; print ''; } else { $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e62e2399901..a46c900e215 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1050,6 +1050,7 @@ if ($resql) $objectstatic->total_ht = $obj->total_ht; $objectstatic->total_tva = $obj->total_tva; $objectstatic->total_ttc = $obj->total_ttc; + $objectstatic->date_commande = $db->jdate($obj->date_commande); $objectstatic->date_delivery = $db->jdate($obj->date_delivery); $objectstatic->note_public = $obj->note_public; $objectstatic->note_private = $obj->note_private; @@ -1159,8 +1160,10 @@ if ($resql) if (!empty($arrayfields['cf.date_commande']['checked'])) { print ''; - if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day'); - else print ''; + print dol_print_date($db->jdate($obj->date_commande), 'day'); + if ($objectstatic->hasDelay() && !empty($objectstatic->date_delivery)) { + print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + } print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 2f2c9145beb..53a22f83eee 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -73,7 +73,7 @@ if (($id > 0) || $ref) // Check current user can read this leave request $canread = 0; - if (!empty($user->rights->holiday->read_all)) $canread = 1; + if (!empty($user->rights->holiday->readall)) $canread = 1; if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) $canread = 1; if (!$canread) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 262185df4c5..0677cd2f601 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2116,7 +2116,7 @@ class Holiday extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h"; $sql .= " WHERE h.statut > 1"; $sql .= " AND h.entity IN (".getEntity('holiday').")"; - if (empty($user->rights->expensereport->read_all)) + if (empty($user->rights->expensereport->readall)) { $userchildids = $user->getAllChildIds(1); $sql .= " AND (h.fk_user IN (".join(',', $userchildids).")"; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 47f6eeda550..585c80e3e6d 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -206,7 +206,7 @@ $filters = ''; // Filter on array of ids of all childs $userchilds = array(); -if (empty($user->rights->holiday->read_all)) +if (empty($user->rights->holiday->readall)) { $userchilds = $user->getAllChildIds(1); $filters .= ' AND u.rowid IN ('.join(', ', $userchilds).')'; @@ -293,7 +293,7 @@ if (count($typeleaves) == 0) foreach ($listUsers as $users) { // If user has not permission to edit/read all, we must see only subordinates - if (empty($user->rights->holiday->read_all)) + if (empty($user->rights->holiday->readall)) { if (($users['rowid'] != $user->id) && (!in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 615ab6cfa44..bfdef939be3 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -70,7 +70,7 @@ if ($id > 0) { $canread = 0; if ($id == $user->id) $canread = 1; - if (!empty($user->rights->holiday->read_all)) $canread = 1; + if (!empty($user->rights->holiday->readall)) $canread = 1; if (!empty($user->rights->holiday->read) && in_array($id, $childids)) $canread = 1; if (!$canread) { @@ -318,7 +318,7 @@ if (!empty($search_status) && $search_status != -1) { $sql .= " AND cp.statut = '".$db->escape($search_status)."'\n"; } -if (empty($user->rights->holiday->read_all)) $sql .= ' AND cp.fk_user IN ('.join(',', $childids).')'; +if (empty($user->rights->holiday->readall)) $sql .= ' AND cp.fk_user IN ('.join(',', $childids).')'; if ($id > 0) $sql .= " AND cp.fk_user IN (".$id.")"; // Add where from extra fields @@ -469,7 +469,7 @@ if ($resql) $include = ''; - if (empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see only its hierarchyl + if (empty($user->rights->holiday->readall)) $include = 'hierarchyme'; // Can see only its hierarchyl print '
'; print ''."\n"; @@ -507,7 +507,7 @@ if ($resql) // Approver if (!empty($arrayfields['cp.fk_validator']['checked'])) { - if ($user->rights->holiday->read_all) + if ($user->rights->holiday->readall) { print ''; $result = 0; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 669bb9aa32f..54049a201ea 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -69,7 +69,7 @@ if (!$sortfield) $sortfield = "cpl.rowid"; if (!$sortorder) $sortorder = "DESC"; // Si l'utilisateur n'a pas le droit de lire cette page -if (!$user->rights->holiday->read_all) accessforbidden(); +if (!$user->rights->holiday->readall) accessforbidden(); // Load translation files required by the page $langs->load('users'); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index a713ec86100..3ec2a3b898f 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -180,7 +180,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; $sql .= " AND x.entity = ".$conf->entity; - if (empty($user->rights->holiday->read_all)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')'; + if (empty($user->rights->holiday->readall)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')'; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; $sql .= $db->order("x.tms", "DESC"); diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index caa76d491cd..41cb07416bb 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -1,11 +1,12 @@ --- Copyright (C) 2001-2004 Rodolphe Quiedeville --- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2012 Laurent Destailleur --- Copyright (C) 2004 Benoit Mortier --- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2012 Regis Houssin --- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2011 Juanjo Menent +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2012 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011 Juanjo Menent +-- Copyright (C) 2020 Udo Tamm -- -- 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 @@ -20,8 +21,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- +----------------------------------------------------------------------------- +-- +-- Do not place a comment at the end of the line, this file is parsed when +-- of the install and all the acronyms '--' are removed. -- -- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors -- de l'install et tous les sigles '--' sont supprimés. @@ -31,149 +35,152 @@ -- Currencies (primary code - code ISO4217 - libelle us) -- -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ALL', '[76,101,107]', 1, 'Albania Lek'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DZD', NULL, 1, 'Algeria Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AFN', '[1547]', 1, 'Afghanistan Afghani'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARS', '[36]', 1, 'Argentino Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AWG', '[402]', 1, 'Aruba Guilder'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AUD', '[36]', 1, 'Australia Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN', '[1084,1072,1085]', 1, 'Azerbaijan New Manat'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BHD', NULL, 1, 'Bahrain'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ALL', '[76,101,107]', 1, 'Albania Lek'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DZD', NULL, 1, 'Algeria Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AFN', '[1547]', 1, 'Afghanistan Afghani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARS', '[36]', 1, 'Argentino Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AWG', '[402]', 1, 'Aruba Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AUD', '[36]', 1, 'Australia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN', '[1084,1072,1085]', 1, 'Azerbaijan New Manat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BHD', NULL, 1, 'Bahrain'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BDT', '[2547]', 1, 'Bangladeshi Taka'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BZD', '[66,90,36]', 1, 'Belize Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BOB', '[36,98]', 1, 'Bolivia Boliviano'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BAM', '[75,77]', 1, 'Bosnia and Herzegovina Convertible Marka'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BWP', '[80]', 1, 'Botswana Pula'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BOB', '[36,98]', 1, 'Bolivia Boliviano'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BAM', '[75,77]', 1, 'Bosnia and Herzegovina Convertible Marka'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BWP', '[80]', 1, 'Botswana Pula'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BGN', '[1083,1074]', 1, 'Bulgaria Lev'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BRL', '[82,36]', 1, 'Brazil Real'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BND', '[36]', 1, 'Brunei Darussalam Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KHR', '[6107]', 1, 'Cambodia Riel'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CAD', '[36]', 1, 'Canada Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KYD', '[36]', 1, 'Cayman Islands Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CLP', '[36]', 1, 'Chile Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CNY', '[165]', 1, 'China Yuan Renminbi'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'COP', '[36]', 1, 'Colombia Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CRC', '[8353]', 1, 'Costa Rica Colon'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HRK', '[107,110]', 1, 'Croatia Kuna'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CUP', '[8369]', 1, 'Cuba Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CZK', '[75,269]', 1, 'Czech Republic Koruna'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DKK', '[107,114]', 1, 'Denmark Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BRL', '[82,36]', 1, 'Brazil Real'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BND', '[36]', 1, 'Brunei Darussalam Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KHR', '[6107]', 1, 'Cambodia Riel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CAD', '[36]', 1, 'Canada Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CVE', '[4217]', 1, 'Cap Verde Escudo'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KYD', '[36]', 1, 'Cayman Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CLP', '[36]', 1, 'Chile Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CNY', '[165]', 1, 'China Yuan Renminbi'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'COP', '[36]', 1, 'Colombia Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CRC', '[8353]', 1, 'Costa Rica Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HRK', '[107,110]', 1, 'Croatia Kuna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CUP', '[8369]', 1, 'Cuba Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CZK', '[75,269]', 1, 'Czech Republic Koruna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DKK', '[107,114]', 1, 'Denmark Krone'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DOP', '[82,68,36]', 1, 'Dominican Republic Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD', '[36]', 1, 'East Caribbean Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1, 'Ghana Cedis'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GNF', '[70,71]', 1, 'Franc Guinéen'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1, 'Gibraltar Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1, 'Guatemala Quetzal'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1, 'Guernsey Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GYD', '[36]', 1, 'Guyana Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HNL', '[76]', 1, 'Honduras Lempira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HKD', '[36]', 1, 'Hong Kong Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HUF', '[70,116]', 1, 'Hungary Forint'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ISK', '[107,114]', 1, 'Iceland Krona'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'INR', '[8377]', 1, 'India Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IDR', '[82,112]', 1, 'Indonesia Rupiah'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IRR', '[65020]', 1, 'Iran Rial'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IMP', '[163]', 1, 'Isle of Man Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS', '[8362]', 1, 'Israel Shekel'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KES', NULL, 1, 'Kenya Shilling'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD', '[36]', 1, 'East Caribbean Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1, 'Ghana Cedis'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GNF', '[70,71]', 1, 'Guinea Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1, 'Gibraltar Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1, 'Guatemala Quetzal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1, 'Guernsey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GYD', '[36]', 1, 'Guyana Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HNL', '[76]', 1, 'Honduras Lempira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HKD', '[36]', 1, 'Hong Kong Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HUF', '[70,116]', 1, 'Hungary Forint'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ISK', '[107,114]', 1, 'Iceland Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'INR', '[8377]', 1, 'India Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IDR', '[82,112]', 1, 'Indonesia Rupiah'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IRR', '[65020]', 1, 'Iran Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IMP', '[163]', 1, 'Isle of Man Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS', '[8362]', 1, 'Israel Shekel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KES', NULL, 1, 'Kenya Shilling'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KZT', '[1083,1074]', 1, 'Kazakhstan Tenge'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KGS', '[1083,1074]', 1, 'Kyrgyzstan Som'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LAK', '[8365]', 1, 'Laos Kip'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL', '[76,115]', 1, 'Latvia Lat'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MGA', NULL, 1, 'Ariary'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LAK', '[8365]', 1, 'Laos Kip'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL', '[76,115]', 1, 'Latvia Lat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MGA', NULL, 1, 'Ariary'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MKD', '[1076,1077,1085]', 1, 'Macedonia Denar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MUR', '[8360]', 1, 'Mauritius Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXN', '[36]', 1, 'Mexico Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MNT', '[8366]', 1, 'Mongolia Tughrik'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MAD', NULL, 1, 'Morocco Dirham'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MZN', '[77,84]', 1, 'Mozambique Metical'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NAD', '[36]', 1, 'Namibia Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NPR', '[8360]', 1, 'Nepal Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ANG', '[402]', 1, 'Netherlands Antilles Guilder'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NZD', '[36]', 1, 'New Zealand Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NIO', '[67,36]', 1, 'Nicaragua Cordoba'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NGN', '[8358]', 1, 'Nigeria Naira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NOK', '[107,114]', 1, 'Norway Krone'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'OMR', '[65020]', 1, 'Oman Rial'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PKR', '[8360]', 1, 'Pakistan Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MUR', '[8360]', 1, 'Mauritius Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXN', '[36]', 1, 'Mexico Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MDL', NULL, 1, 'Moldova Leu'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MNT', '[8366]', 1, 'Mongolia Tughrik'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MAD', NULL, 1, 'Morocco Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MZN', '[77,84]', 1, 'Mozambique Metical'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NAD', '[36]', 1, 'Namibia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NPR', '[8360]', 1, 'Nepal Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ANG', '[402]', 1, 'Netherlands Antilles Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NZD', '[36]', 1, 'New Zealand Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NIO', '[67,36]', 1, 'Nicaragua Cordoba'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NGN', '[8358]', 1, 'Nigeria Naira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NOK', '[107,114]', 1, 'Norway Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'OMR', '[65020]', 1, 'Oman Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PKR', '[8360]', 1, 'Pakistan Rupee'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PAB', '[66,47,46]', 1, 'Panama Balboa'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PYG', '[71,115]', 1, 'Paraguay Guarani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PYG', '[71,115]', 1, 'Paraguay Guarani'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PEN', '[83,47,46]', 1, 'Peru Nuevo Sol'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PHP', '[8369]', 1, 'Philippines Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PLN', '[122,322]', 1, 'Poland Zloty'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'QAR', '[65020]', 1, 'Qatar Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PHP', '[8369]', 1, 'Philippines Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PLN', '[122,322]', 1, 'Poland Zloty'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'QAR', '[65020]', 1, 'Qatar Riyal'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RON', '[108,101,105]', 1, 'Romania New Leu'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RUB', '[1088,1091,1073]', 1, 'Russia Ruble'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SHP', '[163]', 1, 'Saint Helena Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SAR', '[65020]', 1, 'Saudi Arabia Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RUB', '[1088,1091,1073]', 1, 'Russia Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SHP', '[163]', 1, 'Saint Helena Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SAR', '[65020]', 1, 'Saudi Arabia Riyal'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RSD', '[1044,1080,1085,46]', 1, 'Serbia Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SCR', '[8360]', 1, 'Seychelles Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SGD', '[36]', 1, 'Singapore Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SBD', '[36]', 1, 'Solomon Islands Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SOS', '[83]', 1, 'Somalia Shilling'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZAR', '[82]', 1, 'South Africa Rand'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LKR', '[8360]', 1, 'Sri Lanka Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SEK', '[107,114]', 1, 'Sweden Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SCR', '[8360]', 1, 'Seychelles Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SGD', '[36]', 1, 'Singapore Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SBD', '[36]', 1, 'Solomon Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SOS', '[83]', 1, 'Somalia Shilling'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZAR', '[82]', 1, 'South Africa Rand'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LKR', '[8360]', 1, 'Sri Lanka Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SEK', '[107,114]', 1, 'Sweden Krona'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CHF', '[67,72,70]', 1, 'Switzerland Franc'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SRD', '[36]', 1, 'Suriname Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SYP', '[163]', 1, 'Syria Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SRD', '[36]', 1, 'Suriname Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SYP', '[163]', 1, 'Syria Pound'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TWD', '[78,84,36]', 1, 'Taiwan New Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TTD', '[84,84,36]', 1, 'Trinidad and Tobago Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRL', '[84,76]', 1, 'Turkey Lira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GBP', '[163]', 1, 'United Kingdom Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'USD', '[36]', 1, 'United States Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UYU', '[36,85]', 1, 'Uruguay Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GBP', '[163]', 1, 'United Kingdom Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'USD', '[36]', 1, 'United States Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UYU', '[36,85]', 1, 'Uruguay Peso'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UZS', '[1083,1074]', 1, 'Uzbekistan Som'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF', '[66,115]', 1, 'Venezuela Bolivar Fuerte'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', '[70]', 1, 'Franc CFP'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF', '[66,115]', 1, 'Venezuela Bolivar Fuerte'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', '[70]', 1, 'Franc CFP'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); -- obsolete -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ATS', NULL, 0, 'Shiliing autrichiens'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BEF', NULL, 0, 'Francs belges'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DEM', NULL, 0, 'Deutsch mark'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ESP', NULL, 0, 'Pesete'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FIM', NULL, 0, 'Mark finlandais'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FRF', NULL, 0, 'Francs francais'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GRD', NULL, 0, 'Drachme (grece)'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IEP', NULL, 0, 'Livres irlandaises'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ITL', NULL, 0, 'Lires'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LUF', NULL, 0, 'Francs luxembourgeois'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NLG', NULL, 0, 'Florins'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PTE', NULL, 0, 'Escudos'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SKK', NULL, 0, 'Couronnes slovaques'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SUR', NULL, 0, 'Rouble'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU', NULL, 0, 'Ecus'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ATS', NULL, 0, 'Shiliing autrichiens'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BEF', NULL, 0, 'Francs belges'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DEM', NULL, 0, 'Deutsche Mark'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ESP', NULL, 0, 'Pesete'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FIM', NULL, 0, 'Mark finlandais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FRF', NULL, 0, 'Francs francais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GRD', NULL, 0, 'Drachme (grece)'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IEP', NULL, 0, 'Livres irlandaises'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ITL', NULL, 0, 'Lires'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LUF', NULL, 0, 'Francs luxembourgeois'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NLG', NULL, 0, 'Florins'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PTE', NULL, 0, 'Escudos'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SKK', NULL, 0, 'Couronnes slovaques'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SUR', NULL, 0, 'Rouble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU', NULL, 0, 'Ecus'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRL', '[84,76]', 0, 'Turkey Lira'); + -- invalid (for compatibility) INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins'); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index d52257c4157..b042fea292d 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -59,6 +59,10 @@ ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object); -- For v13 +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (112,11, '4','0','Sales Tax 4%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (113,11, '6','0','Sales Tax 6%',1); + ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0; UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets'; @@ -362,6 +366,8 @@ ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_t ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL; ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL; +ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL; + ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL; ALTER TABLE llx_expensereport_ik ADD COLUMN ikoffset double DEFAULT 0 NOT NULL; @@ -406,6 +412,7 @@ ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime; DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'); DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'; +UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday'; CREATE TABLE llx_c_product_nature ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_c_ticket_severity.sql b/htdocs/install/mysql/tables/llx_c_ticket_severity.sql index bb8a75abaa9..b9f565c4395 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_severity.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_severity.sql @@ -22,7 +22,7 @@ create table llx_c_ticket_severity code varchar(32) NOT NULL, pos varchar(32) NOT NULL, label varchar(128) NOT NULL, - color varchar(10) NOT NULL, + color varchar(10) NULL, active integer DEFAULT 1, use_default integer DEFAULT 1, description varchar(255) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 7b41e7030b1..a77606abb3f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2068,8 +2068,8 @@ function migrate_commande_livraison($db, $langs, $conf) $db->begin(); - $sql = "SELECT l.rowid, l.fk_commande"; - $sql .= ", c.ref_client, c.date_livraison"; + $sql = "SELECT l.rowid, l.fk_commande,"; + $sql .= " c.ref_client, c.date_livraison as delivery_date"; $sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c"; $sql .= " WHERE c.rowid = l.fk_commande"; $resql = $db->query($sql); @@ -2090,7 +2090,7 @@ function migrate_commande_livraison($db, $langs, $conf) if ($resql2) { - $delivery_date = $db->jdate($obj->date_livraison); + $delivery_date = $db->jdate($obj->delivery_date); $sqlu = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; $sqlu .= " ref_client='".$db->escape($obj->ref_client)."'"; @@ -3007,7 +3007,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) if ($db->query($sqlAdd1) && $db->query($sqlAdd2)) { - $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison"; + $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison as delivery_date"; $sqlSelect .= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sqlSelect .= ", ".MAIN_DB_PREFIX."element_element as el"; $sqlSelect .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = el.fk_source AND el.sourcetype = 'commande'"; @@ -3028,7 +3028,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) $sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sqlUpdate .= " ref_customer = '".$db->escape($obj->ref_client)."'"; - $sqlUpdate .= ", date_delivery = '".$db->escape($obj->date_livraison ? $obj->date_livraison : 'null')."'"; + $sqlUpdate .= ", date_delivery = '".$db->escape($obj->delivery_date ? $obj->delivery_date : 'null')."'"; $sqlUpdate .= " WHERE rowid = ".$obj->shipping_id; $result = $db->query($sqlUpdate); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3da5c3aff62..ac3fb07e796 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -836,10 +836,11 @@ Permission402=Create/modify discounts Permission403=Validate discounts Permission404=Delete discounts Permission430=Use Debug Bar -Permission511=Read payments of salaries +Permission511=Read payments of salaries (yours and subordinates) Permission512=Create/modify payments of salaries Permission514=Delete payments of salaries -Permission517=Export salaries +Permission517=Read payments of salaries of everybody +Permission519=Export salaries Permission520=Read Loans Permission522=Create/modify loans Permission524=Delete loans @@ -1419,6 +1420,7 @@ AdherentMailRequired=Email required to create a new member MemberSendInformationByMailByDefault=Checkbox to send mail confirmation to members (validation or new subscription) is on by default VisitorCanChooseItsPaymentMode=Visitor can choose from available payment modes MEMBER_REMINDER_EMAIL=Enable automatic reminder by email of expired subscriptions. Note: Module %s must be enabled and correctly setup to send reminders. +MembersDocModules=Document templates for documents generated from member record ##### LDAP setup ##### LDAPSetup=LDAP Setup LDAPGlobalParameters=Global parameters @@ -2078,4 +2080,4 @@ DictionaryProductNature= Nature of product CountryIfSpecificToOneCountry=Country (if specific to a given country) YouMayFindSecurityAdviceHere=You may find security advisory here ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it. -ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. \ No newline at end of file +ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 715c3dfb8f5..18ee01eb3bb 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -111,7 +111,7 @@ Refund=Refund SocialContributionsPayments=Social/fiscal taxes payments ShowVatPayment=Show VAT payment TotalToPay=Total to pay -BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted ascending on %s and filtered for 1 bank account +BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted on %s and filtered on 1 bank account (with no other filters) CustomerAccountancyCode=Customer accounting code SupplierAccountancyCode=Vendor accounting code CustomerAccountancyCodeShort=Cust. account. code diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index aaf81b0f346..71df60734fb 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -23,19 +23,7 @@ ECMSearchByKeywords=Search by keywords ECMSearchByEntity=Search by object ECMSectionOfDocuments=Directories of documents ECMTypeAuto=Automatic -ECMDocsBySocialContributions=Documents linked to social or fiscal taxes -ECMDocsByThirdParties=Documents linked to third parties -ECMDocsByProposals=Documents linked to proposals -ECMDocsByOrders=Documents linked to customers orders -ECMDocsByContracts=Documents linked to contracts -ECMDocsByInvoices=Documents linked to customers invoices -ECMDocsByProducts=Documents linked to products -ECMDocsByProjects=Documents linked to projects -ECMDocsByUsers=Documents linked to users -ECMDocsByInterventions=Documents linked to interventions -ECMDocsByExpenseReports=Documents linked to expense reports -ECMDocsByHolidays=Documents linked to holidays -ECMDocsBySupplierProposals=Documents linked to vendor proposals +ECMDocsBy=Documents linked to %s ECMNoDirectoryYet=No directory created ShowECMSection=Show directory DeleteSection=Remove directory diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 2d708c04147..63947dad154 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -8,15 +8,9 @@ ConfFileIsNotWritable=Configuration file %s is not writable. Check permis ConfFileIsWritable=Configuration file %s is writable. ConfFileMustBeAFileNotADir=Configuration file %s must be a file, not a directory. ConfFileReload=Reloading parameters from configuration file. -PHPSupportSessions=This PHP supports sessions. PHPSupportPOSTGETOk=This PHP supports variables POST and GET. PHPSupportPOSTGETKo=It's possible your PHP setup does not support variables POST and/or GET. Check the parameter variables_order in php.ini. -PHPSupportGD=This PHP supports GD graphical functions. -PHPSupportCurl=This PHP supports Curl. -PHPSupportCalendar=This PHP supports calendars extensions. -PHPSupportUTF8=This PHP supports UTF8 functions. -PHPSupportIntl=This PHP supports Intl functions. -PHPSupportxDebug=This PHP supports extended debug functions. +PHPSupportSessions=This PHP supports sessions. PHPSupport=This PHP supports %s functions. PHPMemoryOK=Your PHP max session memory is set to %s. This should be enough. PHPMemoryTooLow=Your PHP max session memory is set to %s bytes. This is too low. Change your php.ini to set memory_limit parameter to at least %s bytes. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2068a37af2b..850d87ff883 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -197,6 +197,7 @@ ReOpen=Re-Open Upload=Upload ToLink=Link Select=Select +SelectAll=Select all Choose=Choose Resize=Resize ResizeOrCrop=Resize or Crop diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 97db059594f..00f08a0804e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -167,8 +167,10 @@ BuyingPrices=Buying prices CustomerPrices=Customer prices SuppliersPrices=Vendor prices SuppliersPricesOfProductsOrServices=Vendor prices (of products or services) -CustomCode=Customs / Commodity / HS code +CustomCode=Customs|Commodity|HS code CountryOrigin=Origin country +RegionStateOrigin=Region origin +StateOrigin=State|Province origin Nature=Nature of product (material/finished) NatureOfProductShort=Nature of product NatureOfProductDesc=Raw material or finished product diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ac97c24085c..d2c1b2cb382 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -34,7 +34,7 @@ StockMovementForId=Movement ID %d ListMouvementStockProject=List of stock movements associated to project StocksArea=Warehouses area AllWarehouses=All warehouses -IncludeEmptyDesiredStock=Include also undefined desired stock +IncludeEmptyDesiredStock=Include also negative stock with undefined desired stock IncludeAlsoDraftOrders=Include also draft orders Location=Location LocationSummary=Short name location @@ -122,8 +122,9 @@ DesiredStockDesc=This stock amount will be the value used to fill the stock by r StockToBuy=To order Replenishment=Replenishment ReplenishmentOrders=Replenishment orders -VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical + current orders) may differ -UseVirtualStockByDefault=Use virtual stock by default, instead of physical stock, for replenishment feature +VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical stock + open orders) may differ +UseRealStockByDefault=Use real stock, instead of virtual stock, for replenishment feature +ReplenishmentCalculation=Amount to order will be (desired quantity - real stock) instead of (desired quantity - virtual stock) UseVirtualStock=Use virtual stock UsePhysicalStock=Use physical stock CurentSelectionMode=Current selection mode diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d57a9b154a3..b5eb35dd2d9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -988,7 +988,7 @@ if (!defined('NOLOGIN')) $user->getrights(); } -dol_syslog("--- Access to ".$_SERVER["REQUEST_METHOD"].' '.$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'aZ09').', massaction='.GETPOST('massaction', 'aZ09')); +dol_syslog("--- Access to ".$_SERVER["REQUEST_METHOD"].' '.$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'aZ09').', massaction='.GETPOST('massaction', 'aZ09').' NOTOKENRENEWAL='.constant('NOTOKENRENEWAL')); //Another call for easy debugg //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST)); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index dfa8b5adef6..051a2d1a42d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1200,7 +1200,7 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { - $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); + $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); } } } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index ea9eeed797d..60a7b8315a9 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -1148,7 +1148,7 @@ class pdf_standard_myobject extends ModelePDFMyObject protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 96bcd2af739..15c52a52539 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -41,14 +41,13 @@ $cancel = GETPOST('cancel', 'alpha'); $numsondage = ''; if (GETPOST('id')) { - $numsondage = GETPOST('id', 'alpha'); + $numsondage = (string) GETPOST('id', 'alpha'); } $object = new Opensurveysondage($db); $result = $object->fetch(0, $numsondage); -if ($result <= 0) -{ +if ($result <= 0) { dol_print_error($db, $object->error); exit; } @@ -112,17 +111,16 @@ if (empty($reshook)) if (!$error) { - $object->title = GETPOST('nouveautitre', 'nohtml'); - $object->description = GETPOST('nouveauxcommentaires', 'restricthtml'); - $object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); + $object->title = (string) GETPOST('nouveautitre', 'alphanohtml'); + $object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml'); + $object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; - $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0; - $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0; - $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; + $object->allow_comments = GETPOST('cancomment', 'aZ09') == 'on' ? 1 : 0; + $object->allow_spy = GETPOST('canseeothersvote', 'aZ09') == 'on' ? 1 : 0; + $object->mailsonde = GETPOST('mailsonde', 'aZ09') == 'on' ? 1 : 0; $res = $object->update($user); - if ($res < 0) - { + if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } @@ -134,21 +132,18 @@ if (empty($reshook)) { $error = 0; - if (!GETPOST('comment')) - { + if (!GETPOST('comment')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } - if (!GETPOST('commentuser')) - { + if (!GETPOST('commentuser')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); } - if (!$error) - { - $comment = GETPOST("comment"); - $comment_user = GETPOST('commentuser'); + if (!$error) { + $comment = (string) GETPOST("comment", "restricthtml"); + $comment_user = (string) GETPOST('commentuser', "restricthtml"); $resql = $object->addComment($comment, $comment_user); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index f8f6cb0f885..83d10d64e07 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2020 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 @@ -49,7 +50,6 @@ class Opensurveysondage extends CommonObject */ public $picto = 'poll'; - /** * @var string ID survey */ @@ -60,7 +60,14 @@ class Opensurveysondage extends CommonObject */ public $description; + /** + * @var string email admin + */ public $mail_admin; + + /** + * @var string admin name + */ public $nom_admin; /** @@ -75,10 +82,25 @@ class Opensurveysondage extends CommonObject public $title; public $date_fin = ''; + + /** + * @var int status + */ public $status = 1; + + /** + * @var string format of survey + */ public $format; + + /** + * @var int mailsonde + */ public $mailsonde; + /** + * @var string subject + */ public $sujet; /** @@ -133,8 +155,7 @@ class Opensurveysondage extends CommonObject $this->cleanParameters(); // Check parameters - if (!$this->date_fin > 0) - { + if (!$this->date_fin > 0) { $this->error = 'BadValueForEndDate'; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; @@ -156,10 +177,10 @@ class Opensurveysondage extends CommonObject $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($this->id_sondage)."',"; $sql .= " ".(empty($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").","; - $sql .= " ".$user->id.","; + $sql .= " ".(int) $user->id.","; $sql .= " '".$this->db->escape($this->title)."',"; $sql .= " '".$this->db->idate($this->date_fin)."',"; - $sql .= " ".$this->status.","; + $sql .= " ".(int) $this->status.","; $sql .= " '".$this->db->escape($this->format)."',"; $sql .= " ".$this->db->escape($this->mailsonde).","; $sql .= " ".$this->db->escape($this->allow_comments).","; @@ -173,24 +194,18 @@ class Opensurveysondage extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error) - { - if (!$notrigger) - { - global $langs, $conf; + if (!$error && !$notrigger) { + global $langs, $conf; - // Call trigger - $result = $this->call_trigger('OPENSURVEY_CREATE', $user); - if ($result < 0) $error++; - // End call triggers - } + // Call trigger + $result = $this->call_trigger('OPENSURVEY_CREATE', $user); + if ($result < 0) $error++; + // End call triggers } // Commit or rollback - if ($error) - { - foreach ($this->errors as $errmsg) - { + if ($error) { + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } @@ -310,10 +325,12 @@ class Opensurveysondage extends CommonObject dol_syslog(get_class($this)."::update", 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 && !$notrigger) - { + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('OPENSURVEY_MODIFY', $user); if ($result < 0) $error++; @@ -356,15 +373,11 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('OPENSURVEY_DELETE', $user); - if ($result < 0) $error++; - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('OPENSURVEY_DELETE', $user); + if ($result < 0) $error++; + // End call triggers } if (!$error) @@ -441,7 +454,9 @@ class Opensurveysondage extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else { + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } $linkstart = ''; @@ -499,15 +514,15 @@ class Opensurveysondage extends CommonObject { $this->id = 0; - $this->id_sondage = ''; + $this->id_sondage = 'a12d5g'; $this->description = 'Description of the specimen survey'; - $this->mail_admin = ''; - $this->nom_admin = ''; + $this->mail_admin = 'email@email.com'; + $this->nom_admin = 'surveyadmin'; $this->title = 'This is a specimen survey'; $this->date_fin = dol_now() + 3600 * 24 * 10; $this->status = 1; $this->format = 'classic'; - $this->mailsonde = ''; + $this->mailsonde = 0; } /** @@ -591,7 +606,7 @@ class Opensurveysondage extends CommonObject $this->mail_admin = trim($this->mail_admin); $this->nom_admin = trim($this->nom_admin); $this->title = trim($this->title); - $this->status = trim($this->status); + $this->status = (int) $this->status; $this->format = trim($this->format); $this->mailsonde = ($this->mailsonde ? 1 : 0); $this->allow_comments = ($this->allow_comments ? 1 : 0); diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 208646c0a23..0ea701ebf0b 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -115,7 +115,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 04933018410..33a30a00f47 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1175,10 +1175,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // State if (empty($conf->global->PRODUCT_DISABLE_STATE)) { - if ($conf->browser->layout == 'phone') print ''; + if ($conf->browser->layout == 'phone') print ''; if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''; } - print ''; + + print ''; } // Other attributes @@ -1634,7 +1635,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($conf->browser->layout == 'phone') print ''; if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''; + print ''; - // Select field - print ''; + // Select field + print ''; - print ''; + print ''; - print ''; + print ''; - if (!empty($conf->service->enabled) && $type == 1) - { - $regs = array(); - if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationYear'); - } elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationMonth'); - } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationDay'); - } else { - $duration = $objp->duration; - } - print ''; + if (!empty($conf->service->enabled) && $type == 1) + { + $regs = array(); + if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) { + $duration = $regs[1].' '.$langs->trans('DurationYear'); + } elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) { + $duration = $regs[1].' '.$langs->trans('DurationMonth'); + } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) { + $duration = $regs[1].' '.$langs->trans('DurationDay'); + } else { + $duration = $objp->duration; } - - // Desired stock - print ''; - - // Limit stock for alert - print ''; - - // Current stock (all warehouses) - print ''; - - // Current stock (warehouse selected only) - if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) - { - print ''; - } - - // Already ordered - print ''; - - // To order - print ''; - - // Supplier - print ''; - - // Fields from hook - $parameters = array('objp'=>$objp); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print ''; + print ''; } + + // Desired stock + print ''; + + // Limit stock for alert + print ''; + + // Current stock (all warehouses) + print ''; + + // Current stock (warehouse selected only) + if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) + { + print ''; + } + + // Already ordered + print ''; + + // To order + print ''; + + // Supplier + print ''; + + // Fields from hook + $parameters = array('objp'=>$objp); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; } $i++; } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 28bb941c687..7329c18cdd8 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1471,7 +1471,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; print ' '; - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; print img_delete('default', 'class="pictodelete paddingleft"'); print ''; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 8ada0a9b291..517e201d20f 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -123,7 +123,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index b71f5a84cd0..56690f78a42 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -185,7 +185,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 03dbf71051b..d90f8684673 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -788,7 +788,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index e2d28044de5..ac92c958931 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -238,7 +238,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 98907ee9d02..5a49cec5bbe 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -178,7 +178,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index a76b49d1394..d8b2a4280cf 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -211,7 +211,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } @@ -278,7 +278,7 @@ if (empty($emailforcontact)) { $emailforcontact = $mysoc->email; } } -print ''; +print ''; print $tmpuser->getFullName(-1); print ' - '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 1); print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 62fc287fba3..169ffd327ad 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -111,6 +111,8 @@ $hookmanager->initHooks(array('receptioncard', 'globalcard')); $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -226,8 +228,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // On va boucler sur chaque ligne du document d'origine pour completer objet reception // avec info diverses + qte a livrer @@ -777,8 +777,7 @@ if ($action == 'create') // Date delivery planned print ''; print '\n"; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b99ba707251..4df73cce925 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -409,7 +409,7 @@ $formfile = new FormFile($db); $helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones'; llxHeader('', $langs->trans('ListOfReceptions'), $helpurl); -$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; +$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,"; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -499,21 +499,21 @@ if ($resql) $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($sall) $param .= "&sall=".$sall; - if ($search_ref_rcp) $param .= "&search_ref_rcp=".$search_ref_rcp; - if ($search_ref_liv) $param .= "&search_ref_liv=".$search_ref_liv; - if ($search_company) $param .= "&search_company=".$search_company; - if ($optioncss != '') $param .= '&optioncss='.$optioncss; - if ($search_billed != '' && $search_billed >= 0)$param .= "&search_billed=".$search_billed; - if ($search_town) $param .= "&search_town=".$search_town; - if ($search_zip) $param .= "&search_zip=".$search_zip; - if ($search_state) $param .= "&search_state=".$search_state; - if ($search_status) $param .= "&search_status=".$search_status; - if ($search_country) $param .= "&search_country=".$search_country; - if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".$search_type_thirdparty; - if ($search_ref_supplier) $param .= "&search_ref_supplier=".$search_ref_supplier; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($sall) $param .= "&sall=".urlencode($sall); + if ($search_ref_rcp) $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); + if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_company) $param .= "&search_company=".urlencode($search_company); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_billed != '' && $search_billed >= 0) $param .= "&search_billed=".urlencode($search_billed); + if ($search_town) $param .= "&search_town=".urlencode($search_town); + if ($search_zip) $param .= "&search_zip=".urlencode($search_zip); + if ($search_state) $param .= "&search_state=".urlencode($search_state); + if ($search_status) $param .= "&search_status=".urlencode($search_status); + if ($search_country) $param .= "&search_country=".urlencode($search_country); + if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -838,7 +838,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e189d149bf7..74bbf1afa7e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -109,6 +109,12 @@ class SupplierProposal extends CommonObject */ public $date; + /** + * @var integer|string date_livraison + * @deprecated + */ + public $date_livraison; + /** * @var integer|string date_livraison */ @@ -855,8 +861,6 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -3; } - - // Check parameters if (!empty($this->ref)) // We check that ref is not already used { $result = self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used @@ -869,6 +873,9 @@ class SupplierProposal extends CommonObject } } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + // Multicurrency if (!empty($this->multicurrency_code)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now); if (empty($this->fk_multicurrency)) @@ -923,7 +930,7 @@ class SupplierProposal extends CommonObject $sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL'); $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".$conf->entity; @@ -1201,7 +1208,7 @@ class SupplierProposal extends CommonObject $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql .= ", p.datec"; $sql .= ", p.date_valid as datev"; - $sql .= ", p.date_livraison as date_livraison"; + $sql .= ", p.date_livraison as delivery_date"; $sql .= ", p.model_pdf, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; @@ -1256,7 +1263,8 @@ class SupplierProposal extends CommonObject $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date - $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->mode_reglement_id = $obj->fk_mode_reglement; @@ -1537,6 +1545,7 @@ class SupplierProposal extends CommonObject if ($this->db->query($sql)) { $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; return 1; } else { $this->error = $this->db->error(); diff --git a/htdocs/takepos/admin/orderprinters.php b/htdocs/takepos/admin/orderprinters.php index c7ebbebffb7..3104f907eb2 100644 --- a/htdocs/takepos/admin/orderprinters.php +++ b/htdocs/takepos/admin/orderprinters.php @@ -215,6 +215,8 @@ if ($nbofentries > 0) print '
'; $validator = new UserGroup($db); @@ -631,7 +631,7 @@ if ($resql) // If we ask a dedicated card and not allow to see it, we force on user. - if ($id && empty($user->rights->holiday->read_all) && !in_array($id, $childids)) { + if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { $langs->load("errors"); print '
'.$langs->trans("NotEnoughPermissions").'
'.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).''; + print ''.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; } else { print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; } @@ -1186,7 +1186,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $formcompany->select_state($object->state_id, $object->country_code); print '
'.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).''; + print ''.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; } else { print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 59d34f728b1..292690020b9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3807,11 +3807,11 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Verifie si c'est un sous-produit + * Check if it is a sub-product into a kit * - * @param int $fk_parent Id du produit auquel le produit est lie - * @param int $fk_child Id du produit lie - * @return int < 0 si erreur, > 0 si ok + * @param int $fk_parent Id of parent kit product + * @param int $fk_child Id of child product + * @return int <0 if KO, >0 if OK */ public function is_sousproduit($fk_parent, $fk_child) { @@ -3827,6 +3827,7 @@ class Product extends CommonObject if ($num > 0) { $obj = $this->db->fetch_object($result); + $this->is_sousproduit_qty = $obj->qty; $this->is_sousproduit_incdec = $obj->incdec; @@ -4221,17 +4222,26 @@ class Product extends CommonObject } /** - * Return all parent products for current product (first level only) + * Count all parent and children products for current product (first level only) * - * @return int Nb of father + child + * @param int $mode 0=Both parent and child, -1=Parents only, 1=Children only + * @return int Nb of father + child + * @see getFather(), get_sousproduits_arbo() */ - public function hasFatherOrChild() + public function hasFatherOrChild($mode = 0) { $nb = 0; $sql = "SELECT COUNT(pa.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."product_association as pa"; - $sql .= " WHERE pa.fk_product_fils = ".$this->id." OR pa.fk_product_pere = ".$this->id; + if ($mode == 0) { + $sql .= " WHERE pa.fk_product_fils = ".$this->id." OR pa.fk_product_pere = ".$this->id; + } elseif ($mode == -1) { + $sql .= " WHERE pa.fk_product_fils = ".$this->id; // We are a child, so we found lines that link to parents (can have several parents) + } elseif ($mode == 1) { + $sql .= " WHERE pa.fk_product_pere = ".$this->id; // We are a parent, so we found lines that link to children (can have several children) + } + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -4297,6 +4307,7 @@ class Product extends CommonObject * Return all parent products for current product (first level only) * * @return array Array of product + * @see hasFatherOrChild() */ public function getFather() { diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 4bedbd3d2ba..f89305b4d95 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -170,6 +170,7 @@ if ($id > 0 || !empty($ref)) if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print '
'."\n"; + print ''; if (!empty($sortfield)) print ''; if (!empty($sortorder)) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 0fd5a658a0b..860044433d7 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -80,7 +80,6 @@ if (!$sortorder) { $sortorder = 'ASC'; } -// Define virtualdiffersfromphysical $virtualdiffersfromphysical = 0; if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) @@ -92,7 +91,11 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) $virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs. } -$usevirtualstock = !empty($conf->global->STOCK_USE_VIRTUAL_STOCK); +if ($virtualdiffersfromphysical) { + $usevirtualstock = empty($conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT) ? 1 : 0; +} else { + $usevirtualstock = 0; +} if ($mode == 'physical') $usevirtualstock = 0; if ($mode == 'virtual') $usevirtualstock = 1; @@ -349,7 +352,9 @@ if (dol_strlen($type)) { if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_label) $sql .= natural_search('p.label', $search_label); $sql .= ' AND p.tobuy = 1'; -if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"'; +if (empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { // Add test to exclude products that has variants + $sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))'; +} $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price'; $sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms'; $sql .= ', p.duration, p.tobuy'; @@ -432,7 +437,7 @@ if ($usevirtualstock) $sql .= ' HAVING ('; $sql .= ' ('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; - $sql .= ' OR '; + $sql .= ' OR'; if ($includeproductswithoutdesiredqty == 'on') { $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } else { @@ -443,9 +448,9 @@ if ($usevirtualstock) if ($salert == 'on') // Option to see when stock is lower than alert { - $sql .= ' AND (('; + $sql .= ' AND ('; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= $sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql .= '('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } else { $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } @@ -454,20 +459,25 @@ if ($usevirtualstock) $alertchecked = 'checked'; } } else { - $sql .= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' HAVING ('; + $sql .= '('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' OR'; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= ' OR (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; } else { - $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; } + $sql .= ')'; if ($salert == 'on') // Option to see when stock is lower than alert { + $sql .= ' AND ('; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= ' AND (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' ('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))'; } else { - $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' '.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))'; } + $sql .= ')'; $alertchecked = 'checked'; } } @@ -526,22 +536,23 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock'); print dol_get_fiche_head($head, 'replenish', '', -1, ''); -print ''.$langs->trans("ReplenishmentStatusDesc").'
'."\n"; +print ''.$langs->trans("ReplenishmentStatusDesc").''."\n"; if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { print ''.$langs->trans("ReplenishmentStatusDescPerWarehouse").''."
\n"; } +print '
'; if ($usevirtualstock == 1) { print $langs->trans("CurentSelectionMode").': '; - print $langs->trans("CurentlyUsingVirtualStock"); - print ' ('.$langs->trans("UsePhysicalStock").')'; + print ''.$langs->trans("UseVirtualStock").''; + print ' 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").''; print '
'; } if ($usevirtualstock == 0) { print $langs->trans("CurentSelectionMode").': '; - print $langs->trans("CurentlyUsingPhysicalStock"); - print ' ('.$langs->trans("UseVirtualStock").')'; + print ' 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").''; + print ' '.$langs->trans("UsePhysicalStock").''; print '
'; } print '
'."\n"; @@ -591,54 +602,33 @@ print ''; if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { - $filters = '&search_ref='.$search_ref.'&search_label='.$search_label; - $filters .= '&sall='.$sall; - $filters .= '&salert='.$salert; - $filters .= '&draftorder='.$draftorder; - $filters .= '&mode='.$mode; - $filters .= '&fk_supplier='.$fk_supplier; - $filters .= '&fk_entrepot='.$fk_entrepot; - print_barre_liste( - $texte, - $page, - 'replenish.php', - $filters, - $sortfield, - $sortorder, - '', - $num - ); + $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); + $filters .= '&sall='.urlencode($sall); + $filters .= '&salert='.urlencode($salert); + $filters .= '&draftorder='.urlencode($draftorder); + $filters .= '&mode='.urlencode($mode); + if ($fk_supplier > 0) $filters .= '&fk_supplier='.urlencode($fk_supplier); + if ($fk_entrepot > 0) $filters .= '&fk_entrepot='.urlencode($fk_entrepot); } else { - $filters = '&search_ref='.$search_ref.'&search_label='.$search_label; - $filters .= '&fourn_id='.$fourn_id; - $filters .= (isset($type) ? '&type='.$type : ''); - $filters .= '&='.$salert; - $filters .= '&draftorder='.$draftorder; - $filters .= '&mode='.$mode; - $filters .= '&fk_supplier='.$fk_supplier; - $filters .= '&fk_entrepot='.$fk_entrepot; - print_barre_liste( - $texte, - $page, - 'replenish.php', - $filters, - $sortfield, - $sortorder, - '', - $num - ); + $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); + $filters .= '&fourn_id='.urlencode($fourn_id); + $filters .= (isset($type) ? '&type='.urlencode($type) : ''); + $filters .= '&='.urlencode($salert); + $filters .= '&draftorder='.urlencode($draftorder); + $filters .= '&mode='.urlencode($mode); + if ($fk_supplier > 0) $filters .= '&fk_supplier='.urlencode($fk_supplier); + if ($fk_entrepot > 0) $filters .= '&fk_entrepot='.urlencode($fk_entrepot); } - if ($limit > 0 && $limit != $conf->liste_limit) { $filters .= '&limit='.urlencode($limit); } -$param = (isset($type) ? '&type='.$type : ''); -$param .= '&fourn_id='.$fourn_id.'&search_label='.$search_label.'&includeproductswithoutdesiredqty='.$includeproductswithoutdesiredqty.'&salert='.$salert.'&draftorder='.$draftorder; -$param .= '&search_ref='.$search_ref; -$param .= '&mode='.$mode; -$param .= '&fk_supplier='.$fk_supplier; -$param .= '&fk_entrepot='.$fk_entrepot; +$param = (isset($type) ? '&type='.urlencode($type) : ''); +$param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder); +$param .= '&search_ref='.urlencode($search_ref); +$param .= '&mode='.urlencode($mode); +$param .= '&fk_supplier='.urlencode($fk_supplier); +$param .= '&fk_entrepot='.urlencode($fk_entrepot); $stocklabel = $langs->trans('Stock'); $stocklabelbis = $langs->trans('Stock'); @@ -651,6 +641,8 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre } $texte = $langs->trans('Replenishment'); +print '
'; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { @@ -664,7 +656,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { '', $num, $nbtotalofrecords, - 'object_stock.png', + '', 0, '', '', @@ -681,7 +673,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { '', $num, $nbtotalofrecords, - 'object_stock.png' + '' ); } @@ -830,67 +822,64 @@ while ($i < ($limit ? min($num, $limit) : $num)) $picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), 'help'); } - $variants = $prod->hasVariants(); - if (!$variants || !empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { - print '
'.$prod->getNomUrl(1, 'stock').''.$prod->getNomUrl(1, 'stock').''.$objp->label; - print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST - print ''.$objp->label; + print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST + print ''.$duration.''.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).''.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).''.$warning.$stock.''.$warningwarehouse.$stockwarehouse.''.$ordered.' '.$picto.''; - print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier); - print '
'.$duration.''.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).''.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).''.$warning.$stock.''.$warningwarehouse.$stockwarehouse.''.$ordered.' '.$picto.''; + print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier); + print '
'.$langs->trans("DateDeliveryPlanned").''; - //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "
'; - print dol_print_date($db->jdate($obj->date_livraison), "day"); + print dol_print_date($db->jdate($obj->delivery_date), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index ee0f63f6c4f..378376ea799 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -1060,7 +1060,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 8f6f636c4b2..3ef6531e6fd 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -31,11 +31,6 @@ if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/account // Load translation files required by the page $langs->loadLangs(array("compta", "salaries", "bills", "hrm")); -// Security check -$socid = GETPOST("socid", "int"); -if ($user->socid) $socid = $user->socid; -$result = restrictedArea($user, 'salaries', '', '', ''); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); @@ -71,6 +66,13 @@ if (!GETPOST('typeid', 'int')) $typeid = GETPOST('typeid', 'int'); } +$childids = $user->getAllChildIds(1); + +// Security check +$socid = GETPOST("socid", "int"); +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'salaries', '', '', ''); + /* @@ -112,6 +114,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.ro $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = s.fk_user"; $sql .= " AND s.entity = ".$conf->entity; +if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")"; // Search criteria if ($search_ref) $sql .= " AND s.rowid=".$search_ref; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 761365e1280..d7ca24299b0 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -611,7 +611,7 @@ if (empty($reshook)) $tokenstring['stripe_user_id'] = $stripesup->id; $tokenstring['type'] = $stripesup->type; $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; + $sql .= " SET tokenstring = '".$db->escape(json_encode($tokenstring))."'"; $sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$db->escape($site_account)."') AND fk_soc = ".$object->id." AND service = '".$db->escape($service)."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! // TODO Add site and site_account on oauth_token table $sql .= " WHERE fk_soc = ".$object->id." AND service = '".$db->escape($service)."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! @@ -630,7 +630,7 @@ if (empty($reshook)) $tokenstring['stripe_user_id'] = $stripesup->id; $tokenstring['type'] = $stripesup->type; $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)"; - $sql .= " VALUES ('".$db->escape($service)."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')"; + $sql .= " VALUES ('".$db->escape($service)."', ".$object->id.", ".$conf->entity.", '".$db->escape(json_encode($tokenstring))."')"; // TODO Add site and site_account on oauth_token table } catch (Exception $e) { $error++; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 742072cdcc1..93f1ed066af 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -110,7 +110,7 @@ class Stripe extends CommonObject $obj = $this->db->fetch_object($result); $tokenstring = $obj->tokenstring; - $tmparray = dol_json_decode($tokenstring); + $tmparray = json_decode($tokenstring); $key = $tmparray->stripe_user_id; } else { $tokenstring = ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 066d68b8902..eb918d8b3b4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -257,7 +257,8 @@ if (empty($reshook)) { if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) { $object->ref = GETPOST('ref'); - $object->date_livraison = $date_delivery; + $object->date_livraison = $date_delivery; // deprecated + $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); @@ -279,6 +280,7 @@ if (empty($reshook)) } else { $object->ref = GETPOST('ref'); $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->demand_reason_id = GETPOST('demand_reason_id'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); @@ -1563,11 +1565,11 @@ if ($action == 'create') print ''; print ''; print ''; - print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); + print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); print ''; print ''; } else { - print dol_print_date($object->date_livraison, 'daytext'); + print dol_print_date($object->delivery_date, 'daytext'); } print '
'; print ''; } +print ""; +print ''; //Printer3 print ''; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 0427e239792..00086bef5ca 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -65,6 +65,8 @@ if (GETPOST('action', 'alpha') == 'set') } elseif (GETPOST('action', 'alpha') == 'setmethod') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); + // TakePOS connector require ReceiptPrinter module + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && !$conf->receiptprinter->enabled) activateModule("modReceiptPrinter"); } @@ -109,27 +111,25 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") print "\n"; // Receipt printer module -if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { - print '\n"; +} else { + print ''; + print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); + print ''; } +print "\n"; // TakePOS Connector print ''; + print ''; print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index fc1e690e263..9c4a5320c58 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -672,7 +672,7 @@ if ($action == "updatereduction") if ($action == "order" and $placeid != 0) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; $printer = new dolReceiptPrinter($db); } @@ -703,10 +703,13 @@ if ($action == "order" and $placeid != 0) $order_receipt_printer1 .= ''; } } - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { + if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 1; + echo ""; } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed $db->query($sql); @@ -731,10 +734,13 @@ if ($action == "order" and $placeid != 0) $order_receipt_printer2 .= ''; } } - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { + if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 2; + echo ""; } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed $db->query($sql); @@ -759,10 +765,13 @@ if ($action == "order" and $placeid != 0) $order_receipt_printer3 .= ''; } } - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { + if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 3; + echo ""; } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id; // Set as printed $db->query($sql); @@ -841,25 +850,59 @@ $(document).ready(function() { - $.ajax({ - type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', - data: '' - }); - global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){ + ?> + $.ajax({ + type: "POST", + url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php', + data: 'invoice='+orderprinter1esc + }); + + $.ajax({ + type: "POST", + url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + data: '' + }); + - $.ajax({ - type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', - data: '' - }); - global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){ + ?> + $.ajax({ + type: "POST", + url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2', + data: 'invoice='+orderprinter2esc + }); + + $.ajax({ + type: "POST", + url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', + data: '' + }); + global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){ + ?> + $.ajax({ + type: "POST", + url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3', + data: 'invoice='+orderprinter3esc + }); + free(); + $db->free($result); } else { print ''; } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 7ff3d0f8f23..bd28149627f 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -316,7 +316,7 @@ if ($socid > 0) foreach ($search as $key => $val) { - if ($key == 'fk_statut') + if ($key == 'fk_statut' && !empty($search['fk_statut'])) { $newarrayofstatus = array(); foreach ($search['fk_statut'] as $key2 => $val2) { @@ -337,7 +337,7 @@ foreach ($search as $key => $val) if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2); continue; } - if ($key == 'fk_user_assign') + if ($key == 'fk_user_assign' || $key == 'fk_user_create') { if ($search[$key] > 0) $sql .= natural_search($key, $search[$key], 2); continue; @@ -635,10 +635,10 @@ foreach ($object->fields as $key => $val) print ''; - } elseif ($key == 'fk_user_assign') { - print ''; + } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { + print ''; } elseif ($key == 'fk_statut') { $arrayofstatus = array(); $arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --'; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index b1f0b7d4785..8b177518d25 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -388,7 +388,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco * Last holidays */ if (!empty($conf->holiday->enabled) && - ($user->rights->holiday->read_all || ($user->rights->holiday->read && $object->id == $user->id)) + ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id)) ) { $holiday = new Holiday($db); @@ -396,7 +396,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco $sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h"; $sql .= " WHERE h.fk_user = ".$object->id; - $sql .= " AND h.entity = ".$conf->entity; + $sql .= " AND h.entity IN (".getEntity('holiday').")"; $sql .= " ORDER BY h.date_debut DESC"; $resql = $db->query($sql); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 6a928e0bfee..cd6eb0991d9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 David Beniamine * * This program is free software; you can redistribute it and/or modify @@ -1781,7 +1781,7 @@ if ($action == 'create' || $action == 'adduserldap') $adh = new Adherent($db); $adh->fetch($object->fk_member); $adh->ref = $adh->getFullname($langs); // Force to show login instead of id - print $adh->getNomUrl(1); + print $adh->getNomUrl(-1); } else { print $langs->trans("UserNotLinkedToMember"); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b4682939ef2..41e1d55ea7c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -96,6 +96,30 @@ class User extends CommonObject */ public $socialnetworks; + /** + * @var string skype account + * @deprecated + */ + public $skype; + + /** + * @var string twitter account + * @deprecated + */ + public $twitter; + + /** + * @var string facebook account + * @deprecated + */ + public $facebook; + + /** + * @var string linkedin account + * @deprecated + */ + public $linkedin; + /** * @var string job position */ @@ -1643,7 +1667,7 @@ class User extends CommonObject $this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity; $this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity; $this->birth = trim($this->birth); - $this->fk_warehouse = trim(empty($this->fk_warehouse) ? '' : $this->fk_warehouse); + $this->fk_warehouse = (int) $this->fk_warehouse; // Check parameters if (!empty($conf->global->USER_MAIL_REQUIRED) && !isValidEMail($this->email)) { @@ -1714,7 +1738,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 .= ", fk_warehouse = ".($this->fk_warehouse > 0 ? $this->fk_warehouse : "null"); $sql .= ", lang = ".($this->lang ? "'".$this->db->escape($this->lang)."'" : "null"); $sql .= " WHERE rowid = ".$this->id; @@ -2653,6 +2677,9 @@ class User extends CommonObject global $conf, $langs; $info = array(); + + $socialnetworks = getArrayOfSocialNetworks(); + $keymodified = false; // Object classes @@ -2672,10 +2699,6 @@ class User extends CommonObject 'LDAP_FIELD_FAX' => 'office_fax', 'LDAP_FIELD_MAIL' => 'email', 'LDAP_FIELD_SID' => 'ldap_sid', - 'LDAP_FIELD_SKYPE' => 'skype', - 'LDAP_FIELD_TWITTER' => 'twitter', - 'LDAP_FIELD_FACEBOOK' => 'facebook', - 'LDAP_FIELD_LINKEDIN' => 'linkedin' ); // Champs @@ -2691,6 +2714,11 @@ class User extends CommonObject } } } + foreach ($socialnetworks as $key => $value) { + if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])})) { + $info[$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']]; + } + } if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) { $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address; } @@ -2959,6 +2987,8 @@ class User extends CommonObject // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) global $user, $conf; + $socialnetworks = getArrayOfSocialNetworks(); + $this->firstname = $ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME}; $this->lastname = $ldapuser->{$conf->global->LDAP_FIELD_NAME}; $this->login = $ldapuser->{$conf->global->LDAP_FIELD_LOGIN}; @@ -2969,14 +2999,14 @@ class User extends CommonObject $this->user_mobile = $ldapuser->{$conf->global->LDAP_FIELD_MOBILE}; $this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX}; $this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL}; - $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}; + foreach ($socialnetworks as $key => $value) { + $tmpkey = 'LDAP_FIELD_'.strtoupper($value['label']); + $this->socialnetworks[$value['label']] = $ldapuser->{$conf->global->$tmpkey}; + } $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; $this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE}; - $this->note = $ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION}; + $this->note_public = $ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION}; $result = $this->update($user); diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 339cb794c12..a97d011a2e2 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; // Load translation files required by page $langs->loadLangs(array('users', 'admin')); -$action = GETPOST('action', 'aZ09'); -$id = GETPOST('id', 'int'); +$action = (string) GETPOST('action', 'aZ09'); +$id = (int) GETPOST('id', 'int'); // Security check $socid = 0; @@ -54,14 +54,13 @@ if (empty($reshook)) { $edituser = new User($db); $edituser->fetch($id); - $edituser->clicktodial_url = GETPOST("url"); - $edituser->clicktodial_login = GETPOST("login"); - $edituser->clicktodial_password = GETPOST("password"); - $edituser->clicktodial_poste = GETPOST("poste"); + $edituser->clicktodial_url = (string) GETPOST("url", "alpha"); + $edituser->clicktodial_login = (string) GETPOST("login", "alpha"); + $edituser->clicktodial_password = (string) GETPOST("password", "alpha"); + $edituser->clicktodial_poste = (string) GETPOST("poste", "alpha"); $result = $edituser->update_clicktodial(); - if ($result < 0) - { + if ($result < 0) { setEventMessages($edituser->error, $edituser->errors, 'errors'); } } diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 03833b9f6d9..62e8dc99d72 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -464,7 +464,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') 'mode_reglement_code' => $order->mode_reglement_code, 'mode_reglement' => $order->mode_reglement, - 'date_livraison' => $order->date_livraison, + 'date_livraison' => $order->delivery_date, 'demand_reason_id' => $order->demand_reason_id, 'demand_reason_code' => $order->demand_reason_code, @@ -621,7 +621,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) 'mode_reglement' => $order->mode_reglement, 'mode_reglement_code' => $order->mode_reglement_code, - 'date_livraison' => $order->date_livraison, + 'date_livraison' => $order->delivery_date, 'demand_reason_id' => $order->demand_reason_id, 'demand_reason_code' => $order->demand_reason_code, diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 6719fb2164f..d4c915c3b72 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -21,9 +21,9 @@ */ /** - * \file scripts/emailings/mailing-send.php + * \file scripts/emailings/mailing-send.php * \ingroup mailing - * \brief Script d'envoi d'un mailing prepare et valide + * \brief Script to send a prepared and validated emaling from command line */ if (!defined('NOSESSION')) define('NOSESSION', '1'); diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php new file mode 100755 index 00000000000..12f279ef0d0 --- /dev/null +++ b/scripts/emailings/reset-invalid-emails.php @@ -0,0 +1,108 @@ +#!/usr/bin/env php + + * + * 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 scripts/emailings/reset-invalid-emails.php + * \ingroup mailing + * \brief Script to reset (set email to empty) from a list of email + */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = __DIR__.'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +if (!isset($argv[2]) || !$argv[2]) { + print "Usage: ".$script_file." inputfile-with-invalid-emails type\n"; + print "- inputfile-with-invalid-emails is a file with list of invalid email\n"; + print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n"; + exit(-1); +} +$id = $argv[1]; +$type = $argv[2]; + +require_once $path."../../htdocs/master.inc.php"; +require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; +require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; + +// Global variables +$version = DOL_VERSION; +$error = 0; + +/* + * Main + */ + +@set_time_limit(0); +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; + + +$user = new User($db); +// for signature, we use user send as parameter +if (!empty($login)) + $user->fetch('', $login); + + +$db->begin(); + + +// TODO Loop on the entry file to get the 100 first entries + +$groupofemails = array(); + + +// For each groupofemail, we update tables to set email field to empty +if ($type == 'all' || $type == 'thirdparty') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} + +if ($type == 'all' || $type == 'contact') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} + +if ($type == 'all' || $type == 'user') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} + +if ($type == 'all' || $type == 'member') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} + + +if (!$error) { + $db->commit(); +} else { + $db->rollback(); +} + +exit($error);
'; - print $langs->trans('DolibarrReceiptPrinter'); - print ''; - print $langs->trans('ReceiptPrinterMethodDescription'); - print '
'; - print ''.$langs->trans("Setup").''; - print '
'; - if ($conf->receiptprinter->enabled) { - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; - } +print '
'; +print $langs->trans('DolibarrReceiptPrinter'); +print ''; +print $langs->trans('ReceiptPrinterMethodDescription'); +print '
'; +print ''.$langs->trans("Setup").''; +print '
'; +if ($conf->receiptprinter->enabled) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; - print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); - print ''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } - print "
'; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 8ae37c2b8f7..870feb71778 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -41,7 +41,7 @@ if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id'])) // Security check if (!$user->admin) accessforbidden(); -$langs->loadLangs(array("admin", "cashdesk", "printing")); +$langs->loadLangs(array("admin", "cashdesk", "printing", "receiptprinter")); global $db; @@ -255,7 +255,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TA foreach ($printer->listprinterstemplates as $key => $value) { $templates[$value['rowid']] = $value['name']; } - print '
'.$langs->trans("MainTemplateToUse").'
'.$langs->trans("MainTemplateToUse").' ('.$langs->trans("SetupReceiptTemplate").')'; print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1); print '
'.$langs->trans('NoUnreadTicketsFound').'
'; $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150')); print ''; - print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150')); - print ''; + print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150')); + print '