diff --git a/.stickler.yml b/.stickler.yml index b68804448b2..642dec27412 100644 --- a/.stickler.yml +++ b/.stickler.yml @@ -8,3 +8,7 @@ linters: fixers: enable: true + +files: + ignore: + - 'htdocs/includes/*' diff --git a/COPYRIGHT b/COPYRIGHT index 1af09e6fdaf..fe707c1d63d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -2,7 +2,7 @@ License ------- -Dolibarr is released under the terms of the GNU General Public License as +Dolibarr is released 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 (GPL-3+). More information: https://www.gnu.org/licenses/gpl-3.0.txt @@ -15,13 +15,13 @@ PHP libraries: AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG EvalMath 1.0 BSD Yes Safe math expressions evaluation -Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers +Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency ParseDown 1.6 MIT License Yes Markdown parser -PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers +PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP @@ -37,7 +37,7 @@ TCPDF 6.3.2 LGPL-3+ Yes TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement JS libraries: -Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea. +Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea. jQuery 3.4.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index d5af14f9171..8a3096ef72a 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -164,7 +164,7 @@ foreach ($files as $filetmp) { if (filetype($file)=="file") { $md5=md5_file($file); $checksumconcat[]=$md5; - fputs($fp, ' '.$md5.''."\n"); + fputs($fp, ' '.$md5.''."\n"); } } fputs($fp, ' '."\n"); @@ -207,7 +207,7 @@ foreach ($files as $filetmp) { if (filetype($file)=="file") { $md5=md5_file($file); $checksumconcat[]=$md5; - fputs($fp, ' '.$md5.''."\n"); + fputs($fp, ' '.$md5.''."\n"); } } fputs($fp, ' '."\n"); diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index e34cd54863b..10a65cab2fe 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -138,7 +138,7 @@ if (empty($reshook)) if ($result > 0) { - setEventMessages($langs->trans("ChartLoaded"), null); + setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs'); } else { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 5158e12ebb6..f449a99c8bf 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -922,8 +922,8 @@ while ($i < min($num, $limit)) { print '' . ($line->debit ? price($line->debit) : ''). ''; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; - $totalarray['totaldebit'] += $line->debit; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebit'; + $totalarray['val']['totaldebit'] += $line->debit; } // Amount credit @@ -931,8 +931,8 @@ while ($i < min($num, $limit)) { print '' . ($line->credit ? price($line->credit) : '') . ''; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; - $totalarray['totalcredit'] += $line->credit; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredit'; + $totalarray['val']['totalcredit'] += $line->credit; } // Lettering code @@ -998,29 +998,7 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield'])) -{ - $i=0; - print ''; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - elseif ($totalarray['totaldebitfield'] == $i) print ''.price($totalarray['totaldebit']).''; - elseif ($totalarray['totalcreditfield'] == $i) print ''.price($totalarray['totalcredit']).''; - else print ''; - } - $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print ''; -} - +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; print ""; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 2ed9eb4c2bd..8a04e8b621a 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -197,6 +197,7 @@ if ($resql) { $param="&socid=".$socid; print '
'; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index b381fc597ce..f9cf57df344 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -195,6 +195,7 @@ if ($resql) { $param="&socid=".$socid; print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 2969f2ff0a1..ae076a414cb 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -129,8 +129,8 @@ if (empty($reshook)) // Mass actions $objectclass='AccountingAccount'; - $permtoread = $user->rights->accounting->read; - $permtodelete = $user->rights->accounting->delete; + $permissiontoread = $user->rights->accounting->read; + $permissiontodelete = $user->rights->accounting->delete; $uploaddir = $conf->accounting->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index f0e545f7853..a1c354f010b 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -112,8 +112,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' // Mass actions $objectclass='ExpenseReport'; $objectlabel='ExpenseReport'; -$permtoread = $user->rights->expensereport->read; -$permtodelete = $user->rights->expensereport->delete; +$permissiontoread = $user->rights->expensereport->read; +$permissiontodelete = $user->rights->expensereport->delete; $uploaddir = $conf->expensereport->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 27cd97dfea3..249cb920c47 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -133,8 +133,8 @@ if (empty($reshook)) // Mass actions $objectclass='AccountingAccount'; - $permtoread = $user->rights->accounting->read; - $permtodelete = $user->rights->accounting->delete; + $permissiontoread = $user->rights->accounting->read; + $permissiontodelete = $user->rights->accounting->delete; $uploaddir = $conf->accounting->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 76556feb4ee..ee89f6b9de3 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -70,6 +70,8 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); +$socialnetworks = getArrayOfSocialNetworks(); + // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); @@ -302,10 +304,16 @@ if (empty($reshook)) $object->phone_perso = trim(GETPOST("phone_perso", 'alpha')); $object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha')); $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); - $object->skype = trim(GETPOST("skype", 'alpha')); - $object->twitter = trim(GETPOST("twitter", 'alpha')); - $object->facebook = trim(GETPOST("facebook", 'alpha')); - $object->linkedin = trim(GETPOST("linkedin", 'alpha')); + $object->socialnetworks = array(); + foreach ($socialnetworks as $key => $value) { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + $object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml')); + } + } + //$object->skype = trim(GETPOST("skype", 'alpha')); + //$object->twitter = trim(GETPOST("twitter", 'alpha')); + //$object->facebook = trim(GETPOST("facebook", 'alpha')); + //$object->linkedin = trim(GETPOST("linkedin", 'alpha')); $object->birth = $birthdate; $object->typeid = GETPOST("typeid", 'int'); @@ -448,10 +456,10 @@ if (empty($reshook)) $phone=GETPOST("phone", 'alpha'); $phone_perso=GETPOST("phone_perso", 'alpha'); $phone_mobile=GETPOST("phone_mobile", 'alpha'); - $skype=GETPOST("member_skype", 'alpha'); - $twitter=GETPOST("member_twitter", 'alpha'); - $facebook=GETPOST("member_facebook", 'alpha'); - $linkedin=GETPOST("member_linkedin", 'alpha'); + // $skype=GETPOST("member_skype", 'alpha'); + // $twitter=GETPOST("member_twitter", 'alpha'); + // $facebook=GETPOST("member_facebook", 'alpha'); + // $linkedin=GETPOST("member_linkedin", 'alpha'); $email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $login=GETPOST("member_login", 'alpha'); $pass=GETPOST("password", 'alpha'); @@ -478,11 +486,19 @@ if (empty($reshook)) $object->phone = $phone; $object->phone_perso = $phone_perso; $object->phone_mobile= $phone_mobile; + $object->socialnetworks = array(); + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + $object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml'); + } + } + } - $object->skype = $skype; - $object->twitter = $twitter; - $object->facebook = $facebook; - $object->linkedin = $linkedin; + // $object->skype = $skype; + // $object->twitter = $twitter; + // $object->facebook = $facebook; + // $object->linkedin = $linkedin; $object->email = $email; $object->login = $login; @@ -802,7 +818,7 @@ if (empty($reshook)) // Actions to build doc $upload_dir = $conf->adherent->dir_output; - $permissioncreate=$user->rights->adherent->creer; + $permissiontoadd=$user->rights->adherent->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails @@ -1028,29 +1044,12 @@ else // Mobile phone print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").''; - // Skype - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Skype").''; - } - - // Twitter - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Twitter").''; - } - - // Facebook - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Facebook").''; - } - - // LinkedIn - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("LinkedIn").''; - } + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + if (!$value['active']) break; + print ''.$langs->trans($value['label']).''; + } + } // Birth Date print "".$langs->trans("DateToBirth")."\n"; @@ -1297,29 +1296,12 @@ else // Mobile phone print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'phone_mobile).'">'; - // Skype - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Skype").'skype).'">'; - } - - // Twitter - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Twitter").'twitter).'">'; - } - - // Facebook - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("Facebook").'facebook).'">'; - } - - // LinkedIn - if (! empty($conf->socialnetworks->enabled)) - { - print ''.$langs->trans("LinkedIn").'linkedin).'">'; - } + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + if (!$value['active']) break; + print ''.$langs->trans($value['label']).''; + } + } // Birth Date print "".$langs->trans("DateToBirth")."\n"; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 177e2eef18f..e7686a0a055 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -259,6 +259,7 @@ print '
'; print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; +print ''; print ''; print ''; print ''; @@ -278,6 +279,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_CARD_TYPE").' '; @@ -297,6 +299,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f7278f9007a..ff2e5082736 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -124,23 +124,32 @@ class Adherent extends CommonObject */ public $email; + /** + * @var array array of socialnetworks + */ + 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; @@ -566,10 +575,7 @@ class Adherent extends CommonObject $sql.= ", country = ".($this->country_id>0?$this->db->escape($this->country_id):"null"); $sql.= ", state_id = ".($this->state_id>0?$this->db->escape($this->state_id):"null"); $sql.= ", email = '".$this->db->escape($this->email)."'"; - $sql.= ", skype = '".$this->db->escape($this->skype)."'"; - $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; - $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; - $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; + $sql.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'"; $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); $sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); @@ -694,10 +700,7 @@ class Adherent extends CommonObject $luser->state_id=$this->state_id; $luser->email=$this->email; - $luser->skype=$this->skype; - $luser->twitter=$this->twitter; - $luser->facebook=$this->facebook; - $luser->linkedin=$this->linkedin; + $luser->socialnetworks=$this->socialnetworks; $luser->office_phone=$this->phone; $luser->user_mobile=$this->phone_mobile; @@ -736,10 +739,7 @@ class Adherent extends CommonObject $lthirdparty->zip=$this->zip; $lthirdparty->town=$this->town; $lthirdparty->email=$this->email; - $lthirdparty->skype=$this->skype; - $lthirdparty->twitter=$this->twitter; - $lthirdparty->facebook=$this->facebook; - $lthirdparty->linkedin=$this->linkedin; + $lthirdparty->socialnetworks=$this->socialnetworks; $lthirdparty->phone=$this->phone; $lthirdparty->state_id=$this->state_id; $lthirdparty->country_id=$this->country_id; @@ -1228,7 +1228,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; + $sql.= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1307,10 +1307,7 @@ class Adherent extends CommonObject $this->phone_mobile = $obj->phone_mobile; $this->email = $obj->email; - $this->skype = $obj->skype; - $this->twitter = $obj->twitter; - $this->facebook = $obj->facebook; - $this->linkedin = $obj->linkedin; + $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); $this->photo = $obj->photo; $this->statut = $obj->statut; @@ -2385,10 +2382,12 @@ class Adherent extends CommonObject $this->country = 'France'; $this->morphy = 'mor'; $this->email = 'specimen@specimen.com'; - $this->skype = 'skypepseudo'; - $this->twitter = 'twitterpseudo'; - $this->facebook = 'facebookpseudo'; - $this->linkedin = 'linkedinpseudo'; + $this->socialnetworks = array( + 'skype' => 'skypepseudo', + 'twitter' => 'twitterpseudo', + 'facebook' => 'facebookpseudo', + 'linkedin' => 'linkedinpseudo', + ); $this->phone = '0999999999'; $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index b4bdb119b29..5d992b168d4 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -71,6 +71,18 @@ class AdherentType extends CommonObject */ public $morphy; + public $duration; + + /* + * type expiration + */ + public $duration_value; + + /** + * Expiration unit + */ + public $duration_unit; + /** * @var int Subsription required (0 or 1) * @since 5.0 @@ -373,8 +385,9 @@ class AdherentType extends CommonObject $sql.= "SET "; $sql.= "statut = ".$this->statut.","; $sql.= "libelle = '".$this->db->escape($this->label) ."',"; - $sql.= "morphy = '".$this->db->escape($this->morphy) ."',"; + $sql.= "morphy = '".$this->db->escape($this->morphy) ."',"; $sql.= "subscription = '".$this->db->escape($this->subscription)."',"; + $sql.= "duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."',"; $sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "vote = ".(integer) $this->db->escape($this->vote).","; $sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; @@ -476,7 +489,7 @@ class AdherentType extends CommonObject { global $langs, $conf; - $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; + $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.duration, d.subscription, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -494,6 +507,9 @@ class AdherentType extends CommonObject $this->label = $obj->label; $this->morphy = $obj->morphy; $this->statut = $obj->statut; + $this->duration = $obj->duration; + $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); + $this->duration_unit = substr($obj->duration, -1); $this->subscription = $obj->subscription; $this->mail_valid = $obj->mail_valid; $this->note = $obj->note; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0bcc11bf351..81d6b7625b7 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -232,8 +232,8 @@ if (empty($reshook)) // Mass actions $objectclass='Adherent'; $objectlabel='Members'; - $permtoread = $user->rights->adherent->lire; - $permtodelete = $user->rights->adherent->supprimer; + $permissiontoread = $user->rights->adherent->lire; + $permissiontodelete = $user->rights->adherent->supprimer; $uploaddir = $conf->adherent->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -919,26 +919,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index dbc14e2999e..c66dce0e8fd 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -588,26 +588,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 94978e7f8a9..b6f8abe27da 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $langs->load("members"); @@ -61,6 +62,8 @@ $label=GETPOST("label", "alpha"); $morphy=GETPOST("morphy", "alpha"); $statut=GETPOST("statut", "int"); $subscription=GETPOST("subscription", "int"); +$duration_value = GETPOST('duration_value', 'int'); +$duration_unit = GETPOST('duration_unit', 'alpha'); $vote=GETPOST("vote", "int"); $comment=GETPOST("comment", 'alphanohtml'); $mail_valid=GETPOST("mail_valid", 'none'); @@ -104,9 +107,11 @@ if ($cancel) { if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); - $object->morphy = trim($morphy); + $object->morphy = trim($morphy); $object->statut = (int) $statut; $object->subscription = (int) $subscription; + $object->duration_value = $duration_value; + $object->duration_unit = $duration_unit; $object->note = trim($comment); $object->mail_valid = trim($mail_valid); $object->vote = (int) $vote; @@ -159,9 +164,11 @@ if ($action == 'update' && $user->rights->adherent->configurer) $object->oldcopy = clone $object; $object->label = trim($label); - $object->morphy = trim($morphy); + $object->morphy = trim($morphy); $object->statut = (int) $statut; $object->subscription = (int) $subscription; + $object->duration_value = $duration_value; + $object->duration_unit = $duration_unit; $object->note = trim($comment); $object->mail_valid = trim($mail_valid); $object->vote = (boolean) trim($vote); @@ -209,6 +216,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer) */ $form=new Form($db); +$formproduct = new FormProduct($db); llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); @@ -354,6 +362,11 @@ if ($action == 'create') print $form->selectyesno("vote", 0, 1); print ''; + print ''.$langs->trans("Duration").''; + print ' '; + print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1); + print ''; + print ''.$langs->trans("Description").''; print ''; @@ -439,6 +452,18 @@ if ($rowid > 0) print yn($object->vote); print ''; + print ''.$langs->trans("Duration").''.$object->duration_value.' '; + if ($object->duration_value > 1) + { + $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); + } + elseif ($object->duration_value > 0) + { + $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); + } + print (! empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; + print ''; + print ''.$langs->trans("Description").''; print nl2br($object->note).""; @@ -592,6 +617,7 @@ if ($rowid > 0) } print ''; + print ''; print ''; print '
'; @@ -787,6 +813,11 @@ if ($rowid > 0) print $form->selectyesno("vote", $object->vote, 1); print ''; + print ''.$langs->trans("Duration").''; + print ' '; + print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); + print ''; + print ''.$langs->trans("Description").''; print ''; @@ -796,9 +827,12 @@ if ($rowid > 0) $doleditor->Create(); print ""; + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + // Other attributes $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { @@ -807,33 +841,6 @@ if ($rowid > 0) print ''; - // Extra field - if (empty($reshook)) - { - print '

'; - if (is_array($extrafields->attributes['adherent_type']['label'])) - { - foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label) - { - if (isset($_POST["options_" . $key])) { - if (is_array($_POST["options_" . $key])) { - // $_POST["options"] is an array but following code expects a comma separated string - $value = implode(",", $_POST["options_" . $key]); - } else { - $value = $_POST["options_" . $key]; - } - } else { - $value = $object->array_options["options_" . $key]; - } - - print '\n"; - } - } - print '
'.$label.''; - print $extrafields->showInputField($key, $value); - print "


'; - } - dol_fiche_end(); print '
'; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index beccc9e9d5a..17fc773904f 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -324,6 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } print ''; +print ''; print ''; print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 57a20b8bf42..614d4ef4407 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -180,6 +180,7 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); print ''; +print ''; print ''; print '
'."\n"; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 0c3514015f2..92919886512 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -119,6 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL)) if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); print ''; + print ''; print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print ''; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index af61dd1c09f..974fba8fa1d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -11,6 +11,7 @@ * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +89,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,38,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0); // Name of SQL tables of dictionaries $tabname=array(); @@ -130,6 +131,7 @@ $tabname[34]= MAIN_DB_PREFIX."c_hrm_function"; $tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat"; $tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range"; $tabname[37]= MAIN_DB_PREFIX."c_units"; +$tabname[38]= MAIN_DB_PREFIX."c_socialnetworks"; // Dictionary labels $tablib=array(); @@ -170,6 +172,7 @@ $tablib[34]= "DictionaryFunction"; $tablib[35]= "DictionaryExpenseTaxCat"; $tablib[36]= "DictionaryExpenseTaxRange"; $tablib[37]= "DictionaryMeasuringUnits"; +$tablib[38]= "DictionarySocialNetworks"; // Requests to extract data $tabsql=array(); @@ -210,6 +213,7 @@ $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PRE $tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c"; $tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r"; $tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r"; +$tabsql[38]= "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks"; // Criteria to sort dictionaries $tabsqlsort=array(); @@ -250,6 +254,7 @@ $tabsqlsort[34]="code ASC"; $tabsqlsort[35]="c.label ASC"; $tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC"; $tabsqlsort[37]="r.unit_type ASC, r.scale ASC, r.code ASC"; +$tabsqlsort[38]="rowid, code ASC"; // Field names in select result for dictionary display $tabfield=array(); @@ -290,6 +295,7 @@ $tabfield[34]= "code,label"; $tabfield[35]= "label"; $tabfield[36]= "range_ik,fk_c_exp_tax_cat"; $tabfield[37]= "code,label,short_label,unit_type,scale"; +$tabfield[38]= "code,label,url,icon,entity"; // Edit field names for editing a record $tabfieldvalue=array(); @@ -330,6 +336,7 @@ $tabfieldvalue[34]= "code,label"; $tabfieldvalue[35]= "label"; $tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat"; $tabfieldvalue[37]= "code,label,short_label,unit_type,scale"; +$tabfieldvalue[38]= "code,label,url,icon"; // Field names in the table for inserting a record $tabfieldinsert=array(); @@ -371,6 +378,7 @@ $tabfieldinsert[34]= "code,label"; $tabfieldinsert[35]= "label"; $tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat"; $tabfieldinsert[37]= "code,label,short_label,unit_type,scale"; +$tabfieldinsert[38]= "entity,code,label,url,icon"; // Rowid name of field depending if field is autoincrement on or off.. // Use "" if id field is "rowid" and has autoincrement on @@ -413,6 +421,7 @@ $tabrowid[34]= "rowid"; $tabrowid[35]= ""; $tabrowid[36]= ""; $tabrowid[37]= ""; +$tabrowid[38]= ""; // Condition to show dictionary in setup page $tabcond=array(); @@ -453,6 +462,7 @@ $tabcond[34]= ! empty($conf->hrm->enabled); $tabcond[35]= ! empty($conf->expensereport->enabled); $tabcond[36]= ! empty($conf->expensereport->enabled); $tabcond[37]= ! empty($conf->product->enabled); +$tabcond[38]= ! empty($conf->socialnetworks->enabled); // List of help for fields $tabhelp=array(); @@ -493,6 +503,7 @@ $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[35] = array(); $tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange')); $tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc')); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); @@ -533,6 +544,7 @@ $tabfieldcheck[34] = array(); $tabfieldcheck[35] = array(); $tabfieldcheck[36] = array(); $tabfieldcheck[37] = array(); +$tabfieldcheck[38] = array(); // Complete all arrays with entries found into modules complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck); diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 04accc01bbf..f3985bc70a4 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -80,10 +80,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php +$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php $permissiondellink=$user->rights->emailcollector->write; // Used by the include of actions_dellink.inc.php -$permissionedit=$user->rights->emailcollector->write; // Used by the include of actions_lineupdown.inc.php -$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $debuginfo=''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index e8b2e280a7f..9cb83e3784b 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -156,8 +156,8 @@ if (empty($reshook)) // Mass actions $objectclass='EmailCollector'; $objectlabel='EmailCollector'; - $permtoread = $user->rights->emailcollector->read; - $permtodelete = $user->rights->emailcollector->delete; + $permissiontoread = $user->rights->emailcollector->read; + $permissiontodelete = $user->rights->emailcollector->delete; $uploaddir = $conf->emailcollector->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -497,26 +497,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''; - else print ''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index c2c49eb4943..bbe8f0dd221 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -185,6 +185,7 @@ else print '
'."\n"; print ''."\n"; + print ''; // Skins show_skin(null, 1); diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index eb432b0dc72..028de9a32a5 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -148,8 +148,8 @@ if (empty($reshook)) // Mass actions $objectclass='EmailSenderProfile'; $objectlabel='EmailSenderProfile'; - $permtoread = $user->admin; - $permtodelete = $user->admin; + $permissiontoread = $user->admin; + $permissiontodelete = $user->admin; $uploaddir = $conf->admin->dir_output.'/senderprofiles'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -461,26 +461,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''; - else print ''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 6184bebd97f..9d3d125f3da 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -166,6 +166,29 @@ if ($action == 'testprinter' && $user->admin) { $action = ''; } +if ($action == 'testtemplate' && $user->admin) { + $error=0; + // if (empty($printerid)) { + // $error++; + // setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors'); + // } + + // if (! $error) { + // test + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $object = new Facture($db); + //$object->initAsSpecimen(); + $object->fetch(18); + //var_dump($object->lines); + $ret = $printer->sendToPrinter($object, $templateid, 1); + if ($ret == 0) { + setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null); + } else { + setEventMessages($printer->error, $printer->errors, 'errors'); + } + //} + $action = ''; +} if ($action == 'updatetemplate' && $user->admin) { $error=0; @@ -190,6 +213,29 @@ if ($action == 'updatetemplate' && $user->admin) { $action = ''; } +if ($action == 'addtemplate' && $user->admin) { + $error=0; + $db->begin(); + if (empty($templatename)) { + $error++; + setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors'); + } + + if (! $error) { + $result= $printer->addTemplate($templatename, $template); + if ($result > 0) $error++; + + if (! $error) { + $db->commit(); + setEventMessages($langs->trans("TemplateAdded", $templatename), null); + } else { + $db->rollback(); + dol_print_error($db); + } + } + $action = ''; +} + /* * View @@ -217,15 +263,13 @@ if ($mode == 'config' && $user->admin) { print $langs->trans("ReceiptPrinterDesc")."

\n"; - print '
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'."\n"; + print '
'."\n"; print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; print "\n"; $ret = $printer->listprinters(); $nbofprinters = count($printer->listprinters); @@ -244,8 +288,6 @@ if ($mode == 'config' && $user->admin) { print ''; print ''; print ''; - print ''; - print ''; print ''; } else { print ''; @@ -255,13 +297,13 @@ if ($mode == 'config' && $user->admin) { // edit icon print ''; + print ''; // delete icon - print ''; + print ''; // test icon - print ''; print ''; @@ -269,7 +311,7 @@ if ($mode == 'config' && $user->admin) { } } - if ($action!='editprinter') { + if ($action != 'editprinter') { if ($nbofprinters > 0) { print ''; print ''; @@ -277,8 +319,6 @@ if ($mode == 'config' && $user->admin) { print ''; print ''; print ''; - print ''; - print ''; print "\n"; } @@ -345,7 +385,7 @@ if ($mode == 'template' && $user->admin) { dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); print $langs->trans("ReceiptPrinterTemplateDesc")."

\n"; - print '
'.$langs->trans("Name").''.$langs->trans("Type").''.$langs->trans("Profile").''.$langs->trans("Parameters").'
'.$printer->profileresprint.'
'.$printer->listprinters[$line]['name'].''; print img_picto($langs->trans("Edit"), 'edit'); - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); - print ''; + print ''; print img_picto($langs->trans("TestPrinter"), 'printer'); print '
'.$langs->trans("Name").''.$langs->trans("Profile").''.$langs->trans("Parameters").'
'."\n"; + print '
'."\n"; print ''; print ''; print ''; @@ -359,8 +399,7 @@ if ($mode == 'template' && $user->admin) { setEventMessages($printer->error, $printer->errors, 'errors'); } else { $max = count($printer->listprinterstemplates); - for ($line=0; $line < $max; $line++) - { + for ($line=0; $line < $max; $line++) { print ''; if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) { print ''; @@ -368,21 +407,19 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; - print ''; - print ''; } else { print ''; print ''; // edit icon print ''; + print ''; // delete icon - print ''; + print ''; // test icon - print ''; } @@ -392,13 +429,19 @@ if ($mode == 'template' && $user->admin) { print '
'.$langs->trans("Name").''.$langs->trans("Template").'
'; print ''.$printer->listprinterstemplates[$line]['name'].''.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).''; print img_picto($langs->trans("Edit"), 'edit'); - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); - print ''; + print ''; print img_picto($langs->trans("TestPrinterTemplate"), 'printer'); print '
'; if ($action!='edittemplate') { + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; } else { print '
'; } print ''; print '

'; - print ''."\n"; + print '
'."\n"; print ''; print ''; print ''; @@ -414,18 +457,6 @@ if ($mode == 'template' && $user->admin) { dol_fiche_end(); } -// to remove after test -// $object=new stdClass(); -// $object->date_time = '2015-11-02 22:30:25'; -// $object->id = 1234; -// $object->customer_firstname = 'John'; -// $object->customer_lastname = 'Deuf'; -// $object->vendor_firstname = 'Jim'; -// $object->vendor_lastname = 'Big'; -// $object->barcode = '3700123862396'; -//$printer->sendToPrinter($object, 1, 16); -//setEventMessages($printer->error, $printer->errors, 'errors'); - // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 94864123220..3fa0905ee42 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -46,7 +46,7 @@ llxHeader(); print load_fiche_titre($langs->trans("FileCheckDolibarr"), '', 'title_setup'); -print $langs->trans("FileCheckDesc").'

'; +print ''.$langs->trans("FileCheckDesc").'

'; // Version print '
'; @@ -239,6 +239,7 @@ if (! $error && $xml) $out.='
'; $out.=''; $out.=''; + $out.=''; $out.=''; $out.=''."\n"; $tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); @@ -251,6 +252,9 @@ if (! $error && $xml) $out.=''; $out.='' . "\n"; $out.='' . "\n"; + $out.='' . "\n"; $out.='' . "\n"; $out.="\n"; } @@ -275,7 +279,8 @@ if (! $error && $xml) $out.=''; $out.=''; $out.=''; - $out.=''; + $out.=''; + $out.=''; $out.=''; $out.=''."\n"; $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename'); @@ -290,6 +295,9 @@ if (! $error && $xml) $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; + $out.='' . "\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out.='' . "\n"; @@ -301,6 +309,7 @@ if (! $error && $xml) $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; + $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; $out.="\n"; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 9b6d33e5faa..a3891dc1c46 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -40,7 +40,7 @@ llxHeader(); print load_fiche_titre($langs->trans("AvailableModules"), '', 'title_setup'); -print $langs->trans("ToActivateModule").'
'; +print ''.$langs->trans("ToActivateModule").'
'; print "
\n"; $modules = array(); diff --git a/htdocs/admin/system/xcache.php b/htdocs/admin/system/xcache.php index 3e0e087c424..0cca1b94fc4 100644 --- a/htdocs/admin/system/xcache.php +++ b/htdocs/admin/system/xcache.php @@ -39,7 +39,6 @@ print load_fiche_titre("XCache", '', 'title_setup'); print "
\n"; -//function_exists('apc_cache_info') || function_exists('eaccelerator_info') || function_exists('xcache_info')) if (!function_exists('xcache_info')) { print 'XCache seems to be not installed. Function xcache_info not found.'; diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php deleted file mode 100644 index 660c1647783..00000000000 --- a/htdocs/admin/tools/eaccelerator.php +++ /dev/null @@ -1,338 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/tools/eaccelerator.php - * \brief Page administration de eaccelerator - */ - -require '../../main.inc.php'; - -$langs->load("admin"); - -if (!$user->admin) accessforbidden(); - - -/* - * View - */ - -llxHeader(); - - -if (!function_exists('eaccelerator_info')) { - print 'eAccelerator is not installed.'; - llxFooter(); - exit; -} - - -$info = eaccelerator_info(); -if (isset($_POST['caching'])) { - if ($info['cache']) { - eaccelerator_caching(false); - } else { - eaccelerator_caching(true); - } -} elseif (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) { - if ($info['optimizer']) { - eaccelerator_optimizer(false); - } else { - eaccelerator_optimizer(true); - } -} elseif (isset($_POST['clear'])) { - eaccelerator_clear(); -} elseif (isset($_POST['clean'])) { - eaccelerator_clean(); -} elseif (isset($_POST['purge'])) { - eaccelerator_purge(); -} -$info = eaccelerator_info(); -if (!is_array($info)) { - dol_print_error('', 'An error occured getting eAccelerator information, this is caused if eAccelerator isn\'t initalised properly'); - exit; -} - - -/** - * Compare revisions - * - * @param array $x Parts of version 1 - * @param array $y Parts of version 2 - * @return int -1 if 1<2, 0 if 1=2, 1 if 1>2 - */ -function compare($x, $y) -{ - global $sortby; - - if ( $x[$sortby] == $y[$sortby] ) { - return 0; - } elseif ($x[$sortby] < $y[$sortby]) { - return -1; - } else { - return 1; - } -} - -/** - * Compare revisions - * - * @param array $x Parts of version 1 - * @param array $y Parts of version 2 - * @return int 1 if 1<2, 0 if 1=2, -1 if 1>2 - */ -function revcompare($x, $y) -{ - global $sortby; - - if ($x[$sortby] == $y[$sortby]) { - return 0; - } elseif ($x[$sortby] < $y[$sortby]) { - return 1; - } else { - return -1; - } -} - -/** - * Output table - * - * @param array $list Array of records - * @return void - */ -function create_script_table($list) -{ - global $sortby,$langs; - - if (GETPOT('order', 'alpha') == "asc" || GETPOST('order', 'alpha') == "desc") { - $order = GETPOST('order', 'alpha'); - } else { - $order = "asc"; - } - - if (GETPOST('order', 'alpha')) { - switch (GETPOST('order', 'alpha')) { - case "mtime": - case "size": - case "reloads": - case "hits": - $sortby = GETPOST('sort'); - ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - break; - default: - $sortby = "file"; - ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - } - } - - print '
'.$langs->trans("Tag").''.$langs->trans("Description").'
#' . $langs->trans("Filename") . '' . $langs->trans("ExpectedSize") . '' . $langs->trans("ExpectedChecksum") . '
'.$i.''.$file['filename'].''; + if (! empty($file['expectedsize'])) $out.=dol_print_size($file['expectedsize']); + $out.=''.$file['expectedmd5'].'
' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("ExpectedSize") . '' . $langs->trans("CurrentSize") . '' . $langs->trans("DateModification") . '
'.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''; + if ($file['expectedsize']) $out.=dol_print_size($file['expectedsize']); + $out.=''.dol_print_size($size).''.$langs->trans("Total").''.dol_print_size($totalsize).'
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - switch ($sortby) { - case "mtime": - case "size": - case "reloads": - case "hits": - ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - break; - case "file": - default: - $sortby = "file"; - ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - } - - foreach($list as $script) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - print '
'.$langs->trans("Filename").' '; - if($sortby == "file") - print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Date").' '; - if($sortby == "mtime") - print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Size").' '; - if($sortby == "size") - print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Reloads").' '; - if($sortby == "reloads") - print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Hits").' '; - if($sortby == "hits") - print ($order == "asc" ? "↓" : "↑").'
'.dol_trunc($script['file'], 80, 'left').''.dol_print_date($script['mtime'], 'dayhour').''.number_format($script['size'] / 1024, 2).'KB'.$script['reloads'].' ('.$script['usecount'].')'.$script['hits'].'
'; -} - -/** - * Output table - * - * @param array $list Array of records - * @return void - */ -function create_key_table($list) -{ - global $langs; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - foreach($list as $key) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - print '
NameCreated'.$langs->trans("Size").'ttl
'.dol_trunc($key['name'], 80, 'left').''.dol_print_date($key['created'], 'dayhour').''.number_format($key['size']/1024, 3).'KB'; - if ($key['ttl'] == -1) { - print 'expired'; - } elseif ($key['ttl'] == 0) { - print 'none'; - } else { - print dol_print_date($key['ttl'], 'dayhour'); - } - print '
'; -} - - -$form=new Form($db); -print load_fiche_titre('Dolibarr eAccelerator '.$info['version'].' control panel', '', 'title_setup'); - -print '
'; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; -print '
Information
Caching enabled'.($info['cache']?'yes':'no').'
Optimizer enabled'.$info['optimizer']?'yes':'no'.'
Memory usage'.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)
Free memory in reserved cache'.number_format($info['memoryAvailable']/(1024*1024), 2).'MB
Cached scripts'.$info['cachedScripts'].'
Removed scripts'.$info['removedScripts'].'
Cached keys'.(isset($info['cachedKeys'])?$info['cachedKeys']:'').'
'; - -$resCached = @eaccelerator_cached_scripts(); // If success return an array -$resRemoved = @eaccelerator_removed_scripts(); - -if (is_array($resCached) || is_array($resRemoved)) { - print "
"; - print '
'; - print ''; - print ''; - print ''; - - if (is_array($resCached)) { - print ''; - print ""; - print ''; - print ""; - - print ''; - print ""; - print ''; - print ""; - } - - if (is_array($resRemoved)) { - print ''; - print ""; - print ''; - print ""; - - print ''; - print ""; - print ''; - print ""; - - print ''; - print ""; - print ''; - print "
Actions
Caching
Optimizer
Clear cache
Clean cache
Purge cache
"; - } - - if (is_array($resCached)) { - print "

"; - print "Cached scripts
"; - create_script_table($resCached); - } - - if (is_array($resRemoved)) { - print "

"; - print "Removed scripts
"; - create_script_table($resRemoved); - } -} else { - print "

"; - print "Check in your php.ini that eaccelerator.allowed_admin_path parameter is : "; - print "

"; - print "".$_SERVER["SCRIPT_FILENAME"].""; - print "

"; -} - -if (function_exists('eaccelerator_get')) { - print '

'; - print 'Cached keys
'; - $res=eaccelerator_list_keys(); - create_key_table($res); -} - -print "

"; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index 819688ddcc1..bdc5ee5961d 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -49,7 +49,7 @@ $form = new Form($db); print load_fiche_titre($langs->trans("TriggersAvailable"), '', 'title_setup'); -print $langs->trans("TriggersDesc")."
"; +print ''.$langs->trans("TriggersDesc")."
"; print "
\n"; @@ -60,8 +60,8 @@ $param = ''; $align = ''; print '
'; print ''; print ''; -print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, '', $sortfield, $sortorder, '', 1)."\n"; +print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n"; print getTitleFieldOfList($langs->trans("Active"), 0, $_SERVER["PHP_SELF"], 'active', "", $param, 'align="center"', $sortfield, $sortorder, '', 1)."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n"; print ''; @@ -69,7 +69,7 @@ print ''; foreach ($triggers as $trigger) { print ''; - print ''; + print ''; print ''; print ''; print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine=0; -foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) -{ - if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object +if (is_array($extrafields->attributes[$object->table_element]['computed'])) { + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { + if (preg_match('/\$object/', $val)) { + // There is at least one compute field that use $object + $needToFetchEachLine++; + } + } } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 231679f7b3a..941eb621e7c 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -72,14 +72,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check - Protection if external user //if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0); +//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); $permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php $permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php -$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php -$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php -$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); +$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); /* @@ -112,6 +111,12 @@ if (empty($reshook)) // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Action to move up and down lines of object + //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; + + // Action to build doc + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + // Actions to send emails $trigger_name='BOM_SENTBYMAIL'; $autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO'; @@ -146,8 +151,8 @@ if (empty($reshook)) $bomline->fk_bom = $id; $bomline->fk_product = $idprod; $bomline->qty = $qty; - $bomline->qty_frozen = $qty_frozen; - $bomline->disable_stock_change = $disable_stock_change; + $bomline->qty_frozen = (int) $qty_frozen; + $bomline->disable_stock_change = (int) $disable_stock_change; $bomline->efficiency = $efficiency; $result = $bomline->create($user); @@ -184,8 +189,8 @@ if (empty($reshook)) $bomline = new BOMLine($db); $bomline->fetch($lineid); $bomline->qty = $qty; - $bomline->qty_frozen = $qty_frozen; - $bomline->disable_stock_change = $disable_stock_change; + $bomline->qty_frozen = (int) $qty_frozen; + $bomline->disable_stock_change = (int) $disable_stock_change; $bomline->efficiency = $efficiency; $result = $bomline->update($user); @@ -457,7 +462,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->bom->write) + if ($permissiontoadd) { if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; @@ -532,7 +537,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
'; - if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'.$trigger['picto'].''.$trigger['picto'].''.$trigger['file'].''.$trigger['status'].''; diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index edeb32e8353..53139b0df8c 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -148,11 +148,13 @@ class DolibarrApiAccess implements iAuthenticate $fuser->getrights(); static::$user = $fuser; - if($fuser->societe_id) + if ($fuser->socid) { static::$role = 'external'; + } - if($fuser->admin) + if ($fuser->admin) { static::$role = 'admin'; + } } else { diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 50102b76b93..b32eea1f57f 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -45,6 +45,68 @@ class Setup extends DolibarrApi $this->db = $db; } + /** + * Get the list of ordering methods. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number {@min 0} + * @param int $active Payment type is active or not {@min 0} {@max 1} + * @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')" + * + * @url GET dictionary/ordering_methods + * + * @return array [List of ordering methods] + * + * @throws 400 RestException + * @throws 200 OK + */ + public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid, code, libelle as label, module"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method as t"; + $sql.= " WHERE t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(400, $this->db->lasterror()); + } + + return $list; + } + /** * Get the list of payments types. * @@ -963,7 +1025,7 @@ class Setup extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Number of items per page * @param int $page Page number (starting from zero) - * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param int $active Measuring unit is active or not {@min 0} {@max 1} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of measuring unit * @@ -1016,6 +1078,67 @@ class Setup extends DolibarrApi return $list; } + /** + * Get the list of social networks. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param int $active Social network is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return array List of social networks + * + * @url GET dictionary/socialnetworks + * + * @throws RestException + */ + public function getListOfsocialNetworks($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + //TODO link with multicurrency module + $sql = "SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t"; + $sql.= " WHERE t.entity IN (".getEntity('c_socialnetworks').")"; + $sql.= " AND t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of social networks: '.$this->db->lasterror()); + } + + return $list; + } + /** * Get the list of tickets categories. * diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 7d49d253755..ddde75ee463 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -69,8 +69,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu $permissionnote=$user->rights->asset->write; // Used by the include of actions_setnotes.inc.php $permissiondellink=$user->rights->asset->write; // Used by the include of actions_dellink.inc.php -$permissionedit=$user->rights->asset->write; // Used by the include of actions_lineupdown.inc.php -$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php /* diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 8ea4f46c89d..c43bd73eae8 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -152,8 +152,8 @@ if (empty($reshook)) // Mass actions $objectclass='Asset'; $objectlabel='Asset'; - $permtoread = $user->rights->asset->read; - $permtodelete = $user->rights->asset->delete; + $permissiontoread = $user->rights->asset->read; + $permissiontodelete = $user->rights->asset->delete; $uploaddir = $conf->asset->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -407,9 +407,13 @@ print '
'; } @@ -555,7 +560,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; } @@ -565,8 +570,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } - // Buttons for actions + if ($action != 'presend' && $action != 'editline') { print '
'."\n"; $parameters=array(); @@ -584,7 +589,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Modify - if ($user->rights->bom->write) + if ($permissiontoadd) { print ''.$langs->trans("Modify").''."\n"; } @@ -619,7 +624,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Clone - if ($user->rights->bom->write) + if ($permissiontoadd) { print '' . $langs->trans("ToClone") . ''; } @@ -638,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } */ - if ($user->rights->bom->delete) + if ($permissiontodelete) { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 0775c2cc370..c61efc84591 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,6 +113,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$permissiontoread = $user->rights->bom->read; +$permissiontoadd = $user->rights->bom->write; +$permissiontodelete = $user->rights->bom->delete; /* @@ -151,13 +153,123 @@ if (empty($reshook)) // Mass actions $objectclass='BOM'; $objectlabel='BillOfMaterials'; - $permtoread = $user->rights->bom->read; - $permtodelete = $user->rights->bom->delete; + $permissiontoread = $user->rights->bom->read; + $permissiontodelete = $user->rights->bom->delete; $uploaddir = $conf->bom->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; -} + // Validate records + if (! $error && $massaction == 'disable' && $permissiontoadd) + { + $objecttmp=new $objectclass($db); + + if (! $error) + { + $db->begin(); + + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref), null, 'errors'); + $error++; + break; + } + + // Can be 'cancel()' or 'close()' + $result = $objecttmp->cancel($user); + if ($result < 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } + } + + // Validate records + if (! $error && $massaction == 'enable' && $permissiontoadd) + { + $objecttmp=new $objectclass($db); + + if (! $error) + { + $db->begin(); + + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated", $objecttmp->ref), null, 'errors'); + $error++; + break; + } + + // Can be 'cancel()' or 'close()' + $result = $objecttmp->validate($user); + if ($result < 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } + } +} + /* * View @@ -303,7 +415,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), - //'builddoc'=>$langs->trans("PDFMerge"), + 'enable'=>$langs->trans("Enable"), + 'disable'=>$langs->trans("Disable"), ); if ($user->rights->bom->delete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array(); @@ -498,26 +611,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) @@ -539,6 +634,7 @@ print '
'."\n"; print ''."\n"; + if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { $hidegeneratedfilelistifempty=1; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 4a623c3f36d..a95b6612d99 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -91,7 +91,7 @@ class BOM extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), @@ -103,7 +103,8 @@ class BOM extends CommonObject 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), ); public $rowid; @@ -937,8 +938,7 @@ class BOM extends CommonObject $modelpath = "core/modules/bom/doc/"; - //return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - return 1; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index e78ef64b5c7..7da2c768b7f 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -90,7 +90,7 @@ function bomPrepareHead($object) if (!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + if ($nbNote > 0) $head[$h][1].= ''.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -102,7 +102,7 @@ function bomPrepareHead($object) $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ''.($nbFiles+$nbLinks).''; $head[$h][2] = 'document'; $h++; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 2a5758e61d2..670f8768e9a 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -70,7 +70,7 @@ function printBookmarksList() $ret.= ''.$langs->trans("SetHereATitleForLink").''; dol_set_focus('#titlebookmark'); @@ -229,7 +229,7 @@ if ($id > 0 && ! preg_match('/^add/i', $action)) print '
'; print '
'; - print ''; + print '
'; print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; - $totalarray['totalht'] += $obj->total_ht; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ht'; + $totalarray['val']['p.total_ht'] += $obj->total_ht; } // Amount VAT if (! empty($arrayfields['p.total_vat']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; - $totalarray['totalvat'] += $obj->total_vat; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_vat'; + $totalarray['val']['p.total_vat'] += $obj->total_vat; } // Amount TTC if (! empty($arrayfields['p.total_ttc']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; - $totalarray['totalttc'] += $obj->total_ttc; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ttc'; + $totalarray['val']['p.total_ttc'] += $obj->total_ttc; } // Amount invoiced if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) { @@ -984,8 +984,8 @@ if ($resql) print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield']; - $totalarray['totalhtinvoiced'] += $totalInvoiced; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ht_invoiced'; + $totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced; } // Amount invoiced if(! empty($arrayfields['p.total_invoiced']['checked'])) { @@ -1005,8 +1005,8 @@ if ($resql) print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield']; - $totalarray['totalinvoiced'] += $totalInvoiced; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_invoiced'; + $totalarray['val']['p.total_invoiced'] += $obj->total_invoiced; } $userstatic->id=$obj->fk_user_author; @@ -1120,45 +1120,7 @@ if ($resql) } // Show total line - if (isset($totalarray['totalhtfield']) - || isset($totalarray['totalvatfield']) - || isset($totalarray['totalttcfield']) - || isset($totalarray['totalamfield']) - || isset($totalarray['totalrtpfield']) - || isset($totalarray['totalizable']) - ) - { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''; - else print ''; - } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; - elseif ($totalarray['totalhtinvoicedfield'] == $i) print ''; - elseif ($totalarray['totalinvoicedfield'] == $i) print ''; - elseif ($totalarray['totalizable']) { - $printed = false; - foreach ($totalarray['totalizable'] as $totalizable) { - if ($totalizable['pos']==$i && ! $printed) { - print ''; - $printed = true; - } - } - if (! $printed) { - print ''; - } - } - else print ''; - } - print ''; - } + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; $db->free($resql); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a6427dbd045..57dbbabcf1d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -110,7 +110,7 @@ $usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer; $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php -$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php /* @@ -1411,7 +1411,7 @@ if (empty($reshook)) // Actions to build doc $upload_dir = $conf->commande->multidir_output[$object->entity]; - $permissioncreate = $usercancreate; + $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5f9906b58dc..dadc25737b6 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -220,8 +220,8 @@ if (empty($reshook)) // Mass actions $objectclass='Commande'; $objectlabel='Orders'; - $permtoread = $user->rights->commande->lire; - $permtodelete = $user->rights->commande->supprimer; + $permissiontoread = $user->rights->commande->lire; + $permissiontodelete = $user->rights->commande->supprimer; $uploaddir = $conf->commande->multidir_output[$conf->entity]; $trigger_name='ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -1057,24 +1057,24 @@ if ($resql) { print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; - $totalarray['totalht'] += $obj->total_ht; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht'; + $totalarray['val']['c.total_ht'] += $obj->total_ht; } // Amount VAT if (! empty($arrayfields['c.total_vat']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; - $totalarray['totalvat'] += $obj->total_tva; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva'; + $totalarray['val']['c.total_tva'] += $obj->total_tva; } // Amount TTC if (! empty($arrayfields['c.total_ttc']['checked'])) { print '\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; - $totalarray['totalttc'] += $obj->total_ttc; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc'; + $totalarray['val']['c.total_ttc'] += $obj->total_ttc; } // Extra fields @@ -1139,30 +1139,7 @@ if ($resql) } // Show total line - if (isset($totalarray['totalhtfield']) - || isset($totalarray['totalvatfield']) - || isset($totalarray['totalttcfield']) - || isset($totalarray['totalamfield']) - || isset($totalarray['totalrtpfield']) - ) - { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''; - else print ''; - } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; - else print ''; - } - print ''; - } + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; $db->free($resql); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 773ee1e9255..d23f5126375 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -209,8 +209,8 @@ if (empty($reshook)) { $objectclass='Account'; $objectlabel='BankTransaction'; - $permtoread = $user->rights->banque->lire; - $permtodelete = $user->rights->banque->supprimer; + $permissiontoread = $user->rights->banque->lire; + $permissiontodelete = $user->rights->banque->supprimer; $uploaddir = $conf->bank->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -919,13 +919,13 @@ if ($resql) if (! empty($arrayfields['b.debit']['checked'])) { print ''; } if (! empty($arrayfields['b.credit']['checked'])) { print ''; } if (! empty($arrayfields['balancebefore']['checked'])) @@ -1085,6 +1085,7 @@ if ($resql) if ($tmpnbfieldbeforebalance) { print ''; } @@ -1110,6 +1111,7 @@ if ($resql) '; print ''; print ''; print ''; } @@ -1529,7 +1531,6 @@ if ($resql) print ' '.img_warning($langs->trans("ReconciliationLate")); } } - print ' '; if ($user->rights->banque->modifier) { print 'rowid.'&id='.$objp->bankid.'&page='.$page.'">'; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 524e3f44cbc..2244a73b02a 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Ferran Marcet @@ -512,8 +512,7 @@ foreach ($accounts as $key=>$type) } else { print ''.$result->nbtodo.''; if ($result->nbtodolate) { - print ' '; - print ''; + print ''; print ' '.$result->nbtodolate; print ''; } @@ -564,8 +563,8 @@ foreach ($accounts as $key=>$type) print ''.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).''; print ''; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield']; - $totalarray['totalbalance'] += $solde; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='balance'; + $totalarray['val']['balance'] += $solde; } // Action column @@ -595,22 +594,10 @@ if (! $found) } // Show total line -if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before +if ($lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''; - else print ''; - } - elseif ($totalarray['totalbalancefield'] == $i) print ''; - else print ''; - } - print ''; + // Show total line + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; } print '
'; if ($action == 'edit') { diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index 7b5890d32b2..2c9189612f7 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -277,4 +277,69 @@ class Bookmark extends CommonObject { return ''; } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $conf, $langs, $hookmanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + + $label = '' . $langs->trans("Bookmark") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = DOL_URL_ROOT.'/bookmarks/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowBookmark"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action,$hookmanager; + $hookmanager->initHooks(array('mybookmarkdao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } } diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index bdd4f0b5429..2b34f673107 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -32,6 +32,7 @@ $massaction=GETPOST('massaction', 'alpha'); $show_files=GETPOST('show_files', 'int'); $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search // Security check if (! $user->rights->bookmark->lire) { @@ -39,11 +40,12 @@ if (! $user->rights->bookmark->lire) { } $optioncss = GETPOST('optioncss', 'alpha'); +// Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; -$sortfield = GETPOST("sortfield", 'alpha'); -$sortorder = GETPOST("sortorder", 'alpha'); -$page = GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -52,6 +54,12 @@ if (! $sortorder) $sortorder='ASC'; $id = GETPOST("id", 'int'); +$object=new Bookmark($db); + +$permissiontoread = $user->rights->bookmark->lire; +$permissiontoadd = $user->rights->bookmark->write; +$permissiontodelete = $user->rights->bookmark->delete; + /* * Actions @@ -59,8 +67,7 @@ $id = GETPOST("id", 'int'); if ($action == 'delete') { - $bookmark=new Bookmark($db); - $res=$bookmark->remove($id); + $res=$object->remove($id); if ($res > 0) { header("Location: ".$_SERVER["PHP_SELF"]); @@ -68,7 +75,7 @@ if ($action == 'delete') } else { - setEventMessages($bookmark->error, $bookmark->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -79,132 +86,182 @@ if ($action == 'delete') $userstatic=new User($db); -llxHeader('', $langs->trans("ListOfBookmarks")); +$title = $langs->trans("ListOfBookmarks"); -$newcardbutton=''; -$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer)); - - -print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'generic', 0, $newcardbutton); +llxHeader('', $title); $sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,"; $sql.= " u.login, u.lastname, u.firstname"; $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid"; $sql.= " WHERE 1=1"; -$sql.= " AND b.entity = ".$conf->entity; +$sql.= " AND b.entity IN (".getEntity('bookmark').")"; if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)"; -$sql.= $db->order($sortfield.", position", $sortorder); -$sql.= $db->plimit($limit, $offset); -$resql=$db->query($sql); -if ($resql) +$sql.=$db->order($sortfield.", position", $sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $num = $db->num_rows($resql); - $i = 0; - $param = ""; - if ($optioncss != '') $param ='&optioncss='.$optioncss; - - $moreforfilter=''; - - print '
'; - print ''."\n"; - - print ""; - //print ""; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Target", '', '', '', '', 'align="center"'); - print_liste_field_titre("Owner", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.dateb", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre(''); - print "\n"; - - while ($i < $num) + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 { - $obj = $db->fetch_object($resql); - - print ''; - - // Id - print ''; - - $linkintern=0; - $title=$obj->title; - $link=$obj->url; - - // Title - print "\n"; - - // Url - print '\n"; - - // Target - print '\n"; - - // Author - print '\n"; - - // Date creation - print '"; - - // Position - print '"; - - // Actions - print '"; - print "\n"; - $i++; + $page = 0; + $offset = 0; } - print "
 
'; - print "rowid."\">".img_object($langs->trans("ShowBookmark"), "bookmark").' '.$obj->rowid.""; - print '"; - $linkintern=1; - if ($linkintern) print "url."\">"; - print $title; - if ($linkintern) print ""; - print "'; - if (! $linkintern) print 'target?' target="newlink"':'').'>'; - print $link; - if (! $linkintern) print ''; - print "'; - if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort"); - if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort"); - print "'; - if ($obj->fk_user) - { - $userstatic->id=$obj->fk_user; - $userstatic->lastname=$obj->login; - print $userstatic->getNomUrl(1); - } - else - { - print $langs->trans("Public"); - } - print "'.dol_print_date($db->jdate($obj->dateb), 'day')."'.$obj->position."'; - if ($user->rights->bookmark->creer) - { - print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; - } - if ($user->rights->bookmark->supprimer) - { - print "rowid\">".img_delete().""; - } - else - { - print " "; - } - print "
"; - print '
'; - - $db->free($resql); +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) +{ + $num = $nbtotalofrecords; } else { - dol_print_error($db); + $sql.= $db->plimit($limit+1, $offset); + + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); } +$param = ""; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +if ($optioncss != '') $param ='&optioncss='.urlencode($optioncss); + +$moreforfilter=''; + +// List of mass actions available +$arrayofmassactions = array( + //'validate'=>$langs->trans("Validate"), + //'generate_doc'=>$langs->trans("ReGeneratePDF"), + //'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), +); +if ($permissiontodelete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$newcardbutton=''; +$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer)); + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit); + +print '
'; +print ''."\n"; + +print ""; +//print ""; +print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="left"', $sortfield, $sortorder); +print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder); +print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, 'align="left"', $sortfield, $sortorder); +print_liste_field_titre("Target", '', '', '', '', 'align="center"'); +print_liste_field_titre("Owner", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.dateb", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, 'class="right"', $sortfield, $sortorder); +print_liste_field_titre(''); +print "\n"; + +$i = 0; +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + + $object->id = $obj->rowid; + $object->ref = $obj->rowid; + + print ''; + + // Id + print ''; + + $linkintern=0; + $title=$obj->title; + $link=$obj->url; + + // Title + print "\n"; + + // Url + print '\n"; + + // Target + print '\n"; + + // Author + print '\n"; + + // Date creation + print '"; + + // Position + print '"; + + // Actions + print '"; + print "\n"; + $i++; +} +print "
 
'; + print $object->getNomUrl(1); + print '"; + $linkintern=1; + if ($linkintern) print "url."\">"; + print $title; + if ($linkintern) print ""; + print "'; + if (! $linkintern) print 'target?' target="newlink"':'').'>'; + print $link; + if (! $linkintern) print ''; + print "'; + if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort"); + if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort"); + print "'; + if ($obj->fk_user) + { + $userstatic->id=$obj->fk_user; + $userstatic->lastname=$obj->login; + print $userstatic->getNomUrl(1); + } + else + { + print $langs->trans("Public"); + } + print "'.dol_print_date($db->jdate($obj->dateb), 'day')."'.$obj->position."'; + if ($user->rights->bookmark->creer) + { + print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; + } + if ($user->rights->bookmark->supprimer) + { + print "rowid\">".img_delete().""; + } + else + { + print " "; + } + print "
"; +print '
'; + +$db->free($resql); + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6b75f5b4a50..09c8e344794 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -756,7 +756,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') // Actions to delete doc $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); -$permissioncreate = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read)); +$permissiontoadd = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read)); if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index ff69bd00c0c..0e3d7a7725e 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -102,8 +102,8 @@ if (empty($reshook)) // Mass actions /*$objectclass='MyObject'; $objectlabel='MyObject'; - $permtoread = $user->rights->mymodule->read; - $permtodelete = $user->rights->mymodule->delete; + $permissiontoread = $user->rights->mymodule->read; + $permissiontodelete = $user->rights->mymodule->delete; $uploaddir = $conf->mymodule->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; */ diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8f28a65473c..85a3b059164 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1438,7 +1438,7 @@ if (empty($reshook)) // Actions to build doc $upload_dir = $conf->propal->multidir_output[$object->entity]; - $permissioncreate=$usercancreate; + $permissiontoadd=$usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a83d7ee5161..bccc742aa8e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -241,9 +241,9 @@ if (empty($reshook)) { $objectclass='Propal'; $objectlabel='Proposals'; - $permtoread = $user->rights->propal->lire; - $permtodelete = $user->rights->propal->supprimer; - $permtoclose = $user->rights->propal->cloturer; + $permissiontoread = $user->rights->propal->lire; + $permissiontodelete = $user->rights->propal->supprimer; + $permissiontoclose = $user->rights->propal->cloturer; $uploaddir = $conf->propal->multidir_output[$conf->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -947,24 +947,24 @@ if ($resql) { print '
'.price($obj->total_ht)."'.price($obj->total_vat)."'.price($obj->total_ttc)."'.price($totalInvoiced)."'.price($totalInvoiced)."
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).''.price($totalarray['totalhtinvoiced']).''.price($totalarray['totalinvoiced']).''.price($totalizable['total']).'
'.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; + print ' '; print ''; + print ' '; print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalbalance'], 0, $langs, 0, -1, -1, $lastcurrencycode).'
'; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index cad88367aa0..d73d6d8a391 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -256,15 +256,19 @@ if ($result) // Ref print "".$variousstatic->getNomUrl(1)."\n"; + if (! $i) $totalarray['nbfield']++; // Label payment print "".dol_trunc($obj->label, 40)."\n"; + if (! $i) $totalarray['nbfield']++; // Date payment print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + if (! $i) $totalarray['nbfield']++; // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; + if (! $i) $totalarray['nbfield']++; // Account if (! empty($conf->banque->enabled)) @@ -289,6 +293,7 @@ if ($result) } else print ' '; print ''; + if (! $i) $totalarray['nbfield']++; } // Accounting account @@ -297,6 +302,7 @@ if ($result) $accountingaccount->fetch('', $obj->accountancy_code, 1); print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; + if (! $i) $totalarray['nbfield']++; } // Debit @@ -304,8 +310,10 @@ if ($result) if ($obj->sens == 0) { print price($obj->amount); - $totalarray['totaldeb'] += $obj->amount; + $totalarray['val']['total_deb'] += $obj->amount; } + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb'; print ""; // Credit @@ -313,8 +321,10 @@ if ($result) if ($obj->sens == 1) { print price($obj->amount); - $totalarray['totalcred'] += $obj->amount; + $totalarray['val']['total_cred'] += $obj->amount; } + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred'; print ""; print ""; @@ -326,12 +336,8 @@ if ($result) if (! empty($conf->banque->enabled)) $colspan++; if (! empty($conf->accounting->enabled)) $colspan++; - print ''; - print ''.$langs->trans("Total").''; - print ''.price($totalarray['totaldeb']).""; - print ''.price($totalarray['totalcred']).""; - print ''; - print ''; + // Show total line + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; print ""; print '
'; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index aef5c0573f9..706f24d00d4 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -318,6 +318,7 @@ if ($action=="create" || $action=="start") print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register'); print ''; + print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index e0461d35368..7a40d6638ee 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -168,8 +168,8 @@ if (empty($reshook)) // Mass actions $objectclass='CashControl'; $objectlabel='CashControl'; - $permtoread = ($user->rights->cashdesk->use || $user->rights->takepos->use); - $permtodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use); + $permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use); + $permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use); //$uploaddir = ''; //include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -516,26 +516,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 8af3495afc8..2a2477fce5e 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -216,22 +216,22 @@ if ($resql) if ($objp->amount < 0) { print price($objp->amount * -1); - $totalarray['totaldeb'] += $objp->amount; + $totalarray['val']['totaldebfield'] += $objp->amount; } print "\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield']; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebfield'; // Credit print ''; if ($objp->amount > 0) { print price($objp->amount); - $totalarray['totalcred'] += $objp->amount; + $totalarray['val']['totalcredfield'] += $objp->amount; } print "\n"; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield']; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredfield'; print ""; @@ -239,24 +239,7 @@ if ($resql) } // Show total line - if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield'])) - { - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - elseif ($totalarray['totaldebfield'] == $i) print ''.price(-1 * $totalarray['totaldeb']).''; - elseif ($totalarray['totalcredfield'] == $i) print ''.price($totalarray['totalcred']).''; - else print ''; - } - print ''; - } + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; print ""; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 10eb2ac03c8..bde69045bb7 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -146,8 +146,8 @@ if (empty($reshook)) // Mass actions /*$objectclass='MyObject'; $objectlabel='MyObject'; - $permtoread = $user->rights->mymodule->read; - $permtodelete = $user->rights->mymodule->delete; + $permissiontoread = $user->rights->mymodule->read; + $permissiontodelete = $user->rights->mymodule->delete; $uploaddir = $conf->mymodule->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/ @@ -1364,41 +1364,43 @@ else print ''; - if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon)) + if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon)) { print ''; + } + print '
'; print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + print ''; + $htmlname = (($usercancreate && $action == 'editmulticurrencycode')?'multicurrency_code':'none'); + $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname); + print ''; + + // Multicurrency rate + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) + { + print ''; + print ''; + print ''; + if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print ''; + } print '
'; + print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; - $htmlname = (($usercancreate && $action == 'editmulticurrencycode')?'multicurrency_code':'none'); - $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname); - print ''; - - // Multicurrency rate - if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) - { - print ''; - print ''; - print ''; - if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print ''; - print '
'; - print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; - if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if($action == 'actualizemulticurrencyrate') { - list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); - } - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code); - } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print '
        '; - print ''.$langs->trans("ActualizeCurrency").''; - print '
'; - } - } - print ''; + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } } + print ''; + } } // Help of substitution key diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index fce1fb7cb25..d462d3cc444 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1151,7 +1151,7 @@ if (empty($reshook)) } // Standard invoice or Deposit invoice, created from a Predefined template invoice - if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0) + if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($dateinvoice)) @@ -1661,6 +1661,7 @@ if (empty($reshook)) $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'none')); $object->note = trim(GETPOST('note', 'none')); + $object->note_private = trim(GETPOST('note', 'none')); $object->ref_client = GETPOST('ref_client', 'alpha'); $object->ref_int = GETPOST('ref_int', 'alpha'); $object->modelpdf = GETPOST('model', 'alpha'); @@ -2488,7 +2489,7 @@ if (empty($reshook)) // Actions to build doc $upload_dir = $conf->facture->multidir_output[$object->entity]; - $permissioncreate=$usercancreate; + $permissiontoadd=$usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -2752,10 +2753,18 @@ if ($action == 'create') // Ref print '' . $langs->trans('Ref') . '' . $langs->trans('Draft') . ''; - // Thirdparty - print '' . $langs->trans('Customer') . ''; - if ($soc->id > 0 && ! GETPOST('fac_rec', 'int')) + $exampletemplateinvoice=new FactureRec($db); + $invoice_predefined = new FactureRec($db); + if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { + $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); + } + + // Thirdparty + if ($soc->id > 0 && (! GETPOST('fac_rec', 'int') || ! empty($invoice_predefined->frequency))) + { + // If thirdparty known and not a predefined invoiced without a recurring rule + print '' . $langs->trans('Customer') . ''; print ''; print $soc->getNomUrl(1); print ''; @@ -2771,9 +2780,11 @@ if ($action == 'create') } print ')'; print ''; + print '' . "\n"; } else { + print '' . $langs->trans('Customer') . ''; print ''; print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input @@ -2790,17 +2801,14 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + if (! GETPOST('fac_rec', 'int')) print ' '.$langs->trans("AddThirdParty").''; print ''; + print '' . "\n"; } - print '' . "\n"; - - $exampletemplateinvoice=new FactureRec($db); // Overwrite some values if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { - $invoice_predefined = new FactureRec($db); $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later @@ -2827,13 +2835,14 @@ if ($action == 'create') if ($num > 0) { print '' . $langs->trans('CreateFromRepeatableInvoice') . ''; - print ''; + print 'id > 0) $text .= ' disabled'; $text .= '>'; if ($options) { @@ -3057,7 +3067,7 @@ if ($action == 'create') print '
'; $tmp='global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp.=' disabled'; + if ((! $optionsav && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) || $invoice_predefined->id > 0) $tmp.=' disabled'; $tmp.= '> '; // Show credit note options only if we checked credit note print ''; } @@ -548,6 +553,13 @@ function TakeposPrinting(id){ }); }); } +function DolibarrTakeposPrinting(id) { + console.log('Printing invoice ticket ' + id) + $.ajax({ + type: "GET", + url: "" + id, + }); +} global->TAKEPOS_PRINT_SERVER;?>:8111/print', - data: "opendrawer" - }); + type: "POST", + url: 'http://global->TAKEPOS_PRINT_SERVER;?>:8111/print', + data: "opendrawer" + }); +} + +function DolibarrOpenDrawer() { + console.log("DolibarrOpenDrawer"); + $.ajax({ + type: "GET", + url: "", + }); } function MoreActions(totalactions){ @@ -701,8 +709,11 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) //add temp ticket button if ($conf->global->TAKEPOS_BAR_RESTAURANT) { - if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'TakeposPrinting(placeid);'); - else $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'Print(placeid);'); + if ($conf->global->TAKEPOSCONNECTOR) { + $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'TakeposPrinting(placeid);'); + } else { + $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'Print(placeid);'); + } } if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1) { @@ -713,6 +724,12 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) if ($conf->global->TAKEPOSCONNECTOR) { $menus[$r++]=array('title'=>'
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action'=>'OpenDrawer();'); } +if ($conf->global->TAKEPOS_DOLIBARR_PRINTER) { + $menus[$r++] = array( + 'title' => '
'.$langs->trans("DOL_OPEN_DRAWER").'
', + 'action' => 'DolibarrOpenDrawer();', + ); +} $hookmanager->initHooks(array('takeposfrontend')); $reshook=$hookmanager->executeHooks('ActionButtons'); diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 27fc142d991..75dcde0c2e4 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -44,7 +44,7 @@ a.badge:focus, a.badge:hover { text-decoration: none; } -.liste_titre .badge { +.liste_titre .badge:not(.nochangebackground) { background-color: ; color: #fff; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 8cab8f2cf5f..37fbcbad115 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2074,7 +2074,7 @@ div.login_block_other { padding-top: 0; text-align: right; margin-right: 8px; } float: right; vertical-align: top; padding: 0px 3px 0px 4px !important; - line-height: px; + line-height: px; height: px; } .atoplogin, .atoplogin:hover { diff --git a/htdocs/theme/md/badges.inc.php b/htdocs/theme/md/badges.inc.php index 11536240ee0..9f53a631ee4 100644 --- a/htdocs/theme/md/badges.inc.php +++ b/htdocs/theme/md/badges.inc.php @@ -44,7 +44,7 @@ a.badge:focus, a.badge:hover { text-decoration: none; } -.liste_titre .badge { +.liste_titre .badge:not(.nochangebackground) { background-color: ; color: #fff; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 6aa6d42e590..feac750aa3b 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -588,7 +588,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be inc // Actions to build doc $upload_dir = $conf->ticket->dir_output; -$permissioncreate = $user->rights->ticket->write; +$permissiontoadd = $user->rights->ticket->write; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 494d6b351b8..589067934d5 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -181,13 +181,13 @@ class Ticket extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'nowraponall'), + 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth75'), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index d749aa25f02..dd95bd1bdf0 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -261,7 +261,7 @@ print ''; print '
'; // Build graphic number of object -$data = $stats->getNbByMonth($endyear, $startyear); +$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); print '
'; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 7c6f525a0c4..1360dc6efcd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018 Regis Houssin * Copyright (C) 2019 Juanjo Menent + * Copyright (C) 2019 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -175,8 +176,8 @@ if (empty($reshook)) // Mass actions $objectclass='Ticket'; $objectlabel='Ticket'; - $permtoread = $user->rights->ticket->read; - $permtodelete = $user->rights->ticket->delete; + $permissiontoread = $user->rights->ticket->read; + $permissiontodelete = $user->rights->ticket->delete; $uploaddir = $conf->ticket->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -686,26 +687,8 @@ while ($i < min($num, $limit)) } // Show total line -if (isset($totalarray['pos'])) -{ - print ''; - $i=0; - while ($i < $totalarray['nbfield']) - { - $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; - else - { - if ($i == 1) - { - if ($num < $limit) print ''.$langs->trans("Total").''; - else print ''.$langs->trans("Totalforthispage").''; - } - else print ''; - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 284c88a867b..b24b6db9381 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -308,7 +308,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco print ''; print ''; - print '
'; + print ''; print ''; @@ -362,7 +362,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco print '
'.$langs->trans("LastSalaries", ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSalaries").' '.$num.''; print '
'.$langs->trans("LastSalaries", ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSalaries").''.$num.'
'; print ''; - print '
'; + print ''; print ''; @@ -418,7 +418,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco print '
'.$langs->trans("LastHolidays", ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllHolidays").' '.$num.''; print '
'.$langs->trans("LastHolidays", ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllHolidays").''.$num.'
'; print ''; - print '
'; + print ''; print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index c924aae08bf..f689cdc71d4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -99,6 +99,8 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); +$socialnetworks = getArrayOfSocialNetworks(); + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('usercard', 'globalcard')); @@ -107,7 +109,6 @@ $hookmanager->initHooks(array('usercard', 'globalcard')); /** * Actions */ - $parameters=array('id' => $id, 'socid' => $socid, 'group' => $group, 'caneditgroup' => $caneditgroup); $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -211,10 +212,16 @@ if (empty($reshook)) { $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); - $object->skype = GETPOST("skype", 'alphanohtml'); - $object->twitter = GETPOST("twitter", 'alphanohtml'); - $object->facebook = GETPOST("facebook", 'alphanohtml'); - $object->linkedin = GETPOST("linkedin", 'alphanohtml'); + //$object->skype = GETPOST("skype", 'alphanohtml'); + //$object->twitter = GETPOST("twitter", 'alphanohtml'); + //$object->facebook = GETPOST("facebook", 'alphanohtml'); + //$object->linkedin = GETPOST("linkedin", 'alphanohtml'); + $object->socialnetworks = array(); + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); + } + } $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alphanohtml')); $object->job = GETPOST("job", 'nohtml'); @@ -366,12 +373,16 @@ if (empty($reshook)) { $object->office_phone = GETPOST("office_phone", 'alphanohtml'); $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); - - $object->skype = GETPOST("skype", 'alphanohtml'); - $object->twitter = GETPOST("twitter", 'alphanohtml'); - $object->facebook = GETPOST("facebook", 'alphanohtml'); - $object->linkedin = GETPOST("linkedin", 'alphanohtml'); - + //$object->skype = GETPOST("skype", 'alphanohtml'); + //$object->twitter = GETPOST("twitter", 'alphanohtml'); + //$object->facebook = GETPOST("facebook", 'alphanohtml'); + //$object->linkedin = GETPOST("linkedin", 'alphanohtml'); + $object->socialnetworks = array(); + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); + } + } $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alphanohtml')); $object->job = GETPOST("job", 'nohtml'); $object->signature = GETPOST("signature", 'none'); @@ -630,10 +641,10 @@ if (empty($reshook)) { $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE]; $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX]; $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE]; - $ldap_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE]; - $ldap_twitter = $attribute[$conf->global->LDAP_FIELD_TWITTER]; - $ldap_facebook = $attribute[$conf->global->LDAP_FIELD_FACEBOOK]; - $ldap_linkedin = $attribute[$conf->global->LDAP_FIELD_LINKEDIN]; + $ldap_social['skype'] = $attribute[$conf->global->LDAP_FIELD_SKYPE]; + $ldap_social['twitter'] = $attribute[$conf->global->LDAP_FIELD_TWITTER]; + $ldap_social['facebook'] = $attribute[$conf->global->LDAP_FIELD_FACEBOOK]; + $ldap_social['linkedin'] = $attribute[$conf->global->LDAP_FIELD_LINKEDIN]; $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; } @@ -654,7 +665,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->user->dir_output; - $permissioncreate=$user->rights->user->user->creer; + $permissiontoadd=$user->rights->user->user->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -1085,73 +1096,95 @@ if ($action == 'create' || $action == 'adduserldap') } print ''; - // Skype - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; + print ''; + } else { + // if social network is not active but value exist we do not want to loose it + if (! empty($ldap_social[$key])) { + print ''; + } else { + print ''; + } + } } - else - { - print ''; - } - print ''; } + // // Skype + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } - // Twitter - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; - } + // // Twitter + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } - // Facebook - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; - } + // // Facebook + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } - // LinkedIn - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; - } + // // LinkedIn + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } // Accountancy code if ($conf->accounting->enabled) @@ -2431,73 +2464,92 @@ else } print ''; - // Skype - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; + print ''; + } else { + // if social network is not active but value exist we do not want to loose it + print ''; + } } - else - { - print ''; - print $object->skype; - } - print ''; } - // Twitter - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; - } + // // Skype + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } - // Facebook - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; - } + // // Twitter + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } - // LinkedIn - if (! empty($conf->socialnetworks->enabled)) - { - print ''; - print ''; - } + // // Facebook + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } + + // // LinkedIn + // if (! empty($conf->socialnetworks->enabled)) + // { + // print ''; + // print ''; + // } // OpenID url if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 76d4d431561..6702953878c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -74,9 +74,35 @@ class User extends CommonObject public $email; public $personal_email; + + /** + * @var array array of socialnetworks + */ + public $socialnetworks; + + /** + * Skype username + * @var string + * @deprecated + */ public $skype; + /** + * Twitter username + * @var string + * @deprecated + */ public $twitter; + /** + * Facebook username + * @var string + * @deprecated + */ public $facebook; + /** + * Linkedin username + * @var string + * @deprecated + */ public $linkedin; public $job; // job position @@ -255,7 +281,8 @@ class User extends CommonObject $login=trim($login); // Get user - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.personal_email, u.job, u.skype, u.twitter, u.facebook, u.linkedin,"; + $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.personal_email, u.job,"; + $sql.= " u.socialnetworks,"; $sql.= " u.signature, u.office_phone, u.office_fax, u.user_mobile, u.personal_mobile,"; $sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; $sql.= " u.admin, u.login, u.note as note_private, u.note_public,"; @@ -366,11 +393,8 @@ class User extends CommonObject $this->user_mobile = $obj->user_mobile; $this->personal_mobile = $obj->personal_mobile; $this->email = $obj->email; - $this->personal_email = $obj->personal_email; - $this->skype = $obj->skype; - $this->twitter = $obj->twitter; - $this->facebook = $obj->facebook; - $this->linkedin = $obj->linkedin; + $this->personal_email = $obj->personal_email; + $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); $this->job = $obj->job; $this->signature = $obj->signature; $this->admin = $obj->admin; @@ -1292,10 +1316,7 @@ class User extends CommonObject $this->firstname = $contact->firstname; $this->gender = $contact->gender; $this->email = $contact->email; - $this->skype = $contact->skype; - $this->twitter = $contact->twitter; - $this->facebook = $contact->facebook; - $this->linkedin = $contact->linkedin; + $this->socialnetworks = $contact->socialnetworks; $this->office_phone = $contact->phone_pro; $this->office_fax = $contact->fax; $this->user_mobile = $contact->phone_mobile; @@ -1511,11 +1532,6 @@ class User extends CommonObject $this->email = trim($this->email); $this->personal_email = trim($this->personal_email); - $this->skype = trim($this->skype); - $this->twitter = trim($this->twitter); - $this->facebook = trim($this->facebook); - $this->linkedin = trim($this->linkedin); - $this->job = trim($this->job); $this->signature = trim($this->signature); $this->note_public = trim($this->note_public); @@ -1568,10 +1584,7 @@ class User extends CommonObject $sql.= ", personal_mobile = '".$this->db->escape($this->personal_mobile)."'"; $sql.= ", email = '".$this->db->escape($this->email)."'"; $sql.= ", personal_email = '".$this->db->escape($this->personal_email)."'"; - $sql.= ", skype = '".$this->db->escape($this->skype)."'"; - $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; - $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; - $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; + $sql.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'"; $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; @@ -1661,10 +1674,7 @@ class User extends CommonObject $adh->email=$this->email; - $adh->skype=$this->skype; - $adh->twitter=$this->twitter; - $adh->facebook=$this->facebook; - $adh->linkedin=$this->linkedin; + $adh->socialnetworks=$this->socialnetworks; $adh->phone=$this->office_phone; $adh->phone_mobile=$this->user_mobile; @@ -1714,10 +1724,7 @@ class User extends CommonObject $tmpobj->email=$this->email; - $tmpobj->skype=$this->skype; - $tmpobj->twitter=$this->twitter; - $tmpobj->facebook=$this->facebook; - $tmpobj->linkedin=$this->linkedin; + $tmpobj->socialnetworks=$this->socialnetworks; $tmpobj->phone_pro=$this->office_phone; $tmpobj->phone_mobile=$this->user_mobile; @@ -2701,10 +2708,12 @@ class User extends CommonObject $this->note_private='This is a note private'; $this->email='email@specimen.com'; $this->personal_email='personalemail@specimen.com'; - $this->skype='skypepseudo'; - $this->twitter='twitterpseudo'; - $this->facebook='facebookpseudo'; - $this->linkedin='linkedinpseudo'; + $this->socialnetworks = array( + 'skype' => 'skypepseudo', + 'twitter' => 'twitterpseudo', + 'facebook' => 'facebookpseudo', + 'linkedin' => 'linkedinpseudo', + ); $this->office_phone='0999999999'; $this->office_fax='0999999998'; $this->user_mobile='0999999997'; diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 54f39625ad4..573b7038dde 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -248,7 +248,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->usergroup->dir_output; - $permissioncreate=$user->rights->user->user->creer; + $permissiontoadd=$user->rights->user->user->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index dc990497808..59e39058629 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -98,7 +98,7 @@ else $userstatic->statut=$val['statut']; $userstatic->email=$val['email']; $userstatic->gender=$val['gender']; - $userstatic->societe_id=$val['fk_soc']; + $userstatic->socid=$val['fk_soc']; $userstatic->admin=$val['admin']; $userstatic->entity=$val['entity']; $userstatic->photo=$val['photo']; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index ec742f3e6a9..8840ba698c9 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -144,7 +144,7 @@ if ($resql) $fuserstatic->admin = $obj->admin; $fuserstatic->email = $obj->email; $fuserstatic->skype = $obj->skype; - $fuserstatic->societe_id = $obj->fk_soc; + $fuserstatic->socid = $obj->fk_soc; $companystatic->id=$obj->fk_soc; $companystatic->name=$obj->name; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 31e5c5382de..8161ce9ae75 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -502,12 +502,13 @@ while ($i < min($num, $limit)) $obj = $db->fetch_object($result); $userstatic->id=$obj->rowid; + $userstatic->admin = $obj->admin; $userstatic->ref=$obj->label; $userstatic->login=$obj->login; $userstatic->statut=$obj->statut; $userstatic->email=$obj->email; $userstatic->gender=$obj->gender; - $userstatic->societe_id=$obj->fk_soc; + $userstatic->socid=$obj->fk_soc; $userstatic->firstname=$obj->firstname; $userstatic->lastname=$obj->lastname; $userstatic->employee=$obj->employee; diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index da19bd88205..c4fd52f250c 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -110,7 +110,7 @@ $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; }); -
'.$langs->trans("LastExpenseReports", ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllExpenseReports").' '.$num.''; print '
'.$langs->trans("LastExpenseReports", ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllExpenseReports").''.$num.'
'.$langs->trans("Skype").''; - if (! empty($ldap_skype)) - { - print ''; - print $ldap_skype; + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + if ($value['active']) { + print '
'.$langs->trans($value['label']).''; + if (! empty($ldap_social[$key])) { + print ''; + print $ldap_social[$key]; + } else { + print ''; + } + print '
'.$langs->trans("Skype").''; + // if (! empty($ldap_skype)) + // { + // print ''; + // print $ldap_skype; + // } + // else + // { + // print ''; + // } + // print '
'.$langs->trans("Twitter").''; - if (! empty($ldap_twitter)) - { - print ''; - print $ldap_twitter; - } - else - { - print ''; - } - print '
'.$langs->trans("Twitter").''; + // if (! empty($ldap_twitter)) + // { + // print ''; + // print $ldap_twitter; + // } + // else + // { + // print ''; + // } + // print '
'.$langs->trans("Facebook").''; - if (! empty($ldap_facebook)) - { - print ''; - print $ldap_facebook; - } - else - { - print ''; - } - print '
'.$langs->trans("Facebook").''; + // if (! empty($ldap_facebook)) + // { + // print ''; + // print $ldap_facebook; + // } + // else + // { + // print ''; + // } + // print '
'.$langs->trans("LinkedIn").''; - if (! empty($ldap_linkedin)) - { - print ''; - print $ldap_linkedin; - } - else - { - print ''; - } - print '
'.$langs->trans("LinkedIn").''; + // if (! empty($ldap_linkedin)) + // { + // print ''; + // print $ldap_linkedin; + // } + // else + // { + // print ''; + // } + // print '
'.$langs->trans("Skype").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; + if (! empty($conf->socialnetworks->enabled)) { + foreach ($socialnetworks as $key => $value) { + if ($value['active']) { + print '
'.$langs->trans($value['label']).''; + if ($caneditfield && empty($object->ldap_sid)) { + print ''; + } else { + print ''; + print $object->socialnetworks[$key]; + } + print '
'.$langs->trans("Twitter").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->twitter; - } - print '
'.$langs->trans("Skype").''; + // if ($caneditfield && empty($object->ldap_sid)) + // { + // print ''; + // } + // else + // { + // print ''; + // print $object->skype; + // } + // print '
'.$langs->trans("Facebook").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->facebook; - } - print '
'.$langs->trans("Twitter").''; + // if ($caneditfield && empty($object->ldap_sid)) + // { + // print ''; + // } + // else + // { + // print ''; + // print $object->twitter; + // } + // print '
'.$langs->trans("LinkedIn").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->linkedin; - } - print '
'.$langs->trans("Facebook").''; + // if ($caneditfield && empty($object->ldap_sid)) + // { + // print ''; + // } + // else + // { + // print ''; + // print $object->facebook; + // } + // print '
'.$langs->trans("LinkedIn").''; + // if ($caneditfield && empty($object->ldap_sid)) + // { + // print ''; + // } + // else + // { + // print ''; + // print $object->linkedin; + // } + // print '
+
diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e0e3378bf26..cd32fc97e18 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3280,7 +3280,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print ''."\n"; print '
'; - if ($action == 'replacesiteconfirm') + if ($action == 'replacesiteconfirm' && $conf->global->MAIN_FEATURES_LEVEL >= 2) { print '
'; print '
'; diff --git a/htdocs/website/lib/websiteaccount.lib.php b/htdocs/website/lib/websiteaccount.lib.php index 3190c081a43..4c2048798a5 100644 --- a/htdocs/website/lib/websiteaccount.lib.php +++ b/htdocs/website/lib/websiteaccount.lib.php @@ -46,7 +46,7 @@ function websiteaccountPrepareHead($object) if(!empty($object->fields['note_public'])) $nbNote++; $head[$h][0] = dol_buildpath('/monmodule/websiteaccount_note.php', 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + if ($nbNote > 0) $head[$h][1].= ''.$nbNote.''; $head[$h][2] = 'note'; $h++; }*/ @@ -59,7 +59,7 @@ function websiteaccountPrepareHead($object) $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = dol_buildpath("/monmodule/websiteaccount_document.php", 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ''.($nbFiles+$nbLinks).''; $head[$h][2] = 'document'; $h++; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index db8c5b632f6..be7c773ed25 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -67,8 +67,7 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; $permissionnote=$user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php $permissiondellink=$user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php -$permissionedit=$user->rights->websiteaccount->write; // Used by the include of actions_lineupdown.inc.php -$permissiontoadd=$user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd=$user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 5c79d68aefe..fdc7aba2bc9 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -633,39 +633,22 @@ class Hook extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelStatus)) { - global $langs; - //$langs->load("zapier@zapier"); - $this->labelStatus[1] = $langs->trans('Enabled'); - $this->labelStatus[0] = $langs->trans('Disabled'); - } + global $langs; - if ($mode == 0) { - return $this->labelStatus[$status]; - } elseif ($mode == 1) { - return $this->labelStatus[$status]; - } elseif ($mode == 2) { - if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - } - } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); - } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - } elseif ($mode == 5) { - if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); - } elseif ($mode == 6) { - if ($status == 1) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - } elseif ($status == 0) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); - } - } + if (empty($this->labelStatus) || empty($this->labelStatusShort)) + { + global $langs; + //$langs->load("mymodule"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + } + + $statusType = 'status5'; + if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php index e622ce8bcff..21e9c991d07 100644 --- a/htdocs/zapier/hook_list.php +++ b/htdocs/zapier/hook_list.php @@ -191,8 +191,8 @@ if (empty($reshook)) { // Mass actions $objectclass='Hook'; $objectlabel='Hook'; - $permtoread = $user->rights->mymodule->read; - $permtodelete = $user->rights->mymodule->delete; + $permissiontoread = $user->rights->mymodule->read; + $permissiontodelete = $user->rights->mymodule->delete; $uploaddir = $conf->mymodule->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -570,27 +570,8 @@ while ($i < min($num, $limit)) { } // Show total line -if (isset($totalarray['pos'])) { - print '
'; - $i=0; - while ($i < $totalarray['nbfield']) { - $i++; - if (! empty($totalarray['pos'][$i])) { - print ''; - } else { - if ($i == 1) { - if ($num < $limit) { - print ''; - } else { - print ''; - } - } else { - print ''; - } - } - } - print ''; -} +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // If no record found if ($num == 0) { diff --git a/htdocs/zapier/lib/zapier_hook.lib.php b/htdocs/zapier/lib/zapier_hook.lib.php index e1af0259062..98c10786c32 100644 --- a/htdocs/zapier/lib/zapier_hook.lib.php +++ b/htdocs/zapier/lib/zapier_hook.lib.php @@ -48,7 +48,7 @@ function myobjectPrepareHead($object) if (!empty($object->note_public)) $nbNote++; $head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + if ($nbNote > 0) $head[$h][1].= ''.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -60,7 +60,7 @@ function myobjectPrepareHead($object) $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ''.($nbFiles+$nbLinks).''; $head[$h][2] = 'document'; $h++; diff --git a/htdocs/zapier/zapierindex.php b/htdocs/zapier/zapierindex.php index 9bec765c35e..f70f9e8c95d 100644 --- a/htdocs/zapier/zapierindex.php +++ b/htdocs/zapier/zapierindex.php @@ -106,7 +106,7 @@ if (! empty($conf->zapierfordolibarr->enabled) && $user->rights->zapierfordoliba print '
trans('Ref') ?> trans('Label') ?>
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'; print ''; - print ''; + print ''; $var = true; if ($num > 0) diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index f4b5fc71616..8fdaea0cbe7 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -207,7 +207,7 @@ class ContactTest extends PHPUnit\Framework\TestCase $localobject->phone_mobile='New tel mobile'; $localobject->fax='New fax'; $localobject->email='newemail@newemail.com'; - $localobject->jabberid='New im id'; + $localobject->socialnetworks['jabber']='New im id'; $localobject->default_lang='es_ES'; $result=$localobject->update($localobject->id, $user); @@ -257,8 +257,8 @@ class ContactTest extends PHPUnit\Framework\TestCase $this->assertEquals($localobject->fax, $newobject->fax); print __METHOD__." old=".$localobject->email." new=".$newobject->email."\n"; $this->assertEquals($localobject->email, $newobject->email); - print __METHOD__." old=".$localobject->jabberid." new=".$newobject->jabberid."\n"; - $this->assertEquals($localobject->jabberid, $newobject->jabberid); + print __METHOD__." old=".$localobject->socialnetworks['jabber']." new=".$newobject->socialnetworks['jabber']."\n"; + $this->assertEquals($localobject->socialnetworks['jabber'], $newobject->socialnetworks['jabber']); print __METHOD__." old=".$localobject->default_lang." new=".$newobject->default_lang."\n"; $this->assertEquals($localobject->default_lang, $newobject->default_lang); diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index e46d1ac084a..3c89bd52d06 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -192,7 +192,7 @@ class UserTest extends PHPUnit\Framework\TestCase $newlocalobject=new User($this->savdb); $newlocalobject->initAsSpecimen(); $this->changeProperties($newlocalobject); - $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','ref','pass','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array()); // Actual, Expected + $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','note','ref','pass','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array()); // Actual, Expected return $localobject; } @@ -304,12 +304,12 @@ class UserTest extends PHPUnit\Framework\TestCase /** * Edit an object to test updates * - * @param mixed $localobject Object Facture + * @param mixed $localobject Object User * @return void */ public function changeProperties(&$localobject) { - $localobject->note='New note after update'; + $localobject->note_private='New note after update'; } /**
'.$langs->trans("DraftOrders").($num?' '.$num.'':'').'
'.$langs->trans("DraftOrders").($num?''.$num.'':'').'