diff --git a/ChangeLog b/ChangeLog index 49b632dff92..891b27ba78f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,22 +4,59 @@ English Dolibarr ChangeLog ***** ChangeLog for 9.0.0 compared to 8.0.0 ***** - For Users: NEW: Stable module: Website NEW: Stable module: WebDAV NEW: Stable module: Module Builder NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making - Android application like DoliDroid able to provide native features for multicompany module - + Android application like DoliDroid able to provide native features for multicompany module. For developers: -Code changes to be more compatible with PSR2 +* Code changes to be more compatible with PSR2 +* Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that) +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* If you use some links like viewimages.php?modulepart=mycompany&file=... in you external modules, you must + replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for + modulepart=mycompany that now works like others). + + + +***** ChangeLog for 8.0.1 compared to 8.0.0 ***** +FIX: #9258 +FIX: #9328 +FIX: #9337 +FIX: adding GROUP BY for PostgreSQL +FIX: API template for list pages in module builder +FIX: API template for record page to delete a record +FIX: a removed option was still in setup +FIX: badge on time spent on project and tasks +FIX: Delete file on smartphone +FIX: Fetch function will fetch comments +FIX: Fetch task will now fetch comments +FIX: $fk_account is always empty, must be $soc->fk_account +FIX: Force stripe api version to avoid trouble if we update stripe api +FIX: get_product_vat_for_country functions.lib.php +FIX: Get templates in a forced language +FIX: hook on dispatch order fourn +FIX: Language selection lost if error during creation of email template +FIX: Look and feel v8 +FIX: propal.class.php +FIX: Add calls to fetchComments function +FIX: Remove fetchComments from project and task fetch function +FIX: remove internal property isextrafieldmanaged from API returns +FIX: sql error +FIX: table llx_chargessociales doesn't exists +FIX: trans on null object +FIX: vat rate code not returned by get_product_vat_for_country +FIX: warning for late template invoices to remove when suspended +FIX: Add hidden option MAIN_xxx_IN_SOURCE_ADDRESS to solve legal issues on PDF +FIX: Table llx_facture_rec_extrafields missing after migration ***** ChangeLog for 8.0.0 compared to 7.0.0 ***** - For Users: NEW: Experimental module: Ticket NEW: Experimental module: WebDAV @@ -205,7 +242,8 @@ Following changes may create regressions for some external modules, but were nec * Remove method Categorie:get_nb_categories() that was not used. * Hook getnomurltooltip provide a duplicate feature compared to hook getNomUrl so all hooks getnomurltooltip are now replaced with hook getNomUrl. - +* The substitution key __CONTACTCIVNAME__ is no longer present, it has been replaced by __CONTACT_NAME_{TYPE}__ + where {TYPE} is contact type code (BILLING, SHIPPING, CUSTOMER, ... see contact type dictionnary). ***** ChangeLog for 7.0.3 compared to 7.0.2 ***** diff --git a/README.md b/README.md index b68e8b65558..dfd9d70ab7c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # DOLIBARR ERP & CRM -![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) +![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) + +|6|7|8|develop| +|----------|----------|----------|----------| +|![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/6.0.svg)|![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/7.0.svg)|![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/8.0.svg)|![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)| Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index b8ddcebf18c..79b16bdbf55 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -238,9 +238,9 @@ - + diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 3d1445b0cce..123b7f6157d 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -64,7 +64,7 @@ class autoTranslator // Translate //ini_set('default_charset','UTF-8'); ini_set('default_charset',$this->_outputpagecode); - $this->parse_refLangTranslationFiles(); + $this->parseRefLangTranslationFiles(); } /** @@ -72,8 +72,7 @@ class autoTranslator * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - private function parse_refLangTranslationFiles() + private function parseRefLangTranslationFiles() { $files = $this->getTranslationFilesArray($this->_refLang); diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 2587a58aef6..ca47dbc7b96 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -121,6 +121,9 @@ if (empty($reshook)) if ($country_code) { $sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql'; + + // FIXME Get the ADD rowid and pass it + num of comapny * 100 000 000 to run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value. + $result = run_sql($sqlfile, 1, 0, 1); } diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 389b835e38e..cc4dd9dbb7f 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -169,12 +170,12 @@ if ($action == 'create') // Date start print '' . $langs->trans("DateStart") . ''; - print $form->select_date(($date_start ? $date_start : ''), 'fiscalyear'); + print $form->selectDate(($date_start ? $date_start : ''), 'fiscalyear'); print ''; // Date end print '' . $langs->trans("DateEnd") . ''; - print $form->select_date(($date_end ? $date_end : - 1), 'fiscalyearend'); + print $form->selectDate(($date_end ? $date_end : - 1), 'fiscalyearend'); print ''; /* @@ -225,12 +226,12 @@ if ($action == 'create') // Date start print '' . $langs->trans("DateStart") . ''; - print $form->select_date($object->date_start ? $object->date_start : - 1, 'fiscalyear'); + print $form->selectDate($object->date_start ? $object->date_start : - 1, 'fiscalyear'); print ''; // Date end print '' . $langs->trans("DateEnd") . ''; - print $form->select_date($object->date_end ? $object->date_end : - 1, 'fiscalyearend'); + print $form->selectDate($object->date_end ? $object->date_end : - 1, 'fiscalyearend'); print ''; // Statut diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 7e8532e5225..20d0a5200a5 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -128,16 +128,16 @@ complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort, // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") $elementList = array(); - // Must match ids defined into eldy.lib.php - $sourceList = array( - '1' => $langs->trans('AccountingJournalType1'), - '2' => $langs->trans('AccountingJournalType2'), - '3' => $langs->trans('AccountingJournalType3'), - '4' => $langs->trans('AccountingJournalType4'), - '5' => $langs->trans('AccountingJournalType5'), - '8' => $langs->trans('AccountingJournalType8'), - '9' => $langs->trans('AccountingJournalType9') - ); +// Must match ids defined into eldy.lib.php +$sourceList = array( + '1' => $langs->trans('AccountingJournalType1'), + '2' => $langs->trans('AccountingJournalType2'), + '3' => $langs->trans('AccountingJournalType3'), + '4' => $langs->trans('AccountingJournalType4'), + '5' => $langs->trans('AccountingJournalType5'), + '8' => $langs->trans('AccountingJournalType8'), + '9' => $langs->trans('AccountingJournalType9'), +); /* * Actions @@ -294,10 +294,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } -if (GETPOST('actioncancel')) -{ - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} +//if (GETPOST('actioncancel')) +//{ +// $_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition +//} if ($action == 'confirm_delete' && $confirm == 'yes') // delete { diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index b8ab8d9af9f..e3290f1e542 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,8 @@ - * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2018 Alexandre Spangaro +/* Copyright (C) 2016 Olivier Geffroy + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -193,9 +194,9 @@ else { $moreforfilter .= '
'; $moreforfilter .= $langs->trans('DateStart') . ': '; - $moreforfilter .= $form->select_date($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1, '', 1, 0, 1); + $moreforfilter .= $form->selectDate($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1, '', 1, 0); $moreforfilter .= $langs->trans('DateEnd') . ': '; - $moreforfilter .= $form->select_date($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1, '', 1, 0, 1); + $moreforfilter .= $form->selectDate($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1, '', 1, 0); $moreforfilter .= '
'; if (! empty($moreforfilter)) { diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index e17cefd77bb..5add04d7361 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2017 Florian Henry * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -350,7 +351,7 @@ if ($action == 'create') print ''; print '' . $langs->trans("Docdate") . ''; print ''; - print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); + print $html->selectDate('', 'doc_date', '', '', '', "create_mvt", 1, 1); print ''; print ''; @@ -432,7 +433,7 @@ if ($action == 'create') print ''; print ''; print ''; - $form->select_date($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); + print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); print ''; print ''; } else { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ee44b52ab7d..132aa4e0afa 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -465,11 +466,11 @@ if (! empty($arrayfields['t.doc_date']['checked'])) print ''; print '
'; print $langs->trans('From') . ' '; - print $form->select_date($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); print '
'; print '
'; print $langs->trans('to') . ' '; - print $form->select_date($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); print '
'; print ''; } @@ -556,11 +557,11 @@ if (! empty($arrayfields['t.date_creation']['checked'])) print ''; print '
'; print $langs->trans('From') . ' '; - print $form->select_date($search_date_creation_start, 'date_creation_start', 0, 0, 1); + print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1); print '
'; print '
'; print $langs->trans('to') . ' '; - print $form->select_date($search_date_creation_end, 'date_creation_end', 0, 0, 1); + print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1); print '
'; print ''; } @@ -570,11 +571,11 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; print '
'; print $langs->trans('From') . ' '; - print $form->select_date($search_date_modification_start, 'date_modification_start', 0, 0, 1); + print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1); print '
'; print '
'; print $langs->trans('to') . ' '; - print $form->select_date($search_date_modification_end, 'date_modification_end', 0, 0, 1); + print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1); print '
'; print ''; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 55e9c8ab7ad..c5726901e2e 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -287,10 +288,10 @@ print ''; print ''; print ''; print $langs->trans('From') . ': '; -print $form->select_date($search_date_start, 'search_date_start', 0, 0, 1); +print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1); print '
'; print $langs->trans('to') . ': '; -print $form->select_date($search_date_end, 'search_date_end', 0, 0, 1); +print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1); print ''; print ''; print ''; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index e1a881c9dfa..b0c3adb7edd 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -56,24 +56,69 @@ class AccountancyCategory // extends CommonObject */ public $table_element='c_accounting_category'; - public $id; + /** + * @var int ID + */ + public $id; + + /** + * @var mixed Sample property 1 + */ public $code; /** - * @var string proper name for given parameter + * @var string Accountancy Category label */ public $label; + /** + * @var mixed Sample property 1 + */ public $range_account; + + /** + * @var mixed Sample property 1 + */ public $sens; + + /** + * @var mixed Sample property 1 + */ public $category_type; + + /** + * @var mixed Sample property 1 + */ public $formula; + + /** + * @var mixed Sample property 1 + */ public $position; + + /** + * @var mixed Sample property 1 + */ public $fk_country; + + /** + * @var mixed Sample property 1 + */ public $active; + /** + * @var mixed Sample property 1 + */ public $lines_cptbk; + + /** + * @var mixed Sample property 1 + */ public $lines_display; + + /** + * @var mixed Sample property 1 + */ public $sdc; @@ -150,18 +195,18 @@ class AccountancyCategory // extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_accounting_category"); - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. + //if (! $notrigger) + //{ - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - } + // // Call triggers + // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + // $interface=new Interfaces($this->db); + // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); + // if ($result < 0) { $error++; $this->errors=$interface->errors; } + // // End call triggers + //} } // Commit or rollback @@ -289,18 +334,17 @@ class AccountancyCategory // extends CommonObject if (! $error) { - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. - - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - } + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. + //if (! $notrigger) + //{ + // // Call triggers + // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + // $interface=new Interfaces($this->db); + // $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); + // if ($result < 0) { $error++; $this->errors=$interface->errors; } + // // End call triggers + //} } // Commit or rollback @@ -345,18 +389,17 @@ class AccountancyCategory // extends CommonObject if (! $error) { - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. - - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - } + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. + //if (! $notrigger) + //{ + // // Call triggers + // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + // $interface=new Interfaces($this->db); + // $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); + // if ($result < 0) { $error++; $this->errors=$interface->errors; } + // // End call triggers + //} } // Commit or rollback diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 8b30070317a..d126bd84acc 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -32,22 +32,22 @@ class AccountancySystem * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + var $rowid; var $fk_pcg_version; var $pcg_type; var $pcg_subtype; - + /** - * @var string proper name for given parameter + * @var string Accountancy System label */ public $label; - + var $account_number; var $account_parent; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index c6848bfe689..4929e118a3b 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -37,6 +37,9 @@ class AccountingAccount extends CommonObject */ public $table_element='accounting_account'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'billr'; /** @@ -71,14 +74,19 @@ class AccountingAccount extends CommonObject */ public $id; - var $rowid; - var $datec; // Creation date - var $fk_pcg_version; - var $pcg_type; - var $pcg_subtype; - var $account_number; - var $account_parent; - var $account_category; + /** + * @var int ID + */ + public $rowid; + + public $datec; // Creation date + public $fk_pcg_version; + public $pcg_type; + public $pcg_subtype; + public $account_number; + public $account_parent; + public $account_category; + public $status; /** * @var string Label of account @@ -96,7 +104,6 @@ class AccountingAccount extends CommonObject public $fk_user_modif; public $active; // duplicate with status - public $status; /** @@ -528,15 +535,16 @@ class AccountingAccount extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Account deactivated * * @param int $id Id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function account_desactivate($id) { + // phpcs:enable $result = $this->checkUsage(); if ($result > 0) { @@ -562,15 +570,16 @@ class AccountingAccount extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Account activated * * @param int $id Id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function account_activate($id) { + // phpcs:enable $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; @@ -601,6 +610,7 @@ class AccountingAccount extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -608,9 +618,9 @@ class AccountingAccount extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->loadLangs(array("users")); @@ -620,27 +630,27 @@ class AccountingAccount extends CommonObject if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 91cc87e6952..058bdb3dddb 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -36,16 +36,27 @@ class AccountingJournal extends CommonObject */ public $table_element='accounting_journal'; + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element = ''; + public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'generic'; + /** + * @var int ID + */ public $rowid; public $code; /** - * @var string proper name for given parameter + * @var string Accounting Journal label */ public $label; @@ -260,6 +271,7 @@ class AccountingJournal extends CommonObject return $this->LibType($this->nature,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return type of an accounting journal * @@ -267,9 +279,9 @@ class AccountingJournal extends CommonObject * @param int $mode 0=libelle long, 1=libelle court * @return string Label of type */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibType($nature,$mode=0) { + // phpcs:enable global $langs; $langs->loadLangs(array("accountancy")); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 85d25aad432..5d9572da684 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -35,22 +35,25 @@ class BookKeeping extends CommonObject * @var string Error code (or message) */ public $error; - + /** * @var string[] Error codes (or messages) */ public $errors = array(); - + /** * @var string Id to identify managed objects */ public $element = 'accountingbookkeeping'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'accounting_bookkeeping'; + /** + * @var int Entity + */ public $entity; /** @@ -62,8 +65,7 @@ class BookKeeping extends CommonObject * @var int ID */ public $id; - /** - */ + public $doc_date; public $date_lim_reglement; public $doc_type; @@ -333,18 +335,15 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (! $error) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + //if (! $error && ! $notrigger) { - if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. - - // // Call triggers - // $result=$this->call_trigger('MYOBJECT_CREATE',$user); - // if ($result < 0) $error++; - // // End call triggers - } - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + //} // Commit or rollback if ($error) { @@ -564,15 +563,15 @@ class BookKeeping extends CommonObject if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element . $mode); - if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + //if (! $notrigger) { - // // Call triggers - // $result=$this->call_trigger('MYOBJECT_CREATE',$user); - // if ($result < 0) $error++; - // // End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + //} } // Commit or rollback @@ -1129,15 +1128,15 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (! $error && ! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (! $error && ! $notrigger) { - // // Call triggers - // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); - // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - // // End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} // Commit or rollback if ($error) { @@ -1203,17 +1202,15 @@ class BookKeeping extends CommonObject $this->db->begin(); - if (! $error) { - if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (! $error && ! $notrigger) { - // // Call triggers - // $result=$this->call_trigger('MYOBJECT_DELETE',$user); - // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - // // End call triggers - } - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_DELETE',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} if (! $error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode; @@ -1551,15 +1548,16 @@ class BookKeeping extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Export bookkeping * * @param string $model Model * @return int Result */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function export_bookkeping($model = 'ebp') { + // phpcs:enable global $conf; $sql = "SELECT rowid, doc_date, doc_type,"; @@ -1704,11 +1702,12 @@ class BookKeeping extends CommonObject */ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected chart of accounts - * @param string $htmlname Name of field in html form + * @param string $selectid Preselected chart of accounts + * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options * @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1) @@ -1716,9 +1715,9 @@ class BookKeeping extends CommonObject * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @return string String with HTML select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + // phpcs:enable global $conf; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -1775,15 +1774,16 @@ class BookKeeping extends CommonObject return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Description of a root accounting account * * @param string $account Accounting account * @return string Root account */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_compte_racine($account = null) { + // phpcs:enable global $conf; $pcgver = $conf->global->CHARTOFACCOUNTS; @@ -1816,15 +1816,16 @@ class BookKeeping extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Description of accounting account * * @param string $account Accounting account * @return string Account desc */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_compte_desc($account = null) { + // phpcs:enable global $conf; $pcgver = $conf->global->CHARTOFACCOUNTS; @@ -1862,7 +1863,11 @@ class BookKeeping extends CommonObject */ class BookKeepingLine { + /** + * @var int ID + */ public $id; + public $doc_date = ''; public $doc_type; public $doc_ref; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 45387722719..4f4932fe08f 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -153,7 +153,7 @@ $y = $year_current; $buttonbind = '' . $langs->trans("ValidateHistory") . ''; print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); -//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print '
'; print ''; @@ -229,7 +229,7 @@ print '
'; print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); -//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); print '
'; print '
'; @@ -309,7 +309,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print '
'; print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); - //print_fiche_titre($langs->trans("OtherInfo"), '', ''); + //print load_fiche_titre($langs->trans("OtherInfo"), '', ''); print '
'; print '
'; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 7f906e93879..837a8c36630 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -150,7 +150,7 @@ $buttonbind = 'trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print '
'; print '
'; @@ -221,7 +221,7 @@ print '
'; print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); -//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); print '
'; @@ -297,7 +297,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print '
'; print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); - //print_fiche_titre($langs->trans("OtherInfo"), '', ''); + //print load_fiche_titre($langs->trans("OtherInfo"), '', ''); print '
'; print '
'; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 53ba48ff9d9..ac674eb95e0 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -55,7 +55,7 @@ if ($conf->accounting->enabled) print $langs->trans("AccountancyAreaDescIntro")."
\n"; print "
\n";print "
\n"; - print_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."
\n"; + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."
\n"; print '
'; print "
\n"; @@ -131,7 +131,7 @@ if ($conf->accounting->enabled) print "
\n"; - print_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); print '
'; print "
\n"; $step = 0; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e5741e940a6..7cd98743480 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -7,7 +7,7 @@ * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2017 Frédéric France + * Copyright (C) 2017-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -852,7 +852,8 @@ if (empty($action) || $action == 'view') { $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; $listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); - $period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); + $period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0); + $period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $varlink = 'id_journal=' . $id_journal; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 07982f107fd..c39a750af1a 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -6,6 +6,7 @@ * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -534,7 +535,8 @@ if (empty($action) || $action == 'view') { $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; $listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); - $period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); + $period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0); + $period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $varlink = 'id_journal=' . $id_journal; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 14501ae9b82..d8be52cef90 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -6,6 +6,7 @@ * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -726,7 +727,8 @@ if (empty($action) || $action == 'view') { } $listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); - $period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); + $period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0); + $period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $varlink = 'id_journal=' . $id_journal; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index a53d4698500..8e44d1a2c10 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -8,6 +8,7 @@ * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -656,7 +657,8 @@ if (empty($action) || $action == 'view') { $description .= $langs->trans("DepositsAreIncluded"); $listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); - $period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); + $period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0); + $period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $varlink = 'id_journal=' . $id_journal; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3e6a6991f6c..d0ee7579f3b 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -150,7 +150,7 @@ $buttonbind = '
trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print '
'; print '
'; @@ -221,7 +221,7 @@ print '
'; print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); -//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); +//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); print '
'; print '
'; @@ -295,7 +295,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print '
'; print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); - //print_fiche_titre($langs->trans("OtherInfo"), '', ''); + //print load_fiche_titre($langs->trans("OtherInfo"), '', ''); print '
'; print '
'; diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 2abc3b10841..ba43b6d47a6 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -33,8 +33,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -$langs->load("admin"); -$langs->load("members"); +// Load translation files required by the page +$langs->loadLangs(array("admin","members")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index 76d40e57c17..60e0b2c3b48 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -33,8 +33,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -$langs->load("admin"); -$langs->load("members"); +// Load translation files required by the page +$langs->loadLangs(array("admin","members")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index f47f92faa4c..0ec1968ab34 100644 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -28,8 +28,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -$langs->load("members"); -$langs->load("admin"); +// Load translation files required by the page +$langs->loadLangs(array("admin","members")); $extrafields = new ExtraFields($db); $form = new Form($db); diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index e78c4ef29e5..3a5226d00f4 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -31,8 +31,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -$langs->load("members"); -$langs->load("admin"); +// Load translation files required by the page +$langs->loadLangs(array("admin","members")); $extrafields = new ExtraFields($db); $form = new Form($db); diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 75a3c4ee0d7..91df8e59ea5 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -$langs->load("members"); -$langs->load("admin"); +// Load translation files required by the page +$langs->loadLangs(array("admin","members")); $action=GETPOST('action', 'alpha'); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 8fb1851e021..f22070107ca 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -33,8 +33,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -$langs->load("companies"); -$langs->load("members"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members")); $id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int'); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index fe91fc74436..b84534af37a 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -75,16 +75,17 @@ abstract class ActionsAdherentCardCommon //} } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Set content of ->tpl array, to use into template * * @param string $action Type of action * @param int $id Id * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $conf, $langs, $user, $canvas; global $form, $formcompany, $objsoc; @@ -233,14 +234,15 @@ abstract class ActionsAdherentCardCommon } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign POST values into object * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post() { + // phpcs:enable global $langs, $mysoc; $this->object->old_name = $_POST["old_name"]; diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index c5d6a89a152..be7af41e894 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -67,6 +67,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas * @@ -74,9 +75,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon * @param int $id Id * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $db, $langs, $user; global $form; @@ -121,6 +122,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -130,9 +132,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf, $langs; //$this->getFieldList(); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index d7060124ee4..3d3c8fb6e54 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1,11 +1,12 @@ - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2018 Regis Houssin - * Copyright (C) 2012 Marcos García - * Copyright (C) 2012-2018 Philippe Grand - * Copyright (C) 2015-2016 Alexandre Spangaro +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2018 Regis Houssin + * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2018 Philippe Grand + * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -980,7 +981,7 @@ else // Birthday print "\n"; // Public profil @@ -1218,7 +1219,7 @@ else // Birthday print "\n"; // Public profil diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fdc414a2fba..90f20ca323d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -53,67 +53,73 @@ class Adherent extends CommonObject public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $mesgs; + public $mesgs; - var $login; + public $login; //! Clear password in memory - var $pass; + public $pass; //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) - var $pass_indatabase; + public $pass_indatabase; //! Encrypted password in database (always defined) - var $pass_indatabase_crypted; + public $pass_indatabase_crypted; - var $societe; - var $company; - var $address; - var $zip; - var $town; + public $societe; + public $company; + public $address; + public $zip; + public $town; - var $state_id; // Id of department - var $state_code; // Code of department - var $state; // Label of department + public $state_id; // Id of department + public $state_code; // Code of department + public $state; // Label of department - var $email; - var $skype; - var $phone; - var $phone_perso; - var $phone_mobile; + public $email; + public $skype; + public $phone; + public $phone_perso; + public $phone_mobile; - var $morphy; - var $public; - var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye - var $photo; + public $morphy; + public $public; + public $statut; // -1:brouillon, 0:resilie, >=1:valide,paye + public $photo; - var $datec; - var $datem; - var $datefin; - var $datevalid; - var $birth; + public $datec; + public $datem; + public $datefin; + public $datevalid; + public $birth; - var $note_public; - var $note_private; + public $note_public; + public $note_private; - var $typeid; // Id type adherent - var $type; // Libelle type adherent - var $need_subscription; + public $typeid; // Id type adherent + public $type; // Libelle type adherent + public $need_subscription; - var $user_id; - var $user_login; + public $user_id; + public $user_login; - var $fk_soc; + /** + * @var int Thirdparty ID + */ + public $fk_soc; // Fields loaded by fetch_subscriptions() - var $first_subscription_date; - var $first_subscription_amount; - var $last_subscription_date; - var $last_subscription_date_start; - var $last_subscription_date_end; - var $last_subscription_amount; - var $subscriptions=array(); + public $first_subscription_date; + public $first_subscription_amount; + public $last_subscription_date; + public $last_subscription_date_start; + public $last_subscription_date_end; + public $last_subscription_amount; + public $subscriptions=array(); - var $oldcopy; // To contains a clone of this when we need to save old properties of object + public $oldcopy; // To contains a clone of this when we need to save old properties of object + /** + * @var int Entity + */ public $entity; /** @@ -132,6 +138,7 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function sending an email has the adherent with the text supplied in parameter. * @@ -147,9 +154,9 @@ class Adherent extends CommonObject * @param string $errors_to erros to * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') { + // phpcs:enable global $conf,$langs; // Detect if message is HTML @@ -638,6 +645,7 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update denormalized last subscription date. * This function is called when we delete a subscription for example. @@ -645,9 +653,9 @@ class Adherent extends CommonObject * @param User $user User making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_end_date($user) { + // phpcs:enable $this->db->begin(); // Search for last subscription id and end date @@ -993,15 +1001,16 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Method to load member from its login * * @param string $login login of member * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_login($login) { + // phpcs:enable global $conf; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; @@ -1023,6 +1032,7 @@ class Adherent extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Method to load member from its name * @@ -1030,9 +1040,9 @@ class Adherent extends CommonObject * @param string $lastname Lastname * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_name($firstname,$lastname) { + // phpcs:enable global $conf; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; @@ -1195,6 +1205,7 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui recupere pour un adherent les parametres * first_subscription_date @@ -1204,9 +1215,9 @@ class Adherent extends CommonObject * * @return int <0 si KO, >0 si OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_subscriptions() { + // phpcs:enable global $langs; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; @@ -1750,14 +1761,15 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to add member into external tools mailing-list, spip, etc. * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_abo() { + // phpcs:enable global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -1808,14 +1820,15 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to delete a member from external tools like mailing-list, spip, etc. * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_abo() { + // phpcs:enable global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -1988,6 +2001,7 @@ class Adherent extends CommonObject return $this->LibStatut($this->statut,$this->need_subscription,$this->datefin,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1997,9 +2011,9 @@ class Adherent extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) { + // phpcs:enable global $langs; $langs->load("members"); if ($mode == 0) @@ -2013,7 +2027,7 @@ class Adherent extends CommonObject } if ($statut == 0) return $langs->trans("MemberStatusResiliated"); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); if ($statut >= 1) @@ -2024,7 +2038,7 @@ class Adherent extends CommonObject } if ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); if ($statut >= 1) @@ -2035,7 +2049,7 @@ class Adherent extends CommonObject } if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) @@ -2046,7 +2060,7 @@ class Adherent extends CommonObject } if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); if ($statut >= 1) @@ -2057,7 +2071,7 @@ class Adherent extends CommonObject } if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated"); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) @@ -2068,7 +2082,7 @@ class Adherent extends CommonObject } if ($statut == 0) return ''.$langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) @@ -2082,14 +2096,15 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); @@ -2117,15 +2132,16 @@ class Adherent extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -2260,6 +2276,7 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -2269,9 +2286,9 @@ class Adherent extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN; @@ -2281,14 +2298,15 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); @@ -2618,6 +2636,7 @@ class Adherent extends CommonObject $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); $outputlangs->loadLangs(array("main", "members")); + dol_syslog("sendReminderForExpiredSubscription Language set to ".$outputlangs->defaultlang); $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index b7d510a3e0f..a9d7fd7ead3 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -36,13 +36,17 @@ class AdherentType extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'adherent_type'; - + /** * @var string ID to identify managed object */ public $element = 'adherent_type'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'group'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** @@ -51,19 +55,25 @@ class AdherentType extends CommonObject * @see label */ public $libelle; + /** @var string Label */ public $label; + /** * @var int Subsription required (0 or 1) * @since 5.0 */ public $subscription; + /** @var string Public note */ public $note; + /** @var integer Can vote */ public $vote; + /** @var string Email sent during validation */ public $mail_valid; + /** @var array Array of members */ public $members=array(); @@ -290,14 +300,15 @@ class AdherentType extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of members' type * * @return array List of types of members */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { + // phpcs:enable global $conf,$langs; $adherenttypes = array(); @@ -422,6 +433,7 @@ class AdherentType extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -431,9 +443,9 @@ class AdherentType extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN; @@ -443,14 +455,15 @@ class AdherentType extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 90452816be8..1c64560cf79 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -36,21 +36,24 @@ class Subscription extends CommonObject * @var string ID to identify managed object */ public $element='subscription'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='subscription'; - - public $picto='payment'; - var $datec; // Date creation - var $datem; // Date modification - var $dateh; // Subscription start date (date subscription) - var $datef; // Subscription end date - var $fk_adherent; - var $amount; - var $fk_bank; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='payment'; + + public $datec; // Date creation + public $datem; // Date modification + public $dateh; // Subscription start date (date subscription) + public $datef; // Subscription end date + public $fk_adherent; + public $amount; + public $fk_bank; /** @@ -363,15 +366,16 @@ class Subscription extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut) { + // phpcs:enable global $langs; $langs->load("members"); return ''; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 46b2b827d73..7e46b7864f8 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -33,9 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -$langs->load("members"); -$langs->load("companies"); -$langs->load('other'); +// Load translation files required by the page +$langs->loadLangs(array("companies","members","other")); + $id=GETPOST('id','int'); $action=GETPOST('action','alpha'); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 030700bb0f6..931e9323904 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -29,8 +29,8 @@ 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.'/adherents/class/subscription.class.php'; -$langs->load("companies"); -$langs->load("members"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members")); // Security check $result=restrictedArea($user,'adherent'); diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index f7389e9fbbc..5b830623a4b 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -29,10 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -$langs->load("companies"); -$langs->load("members"); -$langs->load("ldap"); -$langs->load("admin"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members","ldap","admin")); $rowid = GETPOST('id','int'); $action = GETPOST('action','aZ09'); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index db017d71f61..7b90878dff7 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -48,6 +48,7 @@ $search=GETPOST("search",'alpha'); $search_ref=GETPOST("search_ref",'alpha'); $search_lastname=GETPOST("search_lastname",'alpha'); $search_firstname=GETPOST("search_firstname",'alpha'); +$search_civility=GETPOST("search_civility",'alpha'); $search_login=GETPOST("search_login",'alpha'); $search_address=GETPOST("search_address",'alpha'); $search_zip=GETPOST("search_zip",'alpha'); @@ -105,6 +106,7 @@ $fieldstosearchall = array( if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']); $arrayfields=array( 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0), 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), 'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1), @@ -121,7 +123,7 @@ $arrayfields=array( 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), /*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0), - 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ + 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ 'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500), 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -160,6 +162,7 @@ if (empty($reshook)) $search_ref=""; $search_lastname=""; $search_firstname=""; + $search_civility=""; $search_login=""; $search_company=""; $search_type=""; @@ -203,7 +206,7 @@ $memberstatic=new Adherent($db); $now=dol_now(); $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; -$sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; +$sql.= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql.= " t.libelle as type, t.subscription,"; @@ -234,6 +237,7 @@ if ($search_ref) if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")"; else $sql.=" AND 1 = 2"; // Always wrong } +if ($search_civility) $sql.= natural_search("d.civility", $search_civility); if ($search_firstname) $sql.= natural_search("d.firstname", $search_firstname); if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); if ($search_login) $sql.= natural_search("d.login", $search_login); @@ -322,6 +326,7 @@ if ($sall != "") $param.="&sall=".urlencode($sall); if ($statut != "") $param.="&statut=".urlencode($statut); if ($search_ref) $param.="&search_ref=".urlencode($search_ref); if ($search_nom) $param.="&search_nom=".urlencode($search_nom); +if ($search_civility) $param.="&search_civility=".urlencode($search_civility); if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname); if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); if ($search_login) $param.="&search_login=".urlencode($search_login); @@ -427,37 +432,36 @@ if (! empty($arrayfields['d.ref']['checked'])) print ''; print ''; } - +if (! empty($arrayfields['d.civility']['checked'])) +{ + print ''; +} if (! empty($arrayfields['d.firstname']['checked'])) { print ''; } - if (! empty($arrayfields['d.lastname']['checked'])) { print ''; } - if (! empty($arrayfields['d.company']['checked'])) { print ''; } - if (! empty($arrayfields['d.login']['checked'])) { print ''; } - if (! empty($arrayfields['d.morphy']['checked'])) { print ''; } - if (! empty($arrayfields['t.libelle']['checked'])) { print '\n"; print ''; if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID",$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'],$_SERVER["PHP_SELF"],'d.civility','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); @@ -605,6 +610,7 @@ while ($i < min($num, $limit)) $datefin=$db->jdate($obj->datefin); $memberstatic->id=$obj->rowid; $memberstatic->ref=$obj->rowid; + $memberstatic->civility_id=$obj->civility; $memberstatic->lastname=$obj->lastname; $memberstatic->firstname=$obj->firstname; $memberstatic->statut=$obj->statut; @@ -630,10 +636,17 @@ while ($i < min($num, $limit)) // Ref if (! empty($arrayfields['d.ref']['checked'])) { - print "\n"; } + // Civility + if (! empty($arrayfields['d.civility']['checked'])) + { + print "\n"; + } // Firstname if (! empty($arrayfields['d.firstname']['checked'])) { @@ -658,12 +671,12 @@ while ($i < min($num, $limit)) // Login if (! empty($arrayfields['d.login']['checked'])) { - print "\n"; + print "\n"; } // Moral/Physique if (! empty($arrayfields['d.morphy']['checked'])) { - print "\n"; + print "\n"; } // Type label if (! empty($arrayfields['t.libelle']['checked'])) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index ae278b5dbb5..8cd12cd6ca2 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -28,9 +28,8 @@ 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'; -$langs->load("companies"); -$langs->load("members"); -$langs->load("bills"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members","bills")); $action=GETPOST('action','alpha'); $id=GETPOST('id','int'); diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 7ae29a7eeb9..defbde2dce2 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -44,8 +44,8 @@ $year = strftime("%Y", time()); $startyear=$year-2; $endyear=$year; -$langs->load("members"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members")); /* diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 9de537ed39a..2175569b7ce 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -45,8 +45,8 @@ $year = strftime("%Y", time()); $startyear=$year-2; $endyear=$year; -$langs->load("members"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members")); /* diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 902c2d35359..e3bc7287864 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -46,8 +46,8 @@ $year = strftime("%Y", time()); $startyear=$year-2; $endyear=$year; -$langs->load("members"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members")); /* diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 6312bc8494b..78a7ce8495f 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -1,9 +1,10 @@ - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2018 Laurent Destailleur - * Copyright (C) 2012-2017 Regis Houssin - * Copyright (C) 2015-2016 Alexandre Spangaro +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2012-2017 Regis Houssin + * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -895,7 +896,7 @@ if ($rowid > 0) $datefrom=dol_time_plus_duree($object->datefin,1,'d'); } } - print $form->select_date($datefrom,'','','','',"subscription",1,1,1); + print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); print ""; // Date end subscription @@ -908,7 +909,7 @@ if ($rowid > 0) $dateto=-1; // By default, no date is suggested } print '"; if ($adht->subscription) @@ -1009,7 +1010,7 @@ if ($rowid > 0) // Date of payment print '\n"; print ''; print ''; // Date end subscription print ''; print ''; diff --git a/htdocs/adherents/subscription/info.php b/htdocs/adherents/subscription/info.php index 649a1e22996..eb8f8e4eab3 100644 --- a/htdocs/adherents/subscription/info.php +++ b/htdocs/adherents/subscription/info.php @@ -28,10 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; -$langs->load("companies"); -$langs->load("bills"); -$langs->load("members"); -$langs->load("users"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members","bills","users")); if (!$user->rights->adherent->lire) accessforbidden(); diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index 5d60beb2a4d..c18074130aa 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -29,9 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php'; -$langs->load("members"); -$langs->load("admin"); -$langs->load("ldap"); +// Load translation files required by the page +$langs->loadLangs(array("admin","members","ldap")); $id = GETPOST('rowid', 'int'); $action = GETPOST('action','alpha'); diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 842c8d01470..8215bdbe0b1 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -356,7 +356,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 4e0c683a73f..519f2b42938 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -306,7 +306,7 @@ if (! empty($conf->product->enabled)) print ''; print ''; print ''; } @@ -317,7 +317,7 @@ if (! empty($conf->societe->enabled)) print ''; print ''; print ''; } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 7bc968457f9..f7242ee43bc 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -50,6 +50,7 @@ $error=0; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admincompany','globaladmin')); + /* * Actions */ @@ -397,7 +398,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { print '   '; - print ''; + print ''; } } else { print ''; @@ -791,7 +792,7 @@ else } else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print ''; + print ''; } else { diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 14dfb9922f6..19fa67abcff 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -122,6 +122,13 @@ $modules=array( ), ); +$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); + + +/* + * Actions + */ + if ($action == 'update') { foreach($modules as $module => $delays) @@ -201,9 +208,10 @@ if ($action == 'edit') print '
".$langs->trans("Birthday")."\n"; - $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); + print $form->selectDate(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); print "
".$langs->trans("Birthday")."\n"; - $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); + print $form->selectDate(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); print "
'; + print ''; print ''; print ''; print ''; print ''; print ''; @@ -568,6 +572,7 @@ print "
"; + print ""; print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print ""; + print $obj->civility; + print "".$obj->login."".$obj->login."".$memberstatic->getmorphylib($obj->morphy)."".$memberstatic->getmorphylib($obj->morphy)."
'.$langs->trans("DateEndSubscription").''; - print $form->select_date($dateto,'end','','','',"subscription",1,0,1); + print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); print "
'.$langs->trans("DatePayment").''; - print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'subscription',1,1,1); + print $form->selectDate(isset($paymentdate)?$paymentdate:-1, 'payment', 0, 0, 1, 'subscription', 1, 1); print "
'.$langs->trans('Numero'); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 34b58c5b04d..94950f02b05 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2007-2012 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,10 +30,8 @@ if (! empty($conf->banque->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; } -$langs->load("companies"); -$langs->load("bills"); -$langs->load("members"); -$langs->load("users"); +// Load translation files required by the page +$langs->loadLangs(array("companies","members","bills","users")); $adh = new Adherent($db); $object = new Subscription($db); @@ -211,13 +210,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Date start subscription print '
'.$langs->trans("DateSubscription").''; - $form->select_date($object->dateh,'datesub',1,1,0,'update',1); + print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1); print '
'.$langs->trans("DateEndSubscription").''; - $form->select_date($object->datef,'datesubend',0,0,0,'update',1); + print $form->selectDate($object->datef, 'datesubend', 0, 0, 0, 'update', 1); print '
'.$langs->trans("AGENDA_DEFAULT_VIEW").' '."\n"; -$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); +$tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); print '
'.$langs->trans("SetDefaultBarcodeTypeProducts").''; - $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1); + print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1); print '
'.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; - print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"GENBARCODE_BARCODETYPE_THIRDPARTY",1); + print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1); print '
'; print ''; - $var=false; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").'' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '
'.$langs->trans("MAIN_DISABLE_METEO").''; + print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO)?0:$conf->global->MAIN_DISABLE_METEO)); + print '
'; } @@ -241,7 +249,9 @@ else print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; print ''; - print ''.$langs->trans("MAIN_DISABLE_METEO").'' . yn($conf->global->MAIN_DISABLE_METEO) . ''; + print ''.$langs->trans("MAIN_DISABLE_METEO").''; + print $labelmeteo[$conf->global->MAIN_DISABLE_METEO]; + print ''; print ''; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index c4dae079c3c..859b9140f86 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -163,15 +163,16 @@ class Dolistore } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tree of Dolistore categories. $this->categories must have been loaded before. * * @param int $parent Id of parent category * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_categories($parent = 0) { + // phpcs:enable if (!isset($this->categories)) die('not possible'); if ($parent != 0) { $html = '
    '; @@ -211,14 +212,15 @@ class Dolistore } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of product formated for output * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_products() { + // phpcs:enable global $langs, $conf; $html = ""; $parity = "pair"; @@ -293,38 +295,41 @@ class Dolistore return $html; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get previous link * * @param string $text symbol previous * @return string html previous link */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_previous_link($text = '<<') { + // phpcs:enable return ''.$text.''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get next link * * @param string $text symbol next * @return string html next link */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_next_link($text = '>>') { + // phpcs:enable return ''.$text.''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get previous url * * @return string previous url */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function get_previous_url() + function get_previous_url() { + // phpcs:enable $param_array = array(); if ($this->start < $this->per_page) { $sub = 0; @@ -340,14 +345,15 @@ class Dolistore return $this->url."&".$param; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get next url * * @return string next url */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_next_url() { + // phpcs:enable $param_array = array(); if (count($this->products) < $this->per_page) { $add = 0; @@ -363,6 +369,7 @@ class Dolistore return $this->url."&".$param; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * version compare * @@ -370,9 +377,9 @@ class Dolistore * @param string $v2 version 2 * @return int result of compare */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function version_compare($v1, $v2) { + // phpcs:enable $v1 = explode('.', $v1); $v2 = explode('.', $v2); $ret = 0; diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index d49d25b76b6..7b2baf0ed94 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -1,7 +1,8 @@ - * Copyright (C) 2017 ATM Consulting - * Copyright (C) 2017 Pierre-Henry Favre +/* Copyright (C) 2012 Mikael Carlavan + * Copyright (C) 2017 ATM Consulting + * Copyright (C) 2017 Pierre-Henry Favre + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -182,8 +183,8 @@ if ($action != 'edit') echo ''.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).''; echo ''.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).''; - echo ''.$form->select_date(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0, 1).''; - echo ''.$form->select_date(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0, 1).''; + echo ''.$form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0).''; + echo ''.$form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0).''; echo ''.$conf->currency.''; echo ''.$form->selectyesno('restrictive', 0, 1).''; echo ''; @@ -270,7 +271,7 @@ foreach ($rules as $rule) echo ''; if ($action == 'edit' && $object->id == $rule->id) { - echo $form->select_date(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0, 1); + print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); } else { @@ -282,7 +283,7 @@ foreach ($rules as $rule) echo ''; if ($action == 'edit' && $object->id == $rule->id) { - echo $form->select_date(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0, 1); + print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); } else { diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index e2d1cfca145..f6306f787c3 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -1,8 +1,7 @@ - * Copyright (C) 2011-2015 Philippe Grand - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2018 Charlene Benke * * 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 @@ -30,9 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; -$langs->load("admin"); -$langs->load("errors"); -$langs->load("holiday"); +// Load translation files required by the page +$langs->loadLangs(array("admin", "errors", "holiday")); if (!$user->admin) accessforbidden(); @@ -341,7 +339,6 @@ print "\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { foreach (array('','/doc') as $valdir) @@ -379,7 +376,6 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - $var = !$var; print ''; print (empty($module->name)?$name:$module->name); print "\n"; @@ -474,7 +470,6 @@ print ''; print ''.$langs->trans("Parameter").''; print ''.$langs->trans("Value").''; print "\n"; -$var=true; $substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); @@ -482,7 +477,6 @@ $htmltext = ''.$langs->trans("AvailableVariables").':
    '; foreach($substitutionarray as $key => $val) $htmltext.=$key.'
    '; $htmltext.='
    '; -$var=! $var; print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

    '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); print '
    '; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 4cb5a907927..e15e6d0f91f 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,6 +134,9 @@ if ($action == 'update') if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black) else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity); + if (GETPOST('THEME_ELDY_USE_CHECKED') == '') dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", '0', 'chaine', 0, '', $conf->entity); + else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $_POST["THEME_ELDY_USE_CHECKED"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); @@ -413,7 +417,7 @@ if ($action == 'edit') // Edit print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { print '   '; - print ''; + print ''; } } else { print ''; @@ -561,7 +565,7 @@ else // Show print $conf->global->MAIN_LOGIN_BACKGROUND; if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { - print ''; + print ''; } else { diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 2864fe79df0..0db2d3cd6d1 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -28,9 +28,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; - -$langs->load("admin"); -$langs->load('other'); +// Load translation files required by the page +$langs->loadLangs(array("other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 2e6d8a91008..9d0178c956d 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -27,8 +27,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; -$langs->load("other"); -$langs->load("admin"); +// Load translation files required by the page +$langs->loadLangs(array("other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index 0446c59af1d..7b1a73f2f09 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -24,9 +24,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -$langs->load("users"); -$langs->load("admin"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("user","other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 71656475e6f..89f0f028e1e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -598,17 +598,18 @@ if ($mode == 'common') } // Print a separator if we change family - if ($familykey!=$oldfamily) - { - if ($oldfamily) print '

'; + if ($familykey != $oldfamily) { + if ($oldfamily) { + print '
'; + } - $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label']; - print_fiche_titre($familytext, '', ''); + $familytext = empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label']; + print load_fiche_titre($familytext, '', ''); print '
'; - print ''."\n"; + print '
'."\n"; - $atleastoneforfamily=0; + $atleastoneforfamily=0; } $atleastoneforfamily++; diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index fe09ee14378..9843c6a4fb0 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -171,7 +171,7 @@ llxHeader('', $langs->trans($page_name)); // Subheader $linkback = '' . $langs->trans("BackToModuleList") . ''; -print_fiche_titre($langs->trans($page_name), $linkback); +print load_fiche_titre($langs->trans($page_name), $linkback); // Configuration header $head = multicurrencyAdminPrepareHead(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 52ffa53ad59..76b3cf76b57 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -32,11 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other')); - -$langs->load("companies"); -$langs->load("products"); -$langs->load("members"); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members')); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index c5ec770e393..a68a4bda5a6 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -75,7 +75,7 @@ if ($action == 'update') llxHeader('',$langs->trans('SalariesSetup')); $form = new Form($db); -if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); +if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup'); diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 65ce01a4faf..bbda698a778 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -32,17 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page -$langs->load("orders"); +$langs->loadLangs(array("admin", "other", "bills", "orders", "suppliers")); if (!$user->admin) accessforbidden(); -$langs->load("admin"); -$langs->load("other"); -$langs->load("bills"); -$langs->load("orders"); -$langs->load("suppliers"); - $extrafields = new ExtraFields($db); $form = new Form($db); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index e9ea61ac944..ba61203191a 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -28,10 +28,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -$langs->load("admin"); -$langs->load("help"); -$langs->load("members"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("help","members","other","admin")); $action=GETPOST('action','alpha'); @@ -196,7 +194,7 @@ if ($showpromotemessage) { print '
'; print '
'; - + if ((empty($tmp[2]) && (strpos($tmp[1], '0') === 0)) || (strpos($tmp[2], '0') === 0)) { print $langs->trans("TitleExampleForMajorRelease").':
'; diff --git a/htdocs/admin/system/browser.php b/htdocs/admin/system/browser.php index c5aeff70b88..9df49489e34 100644 --- a/htdocs/admin/system/browser.php +++ b/htdocs/admin/system/browser.php @@ -26,9 +26,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -$langs->load("admin"); -$langs->load("install"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("install","other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 9d4c4fc3cec..d510cc07773 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -24,9 +24,8 @@ require '../../main.inc.php'; -$langs->load("admin"); -$langs->load("user"); -$langs->load("install"); +// Load translation files required by the page +$langs->loadLangs(array("install","user","admin")); if (!$user->admin) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 4dd4ef9dc9b..9c2ee62565d 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -29,9 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -$langs->load("admin"); -$langs->load("install"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("install","other","admin")); $action=GETPOST('action','alpha'); diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 65a9354a19f..0418830cce8 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -422,7 +422,7 @@ if (! $error && $xml) $outcurrentchecksum = ''.$checksumget.''; } - print_fiche_titre($langs->trans("GlobalChecksum")).'
'; + print load_fiche_titre($langs->trans("GlobalChecksum")).'
'; print $langs->trans("ExpectedChecksum").' = '. $outexpectedchecksum .'
'; print $langs->trans("CurrentChecksum").' = '. $outcurrentchecksum; @@ -438,4 +438,3 @@ llxFooter(); $db->close(); exit($error); - diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 65e19fb9d83..c70ad1b7fba 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -25,9 +25,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->load("admin"); -$langs->load("install"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("install","other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 85ac2aea006..d69723f1299 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -26,9 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->load("admin"); -$langs->load("install"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("install","other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index aca900c1cbc..9dc3deec5ac 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -24,8 +24,8 @@ require '../../main.inc.php'; -$langs->load("admin"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("other","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index c5a05ef2136..aed25ae45a3 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -24,8 +24,8 @@ require '../../main.inc.php'; -$langs->load("admin"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("companies","admin")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index db5157789e1..9afe7c5fcb3 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,10 +41,8 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$langs->load("admin"); -$langs->load("companies"); -$langs->load("users"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("companies","admin","users","other")); // Load variable for pagination $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; @@ -237,7 +236,7 @@ if ($result) // Lignes des champs de filtres print '
'; - print ''; + print ''; print ''; print ''; // User diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eaec787b099..dab99d80bc9 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -39,6 +39,7 @@ class BlockedLog * @var int */ public $id; + /** * Entity * @var int @@ -46,7 +47,7 @@ class BlockedLog public $entity; public $error = ''; - + /** * @var string[] Error codes (or messages) */ diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index 2d156832861..b7846cd0864 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -29,17 +29,21 @@ class Bookmark extends CommonObject { /** - * @var string ID to identify managed object - */ - public $element='bookmark'; - + * @var string ID to identify managed object + */ + public $element='bookmark'; + /** * @var string Name of table without prefix where object is stored */ public $table_element='bookmark'; - + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - public $picto = 'bookmark'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'bookmark'; /** * @var DoliDB Database handler. @@ -50,14 +54,18 @@ class Bookmark extends CommonObject * @var int ID */ public $id; - - var $fk_user; - var $datec; - var $url; - var $target; // 0=replace, 1=new window - var $title; - var $position; - var $favicon; + + /** + * @var int User ID + */ + public $fk_user; + + public $datec; + public $url; + public $target; // 0=replace, 1=new window + public $title; + public $position; + public $favicon; /** diff --git a/htdocs/cashdesk/affIndex.php b/htdocs/cashdesk/affIndex.php index a2e467a35e3..9ff676531f1 100644 --- a/htdocs/cashdesk/affIndex.php +++ b/htdocs/cashdesk/affIndex.php @@ -36,9 +36,8 @@ if ( $_SESSION['uid'] <= 0 ) exit; } -$langs->load("companies"); -$langs->load("compta"); -$langs->load("cashdesk"); +// Load translation files required by the page +$langs->loadLangs(array("companies","compta","cashdesk")); /* diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 755c48faf88..3051035813a 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -37,7 +37,12 @@ class Facturation * int $prix => Prix HT du produit en cours * int $tva => 'rowid' du taux de tva dans llx_c_tva */ - public $id; + + /** + * @var int ID + */ + public $id; + protected $ref; protected $qte; protected $stock; diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 24b94562915..d2ea5160ca8 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -28,8 +28,8 @@ require_once '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; -$langs->load("admin"); -$langs->load("cashdesk"); +// Load translation files required by the page +$langs->loadLangs(array("admin","cashdesk")); // Test if user logged if ( $_SESSION['uid'] > 0 ) @@ -63,7 +63,7 @@ top_htmlhead('','',0,0,'',$arrayofcss); logo_small)) { - print 'Logo company'; + print 'Logo company'; } else { diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 238a73f6ef7..cd354293022 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -30,9 +30,8 @@ include '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php'; -$langs->load("main"); -$langs->load("admin"); -$langs->load("cashdesk"); +// Load translation files required by the page +$langs->loadLangs(array("main","admin","cashdesk")); $username = GETPOST("txtUsername"); $password = GETPOST("pwdPassword"); @@ -119,7 +118,7 @@ if ( $retour >= 0 ) $_SESSION['firstname'] = $tab['firstname']; $_SESSION['CASHDESK_ID_THIRDPARTY'] = ($thirdpartyid > 0 ? $thirdpartyid : ''); $_SESSION['CASHDESK_ID_WAREHOUSE'] = ($warehouseid > 0 ? $warehouseid : ''); - + $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : ''); @@ -135,8 +134,8 @@ if ( $retour >= 0 ) } else { - $langs->load("errors"); - $langs->load("other"); + // Load translation files required by the page + $langs->loadLangs(array("other","errors")); $retour=$langs->trans("ErrorBadLoginPassword"); header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid); exit; diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 146ae3d40b6..4ddafd17c44 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -3,6 +3,7 @@ * Copyright (C) 2011 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2015 Regis Houssin + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,10 +27,8 @@ if (empty($langs) || ! is_object($langs)) exit; } - -$langs->load("main"); -$langs->load("bills"); -$langs->load("cashdesk"); +// Load translation files required by the page +$langs->loadLangs(array("main","bills","cashdesk")); // Object $form must de defined @@ -204,7 +203,7 @@ $langs->load("cashdesk"); " onclick="javascript: verifClic('DIF');" /> trans("DateDue").' :'; - print $form->select_date(-1,'txtDatePaiement',0,0,0,'paymentmode',1,0,1); + print $form->selectDate(-1,'txtDatePaiement',0,0,0,'paymentmode',1,0); print ''; ?> diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index 65f48b0603c..266c5e5840b 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -28,9 +28,8 @@ if (empty($langs) || ! is_object($langs)) require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -$langs->load("main"); -$langs->load("bills"); -$langs->load("cashdesk"); +// Load translation files required by the page +$langs->loadLangs(array("main","bills","cashdesk")); ?> diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 250aaa18cc2..afe2c0da4ec 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -63,9 +63,8 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) $warehouseLink = $warehouse->getNomUrl(1); } - -$langs->load("cashdesk"); -$langs->load("main"); +// Load translation files required by the page +$langs->loadLangs(array("main","cashdesk")); print "\n".''."\n"; print ''; // Date end @@ -702,12 +707,17 @@ if ($action == 'create') $datef=dol_time_plus_duree($datep, $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS, 'h'); } print ''; - $userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress + // Dev in progress + $userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); if ($userepeatevent) { // Repeat @@ -1057,30 +1067,38 @@ if ($id > 0) // Date start print ''; // Date end print ''; - $userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress + // Dev in progress + $userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); if ($userepeatevent) { // Repeat print ''; if (! empty($arrayfields['a.datep']['checked'])) { print ''; } if (! empty($arrayfields['a.datep2']['checked'])) { print ''; } - if (! empty($arrayfields['s.nom']['checked'])) print ''; + if (! empty($arrayfields['s.nom']['checked'])) { + print ''; + } if (! empty($arrayfields['a.fk_contact']['checked'])) print ''; if (! empty($arrayfields['a.fk_element']['checked'])) print ''; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 9350de8f85c..31f22420cb8 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2014 Cedric GROSS + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -262,7 +263,7 @@ $nav.=''; $nav.=''; $nav.=''; -$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); +$nav.= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav.=' '; $nav.=''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 58690dc512b..7b02857becf 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2014 Cedric GROSS + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -276,7 +277,7 @@ $nav.=''; $nav.=''; $nav.=''; */ -$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); +$nav.= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav.=' '; //$nav.=''; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 3c1c02057c3..5874a7b855c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -181,7 +181,7 @@ if (empty($reshook)) if ($action == 'setorder_min_amount') { $object->fetch($id); - $object->order_min_amount=GETPOST('order_min_amount'); + $object->order_min_amount=price2num(GETPOST('order_min_amount','alpha')); $result=$object->update($object->id, $user); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } @@ -423,15 +423,21 @@ if ($object->id > 0) print ''; print ''; + } - print ''; - print ''; - print ''; + if ($object->client) + { + if (! empty($conf->commande->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) + { + print ''."\n"; + print ''; + print ''; + print ''; + } } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 14d1fb20f4e..c862b8392fd 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -254,15 +254,16 @@ class AdvanceTargetingMailing extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * * @param int $id Id object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_mailing($id=0) { + // phpcs:enable global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -320,6 +321,7 @@ class AdvanceTargetingMailing extends CommonObject + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -327,9 +329,9 @@ class AdvanceTargetingMailing extends CommonObject * @param string $type_element Type target * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_element($id=0, $type_element='mailing') { + // phpcs:enable global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -546,15 +548,16 @@ class AdvanceTargetingMailing extends CommonObject + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * * @param array $arrayquery All element to Query * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function query_thirdparty($arrayquery) { + // phpcs:enable global $langs,$conf; $sql = "SELECT"; @@ -700,6 +703,7 @@ class AdvanceTargetingMailing extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * @@ -707,9 +711,9 @@ class AdvanceTargetingMailing extends CommonObject * @param int $withThirdpartyFilter add contact with tridparty filter * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function query_contact($arrayquery, $withThirdpartyFilter = 0) { + // phpcs:enable global $langs,$conf; $sql = "SELECT"; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index fa7a9a1bc9e..7a0d758ae17 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -35,48 +35,51 @@ class Mailing extends CommonObject * @var string ID to identify managed object */ public $element='mailing'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='mailing'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='email'; - var $titre; - var $sujet; - var $body; - var $nbemail; - var $bgcolor; - var $bgimage; + public $titre; + public $sujet; + public $body; + public $nbemail; + public $bgcolor; + public $bgimage; - var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely + public $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely - var $email_from; - var $email_replyto; - var $email_errorsto; + public $email_from; + public $email_replyto; + public $email_errorsto; - var $joined_file1; - var $joined_file2; - var $joined_file3; - var $joined_file4; + public $joined_file1; + public $joined_file2; + public $joined_file3; + public $joined_file4; - var $user_creat; - var $user_valid; + public $user_creat; + public $user_valid; - var $date_creat; - var $date_valid; + public $date_creat; + public $date_valid; - var $extraparams=array(); + public $extraparams=array(); public $statut_dest=array(); public $statuts=array(); - /** + /** * Constructor * - * @param DoliDb $db Database handler + * @param DoliDb $db Database handler */ function __construct($db) { @@ -439,14 +442,15 @@ class Mailing extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete targets emailing * * @return int 1 if OK, 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_targets() { + // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$this->id; @@ -464,15 +468,16 @@ class Mailing extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Change status of each recipient * * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reset_targets_status($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " SET statut = 0"; $sql.= " WHERE fk_mailing = ".$this->id; @@ -536,6 +541,7 @@ class Mailing extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -543,42 +549,38 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('mails'); - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) - { - return $langs->trans($this->statuts[$statut]); - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3'); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); @@ -606,39 +608,39 @@ class Mailing extends CommonObject { return $langs->trans('MailingStatusError'); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans('MailingStatusSent'); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index e9ddee12b22..55f49c44cfd 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -45,7 +45,7 @@ if ($user->societe_id > 0) if ($_POST["action"] == 'setpricelevel') { - $soc = New Societe($db); + $soc = new Societe($db); $soc->fetch($id); $soc->set_price_level($_POST["price_level"],$user); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2be1aea8928..30fa8d74a8d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo @@ -12,6 +12,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2016 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1495,7 +1496,7 @@ if ($action == 'create') // Date print ''; // Validaty duration @@ -1543,9 +1544,9 @@ if ($action == 'create') $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); - $form->select_date($syear."-".$smonth."-".$sday, 'date_livraison', '', '', '', "addprop"); + print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', '', '', '', "addprop"); } else { - $form->select_date(-1, 'date_livraison', '', '', '', "addprop", 1, 1); + print $form->selectDate(-1, 'date_livraison', '', '', '', "addprop", 1, 1); } print ''; @@ -1929,7 +1930,7 @@ if ($action == 'create') print ''; print ''; print ''; - $form->select_date($object->date, 're', '', '', 0, "editdate"); + print $form->selectDate($object->date, 're', '', '', 0, "editdate"); print ''; print ''; } else { @@ -1955,7 +1956,7 @@ if ($action == 'create') print ''; print ''; print ''; - $form->select_date($object->fin_validite, 'ech', '', '', '', "editecheance"); + print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); print ''; print ''; } else { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d59ccc63d1c..45e139c0b4f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -55,8 +55,19 @@ class Propal extends CommonObject */ public $table_element='propal'; + /** + * @var int Name of subtable line + */ public $table_element_line='propaldet'; - public $fk_element='fk_propal'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element ='fk_propal'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='propal'; /** @@ -232,9 +243,10 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Add line into array products - * $this->thirdparty should be loaded + * Add line into array products + * $this->thirdparty should be loaded * * @param int $idproduct Product Id to add * @param int $qty Quantity @@ -244,9 +256,9 @@ class Propal extends CommonObject * TODO Replace calls to this function by generation objet Ligne * inserted into table $this->products */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0) { + // phpcs:enable global $conf, $mysoc; if (! $qty) $qty = 1; @@ -293,15 +305,16 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the proposal in DB * * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1172,6 +1185,7 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert into DB a proposal object completely defined by its data members (ex, results from copy). * @@ -1179,9 +1193,9 @@ class Propal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { + // phpcs:enable // i love this function because $this->products is not used in create function... $this->products=$this->lines; @@ -1564,15 +1578,16 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { + // phpcs:enable $this->lines=array(); $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; @@ -1803,6 +1818,7 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define proposal date * @@ -1811,9 +1827,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { + // phpcs:enable if (empty($date)) { $this->error='ErrorBadParameter'; @@ -1871,6 +1887,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define end validity date * @@ -1879,9 +1896,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_echeance($user, $date_fin_validite, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer)) { $error=0; @@ -1932,6 +1949,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1940,9 +1958,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer)) { $error=0; @@ -1993,6 +2011,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery * @@ -2001,9 +2020,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_availability($user, $id, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) { $error=0; @@ -2063,6 +2082,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set source of demand * @@ -2071,9 +2091,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_demand_reason($user, $id, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) { $error=0; @@ -2135,6 +2155,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer reference number * @@ -2143,9 +2164,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer)) { $error=0; @@ -2199,6 +2220,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -2207,9 +2229,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->propal->creer)) @@ -2265,6 +2287,7 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -2273,9 +2296,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->propal->creer)) @@ -2550,6 +2573,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2557,9 +2581,9 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $notrigger=0) { + // phpcs:enable $error=0; $this->db->begin(); @@ -2608,6 +2632,7 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of proposal (eventually filtered on user) into an array * @@ -2621,9 +2646,9 @@ class Propal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') { + // phpcs:enable global $user; $ga = array(); @@ -2695,15 +2720,16 @@ class Propal extends CommonObject return $this->InvoiceArrayList($this->id); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array with id and ref of related invoices * * @param int $id Id propal * @return array Array of invoices id */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function InvoiceArrayList($id) { + // phpcs:enable $ga = array(); $linkedInvoices = array(); @@ -2974,6 +3000,7 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Change source demand * @@ -2982,9 +3009,9 @@ class Propal extends CommonObject * @return int >0 si ok, <0 si ko * @deprecated use set_demand_reason */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { + // phpcs:enable global $user; if ($this->statut >= self::STATUS_DRAFT) @@ -3115,6 +3142,7 @@ class Propal extends CommonObject return $this->LibStatut($this->statut, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status (draft, validated, ...) * @@ -3122,9 +3150,9 @@ class Propal extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { + // phpcs:enable global $conf; // Init/load array of translation of status @@ -3158,9 +3186,10 @@ class Propal extends CommonObject if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); - } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -3168,9 +3197,9 @@ class Propal extends CommonObject * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3336,14 +3365,15 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -4223,15 +4253,16 @@ class PropaleLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update DB line fields total_xxx * Used by migration * - * @return int <0 if ko, >0 if ok + * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 41bfcb82bca..0dd266ef186 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -679,7 +680,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error++; } - if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && (! ($price_ht_devise >= 0) || $price_ht_devise == '')) // Unit price can be 0 but not '' + if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for order. { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; @@ -1579,7 +1580,7 @@ if ($action == 'create' && $user->rights->commande->creer) } // Date print ''; // Delivery date planed @@ -1589,7 +1590,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE_DELIVERY)?-1:''; } - $form->select_date($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); + print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); print ""; // Conditions de reglement @@ -2086,7 +2087,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; - $form->select_date($object->date, 'order_', '', '', '', "setdate"); + print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); print ''; print ''; } else { @@ -2111,7 +2112,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; - $form->select_date($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); + print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); print ''; print ''; } else { @@ -2388,7 +2389,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Total HT $alert = ''; - if($object->total_ht < $object->thirdparty->order_min_amount) { + if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) { $alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); } print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4c2cd368aac..65459d37895 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -52,15 +52,29 @@ class Commande extends CommonOrder */ public $table_element='commande'; + /** + * @var int Name of subtable line + */ public $table_element_line = 'commandedet'; + public $class_element_line = 'OrderLine'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element = 'fk_commande'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'order'; + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -87,6 +101,7 @@ class Commande extends CommonOrder * @var int */ public $statut; + /** * Billed * @var int @@ -109,21 +124,25 @@ class Commande extends CommonOrder * @var int */ public $mode_reglement_id; + /** * Payment mode code * @var string */ public $mode_reglement_code; + /** * Availability delivery time id * @var int */ public $availability_id; + /** * Availability delivery time code * @var string */ public $availability_code; + /** * Label of availability delivery time. Use it in case translation cannot be found. * @var string @@ -133,11 +152,13 @@ class Commande extends CommonOrder public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) public $demand_reason_code; public $date; // Date commande + /** * @deprecated * @see date */ public $date_commande; + public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) public $fk_remise_except; public $remise_percent; @@ -429,6 +450,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -436,9 +458,9 @@ class Commande extends CommonOrder * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $idwarehouse=-1) { + //phpcs:enable global $conf,$langs; $error=0; @@ -511,6 +533,7 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag the order as validated (opened) * Function used when order is reopend after being closed. @@ -518,9 +541,9 @@ class Commande extends CommonOrder * @param User $user Object user that change status * @return int <0 if KO, 0 if nothing is done, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_reopen($user) { + // phpcs:enable $error=0; if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED) @@ -1476,6 +1499,7 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add line into array * $this->client must be loaded @@ -1490,9 +1514,9 @@ class Commande extends CommonOrder * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') { + // phpcs:enable global $conf, $mysoc; if (! $qty) $qty = 1; @@ -1715,15 +1739,16 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the order in DB * * @param int $idremise Id de la remise fixe * @return int >0 si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1793,15 +1818,16 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { + // phpcs:enable $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,'; @@ -2019,6 +2045,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns a array with expeditions lines number * @@ -2026,9 +2053,9 @@ class Commande extends CommonOrder * * TODO deprecate, move to Shipping class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_expedition() { + // phpcs:enable $sql = 'SELECT count(*)'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; $sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; @@ -2045,6 +2072,7 @@ class Commande extends CommonOrder else dol_print_error($this->db); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a array with the pending stock by product * @@ -2053,9 +2081,9 @@ class Commande extends CommonOrder * * TODO FONCTION NON FINIE A FINIR */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function stock_array($filtre_statut=self::STATUS_CANCELED) { + // phpcs:enable $this->stocks = array(); // Tableau des id de produit de la commande @@ -2162,6 +2190,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Applique une remise relative * @@ -2170,9 +2199,9 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if ($user->rights->commande->creer) @@ -2229,6 +2258,7 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Applique une remise absolue * @@ -2237,9 +2267,9 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if ($user->rights->commande->creer) @@ -2296,6 +2326,7 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the order date * @@ -2304,9 +2335,9 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { + // phpcs:enable if ($user->rights->commande->creer) { $error=0; @@ -2361,6 +2392,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the planned delivery date * @@ -2369,9 +2401,9 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { + // phpcs:enable if ($user->rights->commande->creer) { $error=0; @@ -2426,6 +2458,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of orders (eventuelly filtered on a user) into an array * @@ -2439,9 +2472,9 @@ class Commande extends CommonOrder * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') { + // phpcs:enable global $user; $ga = array(); @@ -2570,6 +2603,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update order demand_reason * @@ -2577,9 +2611,9 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if ok, <0 if ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { + // phpcs:enable global $user; dol_syslog('Commande::demand_reason('.$demand_reason_id.')'); @@ -2641,6 +2675,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -2649,9 +2684,9 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { + // phpcs:enable if ($user->rights->commande->creer) { $error=0; @@ -3254,15 +3289,16 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3340,6 +3376,7 @@ class Commande extends CommonOrder return $this->LibStatut($this->statut, $this->billed, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of status * @@ -3349,9 +3386,9 @@ class Commande extends CommonOrder * @param int $donotshowbilled Do not show billed status after order status * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$billed,$mode,$donotshowbilled=0) { + // phpcs:enable global $langs, $conf; $billedtext = ''; @@ -3456,60 +3493,60 @@ class Commande extends CommonOrder if (!$user->rights->commande->lire) $option = 'nolink'; - if ($option !== 'nolink') + 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'; + } + + if ($short) return $url; + + $label = ''; + + if ($user->rights->commande->lire) { + $label = ''.$langs->trans("ShowOrder").''; + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + } + + $linkclose=''; + if (empty($notooltip) && $user->rights->commande->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - // 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'; + $label=$langs->trans("ShowOrder"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } - if ($short) return $url; + $linkstart = ''; + $linkend=''; - $label = ''; + if ($option === 'nolink') { + $linkstart = ''; + $linkend = ''; + } - if ($user->rights->commande->lire) { - $label = ''.$langs->trans("ShowOrder").''; - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - } + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - $linkclose=''; - if (empty($notooltip) && $user->rights->commande->lire) - { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowOrder"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; - } - - $linkstart = ''; - $linkend=''; - - if ($option === 'nolink') { - $linkstart = ''; - $linkend = ''; - } - - $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; - $result .= $linkend; - - return $result; + return $result; } @@ -3660,14 +3697,15 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -3832,7 +3870,7 @@ class OrderLine extends CommonOrderLine var $fk_facture; /** - * @var string proper name for given parameter + * @var string Order lines label */ public $label; @@ -4296,14 +4334,16 @@ class OrderLine extends CommonOrderLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Update totals of order into database + * Update DB line fields total_xxx + * Used by migration * - * @return int <0 if ko, >0 if ok + * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Clean parameters diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2ed616c90a0..558d8186a86 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1,15 +1,15 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Frederic France - * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Ferran Marcet +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015-2018 Frédéric France + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -487,7 +487,7 @@ if ($resql) print $langs->trans('DateInvoice'); print ''; print ''; print ''; print ''; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 37768ade393..3335cf93276 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -1,12 +1,13 @@ - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Andreu Bisquerra Gaya - * Copyright (C) 2012 David Rodriguez Martinez - * Copyright (C) 2012-2018 Juanjo Menent - * Copyright (C) 2015 Ferran Marcet +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Andreu Bisquerra Gaya + * Copyright (C) 2012 David Rodriguez Martinez + * Copyright (C) 2012-2018 Juanjo Menent + * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -442,7 +443,7 @@ if ($action == 'create' && !$error) // Date invoice print ''; // Payment term print ''; print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index bba4e2ff001..3bd5997506e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -40,12 +40,15 @@ class Account extends CommonObject * @var string ID to identify managed object */ public $element = 'bank_account'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'bank_account'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'account'; /** @@ -294,6 +297,7 @@ class Account extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a link between bank line record and its source * @@ -304,9 +308,9 @@ class Account extends CommonObject * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_url_line($line_id, $url_id, $url, $label, $type) { + // phpcs:enable $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; $sql.= "fk_bank"; $sql.= ", url_id"; @@ -334,6 +338,7 @@ class Account extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * TODO Move this into AccountLine * Return array with links from llx_bank_url @@ -341,11 +346,11 @@ class Account extends CommonObject * @param int $fk_bank To search using bank transaction id * @param int $url_id To search using link to * @param string $type To search using type - * @return array|-1 Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error + * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_url($fk_bank='', $url_id='', $type='') { + // phpcs:enable $lines = array(); // Check parameters @@ -784,15 +789,16 @@ class Account extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update BBAN (RIB) account fields * * @param User $user Object user making update * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_bban(User $user = null) { + // phpcs:enable global $conf,$langs; // Clean parameters @@ -1071,6 +1077,7 @@ class Account extends CommonObject return $this->LibStatut($this->clos,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of given object status * @@ -1078,9 +1085,9 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { + // phpcs:enable global $langs; $langs->load('banks'); @@ -1109,14 +1116,15 @@ class Account extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi si un compte peut etre supprimer ou non (sans mouvements) * * @return boolean vrai si peut etre supprime, faux sinon */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function can_be_deleted() { + // phpcs:enable $can_be_deleted=false; $sql = "SELECT COUNT(rowid) as nb"; @@ -1177,6 +1185,7 @@ class Account extends CommonObject return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1184,9 +1193,9 @@ class Account extends CommonObject * @param int $filteraccountid To get info for a particular account id * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board(User $user, $filteraccountid = 0) { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -1233,14 +1242,15 @@ class Account extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * @param int $filteraccountid To get info for a particular account id * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board($filteraccountid = 0) { + // phpcs:enable global $user; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -1648,58 +1658,65 @@ class AccountLine extends CommonObject * @var string Error code (or message) */ public $error=''; - - /** + + /** * @var DoliDB Database handler. */ public $db; - + /** * @var string ID to identify managed object */ public $element='bank'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='bank'; - - var $picto = 'generic'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'generic'; /** * @var int ID */ public $id; - - var $ref; - var $datec; - var $dateo; + + /** + * @var string Ref + */ + public $ref; + + public $datec; + public $dateo; /** * Value date */ - var $datev; - var $amount; - - /** - * @var string proper name for given parameter + public $datev; + public $amount; + + /** + * @var string bank transaction lines label */ public $label; - - var $note; - var $fk_user_author; - var $fk_user_rappro; - var $fk_type; - var $rappro; // Is it conciliated - var $num_releve; // If conciliated, what is bank statement - var $num_chq; // Num of cheque - var $bank_chq; // Bank of cheque - var $fk_bordereau; // Id of cheque receipt - var $fk_account; // Id of bank account - var $bank_account_label; // Label of bank account + public $note; + public $fk_user_author; + public $fk_user_rappro; + public $fk_type; + public $rappro; // Is it conciliated + public $num_releve; // If conciliated, what is bank statement + public $num_chq; // Num of cheque + public $bank_chq; // Bank of cheque + public $fk_bordereau; // Id of cheque receipt - public $emetteur; + public $fk_account; // Id of bank account + public $bank_account_label; // Label of bank account + + public $emetteur; /** * Constructor @@ -1884,15 +1901,16 @@ class AccountLine extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete bank line records * * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_urls(User $user = null) { + // phpcs:enable $nbko=0; if ($this->rappro) @@ -1955,6 +1973,7 @@ class AccountLine extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update conciliation field * @@ -1962,9 +1981,9 @@ class AccountLine extends CommonObject * @param int $cat Category id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_conciliation(User $user, $cat) { + // phpcs:enable global $conf,$langs; $this->db->begin(); @@ -2018,6 +2037,7 @@ class AccountLine extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase/decrease value date of a rowid * @@ -2025,9 +2045,9 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_change($rowid,$sign=1) { + // phpcs:enable $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; $resql = $this->db->query($sql); if ($resql) @@ -2057,31 +2077,34 @@ class AccountLine extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase value date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_next($id) { + // phpcs:enable return $this->datev_change($id,1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Decrease value date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_previous($id) { + // phpcs:enable return $this->datev_change($id,-1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase/decrease operation date of a rowid * @@ -2089,9 +2112,9 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_change($rowid,$sign=1) { + // phpcs:enable $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; $resql = $this->db->query($sql); if ($resql) @@ -2121,27 +2144,29 @@ class AccountLine extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase operation date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_next($id) { + // phpcs:enable return $this->dateo_change($id,1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Decrease operation date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_previous($id) { + // phpcs:enable return $this->dateo_change($id,-1); } @@ -2248,6 +2273,7 @@ class AccountLine extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2255,9 +2281,9 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; //$langs->load('companies'); /* diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 9aefcd5d863..cc291c6be64 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -30,12 +30,18 @@ class BankCateg // extends CommonObject { //public $element='bank_categ'; //!< Id that identify managed objects //public $table_element='bank_categ'; //!< Name of table without prefix where object is stored - public $picto='generic'; - - public $id; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='generic'; /** - * @var string proper name for given parameter + * @var int ID + */ + public $id; + + /** + * @var string bank categories label */ public $label; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 74df6c24ad6..25a5b06df98 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -34,38 +34,45 @@ class PaymentVarious extends CommonObject * @var string ID to identify managed object */ public $element='variouspayment'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='payment_various'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'bill'; /** * @var int ID */ public $id; - - var $ref; - var $tms; - var $datep; - var $datev; - var $sens; - var $amount; - var $type_payment; - var $num_payment; - + /** - * @var string proper name for given parameter + * @var string Ref + */ + public $ref; + + public $tms; + public $datep; + public $datev; + public $sens; + public $amount; + public $type_payment; + public $num_payment; + + /** + * @var string various payments label */ public $label; - - var $accountancy_code; - var $fk_project; - var $fk_bank; - var $fk_user_author; - var $fk_user_modif; + + public $accountancy_code; + public $fk_project; + public $fk_bank; + public $fk_user_author; + public $fk_user_modif; /** @@ -78,14 +85,13 @@ class PaymentVarious extends CommonObject $this->db = $db; $this->element = 'payment_various'; $this->table_element = 'payment_various'; - return 1; } /** * Update database * * @param User $user User that modify - * @param int $notrigger 0=no, 1=yes (no update trigger) + * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ function update($user=null, $notrigger=0) @@ -380,13 +386,14 @@ class PaymentVarious extends CommonObject // Insert payment into llx_bank // Add link 'payment_various' in bank_url between payment and bank transaction - if ($this->sens == '0') $sign='-'; + $sign=1; + if ($this->sens == '0') $sign=-1; $bank_line_id = $acc->addline( $this->datep, $this->type_payment, $this->label, - $sign.abs($this->amount), + $sign * abs($this->amount), $this->num_payment, '', $user @@ -451,15 +458,16 @@ class PaymentVarious extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment various and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -486,6 +494,7 @@ class PaymentVarious extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -493,38 +502,38 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); @@ -536,11 +545,13 @@ class PaymentVarious extends CommonObject /** * Send name clicable (with possibly the picto) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option link option - * @return string Chaine with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param string $option link option + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $notooltip 1=Disable tooltip + * @return string String with URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0) { global $langs; @@ -551,8 +562,8 @@ class PaymentVarious extends CommonObject $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.= ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref); + if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : ''); $result .= $linkend; return $result; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index e75250a830c..85cd839fd44 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -7,6 +7,7 @@ * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -497,7 +498,7 @@ if ($result) if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print '\n"; print "\n"; print ''; print ''; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 9c30dfe3cd8..33757c67c6a 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -220,7 +221,7 @@ if (empty($reshook)) llxHeader("",$langs->trans("VariousPayment")); $form = new Form($db); -if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); +if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); if ($id) @@ -255,13 +256,13 @@ if ($action == 'create') // Date payment print ''; // Date value for bank print ''; // Label diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 6e4060bbeb1..7e3f921b67f 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -1,6 +1,7 @@ - * Copyright (C) 2017 Laurent Destailleur +/* Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -189,7 +190,7 @@ if ($result) // Date print ''; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 50e5285cb14..e367054fc40 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -455,7 +455,7 @@ while($j<$numlt) // Payment Salary -if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) +if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { if (! $mode || $mode != 'sconly') { diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 1e8fa358929..861ee6e897f 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -3,7 +3,8 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +21,8 @@ */ /** - * \file htdocs/compta/deplacement/card.php - * \brief Page to show a trip card + * \file htdocs/compta/deplacement/card.php + * \brief Page to show a trip card */ require '../../main.inc.php'; @@ -263,7 +264,7 @@ if ($action == 'create') print ""; print ''; // Km @@ -360,7 +361,7 @@ else if ($id) // Date print ''; // Km diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index c78ca6707eb..403988052bd 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -35,27 +35,40 @@ class Deplacement extends CommonObject * @var string ID to identify managed object */ public $element='deplacement'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='deplacement'; - + + /** + * @var int Name of subtable line + */ public $table_element_line = ''; + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element = ''; + public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $datec; // Creation date - var $dated; - var $fk_user_author; - var $fk_user; - var $km; - var $socid; - var $statut; // 0=draft, 1=validated - var $extraparams=array(); + public $datec; // Creation date + public $dated; + public $fk_user_author; - var $statuts=array(); - var $statuts_short=array(); + /** + * @var int User ID + */ + public $fk_user; + + public $km; + public $socid; + public $statut; // 0=draft, 1=validated + public $extraparams=array(); + + public $statuts=array(); + public $statuts_short=array(); /** * Constructor @@ -300,6 +313,7 @@ class Deplacement extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -307,38 +321,38 @@ class Deplacement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e191ffd3983..a40ad636976 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1,19 +1,20 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2012-2013 Christophe Battarel - * Copyright (C) 2012-2013 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2013 Jean-Francois FERRY - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2014-2018 Ferran Marcet - * Copyright (C) 2015-2016 Marcos García +/* Copyright (C) 2002-2006 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012-2013 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Jean-Francois FERRY + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014-2018 Ferran Marcet + * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -513,7 +514,7 @@ if (empty($reshook)) if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == - 1) { - $error ++; + $error++; setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $action = ''; } @@ -573,7 +574,7 @@ if (empty($reshook)) if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == - 1) { - $error ++; + $error++; setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $action = ''; } @@ -832,7 +833,7 @@ if (empty($reshook)) } if (! ($_POST['fac_replacement'] > 0)) { - $error ++; + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors'); } @@ -878,14 +879,14 @@ if (empty($reshook)) $sourceinvoice = GETPOST('fac_avoir'); if (! ($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) { - $error ++; + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors'); } $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($dateinvoice)) { - $error ++; + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); } @@ -1109,7 +1110,7 @@ if (empty($reshook)) { if (GETPOST('socid', 'int') < 1) { - $error ++; + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); } @@ -1279,7 +1280,7 @@ if (empty($reshook)) } } else { setEventMessages($srcobject->error, $srcobject->errors, 'errors'); - $error ++; + $error++; } } @@ -1373,7 +1374,7 @@ if (empty($reshook)) $result = $object->insert_discount($discountid); // This include link_to_invoice } else { setEventMessages($discount->error, $discount->errors, 'errors'); - $error ++; + $error++; break; } } else { @@ -1429,7 +1430,7 @@ if (empty($reshook)) $lineid = $result; } else { $lineid = 0; - $error ++; + $error++; break; } @@ -1441,7 +1442,7 @@ if (empty($reshook)) } } else { setEventMessages($srcobject->error, $srcobject->errors, 'errors'); - $error ++; + $error++; } } @@ -1665,37 +1666,46 @@ if (empty($reshook)) if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); - $error ++; + $error++; } if (!$prod_entry_mode) { if (GETPOST('type') < 0 && ! GETPOST('search_idprod')) { setEventMessages($langs->trans('ErrorChooseBetweenFreeEntryOrPredefinedProduct'), null, 'errors'); - $error ++; + $error++; } } if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); - $error ++; + $error++; } if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); - $error ++; + if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + $error++; + } + else + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + $error++; + } } if ($qty == '') { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); - $error ++; + $error++; } if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); - $error ++; + $error++; } if ($qty < 0) { $langs->load("errors"); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); - $error ++; + $error++; } if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { @@ -1709,7 +1719,7 @@ if (empty($reshook)) else { setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); - $error ++; + $error++; } } } @@ -2115,7 +2125,7 @@ if (empty($reshook)) // Check price is not lower than minimum (check is done only for standard or replacement invoices) if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); - $error ++; + $error++; } } else { $type = GETPOST('type'); @@ -2124,14 +2134,29 @@ if (empty($reshook)) // Check parameters if (GETPOST('type') < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $error ++; + $error++; } } if ($qty < 0) { $langs->load("errors"); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); - $error ++; + $error++; } + if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') // Unit price can be 0 but not '' + { + if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + $error++; + } + else + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + $error++; + } + } + // Update line if (! $error) { @@ -3048,7 +3073,7 @@ if ($action == 'create') // Date invoice print ''; // Date point of tax @@ -3056,7 +3081,7 @@ if ($action == 'create') { print ''; } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4687a841807..1c97b82d926 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -43,40 +43,51 @@ class FactureRec extends CommonInvoice * @var string ID to identify managed object */ public $element='facturerec'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture_rec'; - + + /** + * @var int Name of subtable line + */ public $table_element_line='facturedet_rec'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_facture'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='bill'; - var $entity; - var $number; - var $date; - var $amount; - var $remise; - var $tva; - var $total; - var $db_table; - var $propalid; + public $entity; + public $number; + public $date; + public $amount; + public $remise; + public $tva; + public $total; + public $db_table; + public $propalid; - var $date_last_gen; - var $date_when; - var $nb_gen_done; - var $nb_gen_max; + public $date_last_gen; + public $date_when; + public $nb_gen_done; + public $nb_gen_max; - var $frequency; - var $unit_frequency; + public $frequency; + public $unit_frequency; - var $rang; - var $special_code; + public $rang; + public $special_code; - var $usenewprice=0; + public $usenewprice=0; - var $suspended; // status + public $suspended; // status const STATUS_NOTSUSPENDED = 0; const STATUS_SUSPENDED = 1; @@ -440,14 +451,15 @@ class FactureRec extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recupere les lignes de factures predefinies dans this->lines * * @return int 1 if OK, < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); // Retreive all extrafield for line @@ -992,8 +1004,8 @@ class FactureRec extends CommonInvoice $error=0; - $langs->load("bills"); - $langs->load('main'); + // Load translation files required by the page + $langs->loadLangs(array("main","bills")); $nb_create=0; @@ -1182,6 +1194,7 @@ class FactureRec extends CommonInvoice return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1192,9 +1205,9 @@ class FactureRec extends CommonInvoice * @param int $type Type invoice * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) { + // phpcs:enable global $langs; $langs->load('bills'); @@ -1213,7 +1226,7 @@ class FactureRec extends CommonInvoice else return $langs->trans("Draft"); } } - if ($mode == 1) + elseif ($mode == 1) { $prefix='Short'; if ($recur) @@ -1227,7 +1240,7 @@ class FactureRec extends CommonInvoice else return $langs->trans("Draft"); } } - if ($mode == 2) + elseif ($mode == 2) { if ($recur) { @@ -1240,7 +1253,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 3) + elseif ($mode == 3) { if ($recur) { @@ -1254,7 +1267,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0'); } } - if ($mode == 4) + elseif ($mode == 4) { $prefix=''; if ($recur) @@ -1268,7 +1281,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 5 || $mode == 6) + elseif ($mode == 5 || $mode == 6) { $prefix=''; if ($mode == 5) $prefix='Short'; @@ -1653,7 +1666,7 @@ class FactureLigneRec extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedetrec'; - + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index da0d66b2784..0773e6eedc1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -57,20 +57,33 @@ class Facture extends CommonInvoice * @var string ID to identify managed object */ public $element='facture'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture'; - + + /** + * @var int Name of subtable line + */ public $table_element_line = 'facturedet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element = 'fk_facture'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='bill'; + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -120,14 +133,17 @@ class Facture extends CommonInvoice public $cond_reglement_code; // Code in llx_c_paiement public $mode_reglement_code; // Code in llx_c_paiement public $fk_bank; // Field to store bank id to use when payment mode is withdraw + /** * @deprecated */ public $products=array(); + /** * @var FactureLigne[] */ public $lines=array(); + public $line; public $extraparams=array(); public $specimen; @@ -1178,6 +1194,8 @@ class Facture extends CommonInvoice if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; } + if ($short) return $url; + $picto='bill'; if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note @@ -1194,9 +1212,9 @@ class Facture extends CommonInvoice $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_tva)) $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_localtax1)) - $label.= '
' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_localtax2)) + if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000' + $label.= '
eee' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_localtax2) && $this->total_localtax2 != 0) $label.= '
' . $langs->trans('LT2') . ': ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); @@ -1406,14 +1424,15 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all detailed lines into this->lines * * @return int 1 if OK, < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; @@ -1666,15 +1685,16 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) * * @param int $idremise Id of absolute discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1767,6 +1787,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -1774,9 +1795,9 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($ref_client, $notrigger=0) { + // phpcs:enable global $user; $error=0; @@ -2001,6 +2022,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 @@ -2010,9 +2032,9 @@ class Facture extends CommonInvoice * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user, $close_code='', $close_note='') { + // phpcs:enable $error=0; if ($this->paye != 1) @@ -2060,6 +2082,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Fonction utilisee quand un paiement prelevement est refuse, @@ -2068,9 +2091,9 @@ class Facture extends CommonInvoice * @param User $user Object user that change status * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { + // phpcs:enable $error=0; $this->db->begin(); @@ -2108,6 +2131,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because @@ -2118,9 +2142,9 @@ class Facture extends CommonInvoice * @param string $close_note Comment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_canceled($user, $close_code='', $close_note='') { + // phpcs:enable dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); @@ -2472,6 +2496,7 @@ class Facture extends CommonInvoice return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2479,9 +2504,9 @@ class Facture extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user,$idwarehouse=-1) { + // phpcs:enable global $conf,$langs; $error=0; @@ -3038,6 +3063,7 @@ class Facture extends CommonInvoice else return $situation_percent < $obj->situation_percent; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update invoice line with percentage * @@ -3045,9 +3071,9 @@ class Facture extends CommonInvoice * @param int $percent Percentage * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_percent($line, $percent) { + // phpcs:enable global $mysoc,$user; include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; @@ -3135,6 +3161,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set percent discount * @@ -3143,9 +3170,9 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { + // phpcs:enable // Clean parameters if (empty($remise)) $remise=0; @@ -3200,6 +3227,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set absolute discount * @@ -3208,9 +3236,9 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { + // phpcs:enable if (empty($remise)) $remise=0; if ($user->rights->facture->creer) @@ -3401,6 +3429,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices (eventually filtered on a user) into an array * @@ -3414,9 +3443,9 @@ class Facture extends CommonInvoice * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') { + // phpcs:enable global $conf,$user; $ga = array(); @@ -3476,6 +3505,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices qualified to be replaced by another invoice. * Invoices matching the following rules are returned: @@ -3484,9 +3514,9 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_replacable_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -3525,6 +3555,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices qualified to be corrected by a credit note. * Invoices matching the following rules are returned: @@ -3533,9 +3564,9 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_qualified_avoir_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -3599,6 +3630,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a withdrawal request for a standing order. * Use the remain to pay excluding all existing open direct debit requests. @@ -3607,9 +3639,9 @@ class Facture extends CommonInvoice * @param float $amount Amount we request direct debit for * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demande_prelevement($fuser, $amount=0) { + // phpcs:enable $error=0; @@ -3710,6 +3742,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Supprime une demande de prelevement * @@ -3717,9 +3750,9 @@ class Facture extends CommonInvoice * @param int $did id de la demande a supprimer * @return int <0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demande_prelevement_delete($fuser, $did) { + // phpcs:enable $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; $sql .= ' WHERE rowid = '.$did; $sql .= ' AND traite = 0'; @@ -3736,15 +3769,16 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3771,7 +3805,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); - $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills'; + $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=billing&leftmenu=customers_bills'; $response->img=img_object('',"bill"); $generic_facture = new Facture($this->db); @@ -3982,14 +4016,15 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -4096,25 +4131,27 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Checks if the invoice is the first of a cycle * * @return boolean */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_first() { + // phpcs:enable return ($this->situation_counter == 1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array containing the previous situations as Facture objects * * @return mixed -1 if error, array of previous situations */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_sits() { + // phpcs:enable global $conf; $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; @@ -4187,15 +4224,16 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Checks if the invoice is the last in its cycle * * @return bool Last of the cycle status * */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_last_in_cycle() { + // phpcs:enable global $conf; if (!empty($this->situation_cycle_ref)) { @@ -4262,7 +4300,7 @@ class FactureLigne extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedet'; - + /** * @var string Name of table without prefix where object is stored */ @@ -4825,15 +4863,16 @@ class FactureLigne extends CommonInvoiceLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Mise a jour en base des champs total_xxx de ligne de facture - * TODO What is goal of this method ? + * Update DB line fields total_xxx + * Used by migration * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); dol_syslog(get_class($this)."::update_total", LOG_DEBUG); @@ -4866,6 +4905,7 @@ class FactureLigne extends CommonInvoiceLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns situation_percent of the previous line. * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. @@ -4873,9 +4913,9 @@ class FactureLigne extends CommonInvoiceLine * @param int $invoiceid Invoice id * @return int >= 0 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_progress($invoiceid) { + // phpcs:enable if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { return 0; } else { diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 2bdd288e748..619487e9574 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -32,7 +32,7 @@ class PaymentTerm // extends CommonObject * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -42,24 +42,24 @@ class PaymentTerm // extends CommonObject * @var string[] Error codes (or messages) */ public $errors = array(); - + //public $element='c_payment_term'; //!< Id that identify managed objects //public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored - var $context =array(); + public $context =array(); /** * @var int ID */ public $id; - var $code; - var $sortorder; - var $active; - var $libelle; - var $libelle_facture; - var $type_cdr; - var $nbjour; - var $decalage; + public $code; + public $sortorder; + public $active; + public $libelle; + public $libelle_facture; + public $type_cdr; + public $nbjour; + public $decalage; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 00dd78ca1bd..3fa091e0665 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1,14 +1,14 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016 Meziane Sof - * Copyright (C) 2017 Frédéric France +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016 Meziane Sof + * Copyright (C) 2017-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1113,7 +1113,7 @@ if ($action == 'create') // Date next run print ""; // Number max of generation diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f9d8bd1b250..3fdfbc0c514 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -148,29 +148,29 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( - 'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), - 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0), - 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), - 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), - 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), - 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), - 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), - 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), - 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), - 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), - 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), - 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), - 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), + 'f.facnumber'=>array('label'=>"Ref", 'checked'=>1), + 'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1), + 'f.type'=>array('label'=>"Type", 'checked'=>0), + 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1), + 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)), + 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), + 's.town'=>array('label'=>"Town", 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'checked'=>1), + 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), + 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1), + 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), + 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")), 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1")), - 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), - 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), - 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), - 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), + 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0), + 'rtp'=>array('label'=>"Rest", 'checked'=>0), + 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -422,22 +422,14 @@ if ($filtre) } if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); -if ($search_type != '' && $search_type >= 0) -{ - if ($search_type == '0') $sql.=" AND f.type = 0"; // standard - if ($search_type == '1') $sql.=" AND f.type = 1"; // replacement - if ($search_type == '2') $sql.=" AND f.type = 2"; // credit note - if ($search_type == '3') $sql.=" AND f.type = 3"; // deposit - if ($search_type == '4') $sql.=" AND f.type = 4"; // proforma - if ($search_type == '5') $sql.=" AND f.type = 5"; // situation -} +if ($search_type != '') $sql.=" AND f.type IN (".$db->escape($search_type).")"; if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); @@ -511,8 +503,9 @@ if (! $sall) $sql.= ' typent.code,'; $sql.= ' state.code_departement, state.nom,'; $sql.= ' country.code,'; - $sql.= " p.rowid, p.ref"; - + $sql.= " p.rowid, p.ref, p.title"; + if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; + // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by { $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); @@ -576,14 +569,14 @@ if ($resql) if ($search_zip) $param.='&search_zip='.urlencode($search_zip); if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); - if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category); + if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category); if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_status != '') $param.='&search_status='.urlencode($search_status); - if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); + if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); if ($show_files) $param.='&show_files='.urlencode($show_files); if ($option) $param.="&search_option=".urlencode($option); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -1070,11 +1063,20 @@ if ($resql) if (! empty($arrayfields['typent.code']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } + // Staff + if (! empty($arrayfields['staff.code']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Payment mode if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 6196d08f741..2d43d48d778 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -1,10 +1,11 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011-2014 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2011-2012 Alexandre spangaro - * Copyright (C) 2013 Marcos García +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2011-2012 Alexandre spangaro + * Copyright (C) 2013 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,7 +81,8 @@ $date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false); + $date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); + $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false); } $name=$langs->trans("PurchasesJournal"); @@ -90,7 +92,7 @@ $builddate=dol_now(); $description=$langs->trans("DescPurchasesJournal").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 8a2d5080a30..3b4be22a81d 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -1,12 +1,13 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011-2014 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2011-2012 Alexandre Spangaro - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2013 Marcos García - * Copyright (C) 2014 Raphaël Doursenaud +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2011-2012 Alexandre Spangaro + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2013 Marcos García + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +94,7 @@ $builddate=dol_now(); $description=$langs->trans("DescSellsJournal").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index c58a61032ef..222423b7c67 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -1,6 +1,7 @@ - * Copyright (C) 2015 Marcos García +/* Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,11 +173,11 @@ if ($action == 'create') print "
"; print ''; print ''; // Label @@ -302,4 +303,3 @@ if ($id) // End of page llxFooter(); $db->close(); - diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 18b284f9187..6838f9a65b2 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -39,22 +39,25 @@ class Localtax extends CommonObject */ public $table_element='localtax'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='payment'; - var $ltt; - var $tms; - var $datep; - var $datev; - var $amount; + public $ltt; + public $tms; + public $datep; + public $datev; + public $amount; /** - * @var string proper name for given parameter + * @var string local tax */ public $label; - var $fk_bank; - var $fk_user_creat; - var $fk_user_modif; + public $fk_bank; + public $fk_user_creat; + public $fk_user_modif; /** * Constructor @@ -344,15 +347,16 @@ class Localtax extends CommonObject return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total de la localtax des factures emises par la societe. * * @param int $year Year * @return int ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_collectee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.localtax) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; if ($year) @@ -383,15 +387,16 @@ class Localtax extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * localtax payed * * @param int $year Year * @return int ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_payee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.total_localtax) as total_localtax"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -424,6 +429,7 @@ class Localtax extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * localtax payed * Total de la localtax payed @@ -431,9 +437,9 @@ class Localtax extends CommonObject * @param int $year Year * @return int ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_reglee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f"; @@ -579,15 +585,16 @@ class Localtax extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update the link betwen localtax payment and the line into llx_bank * * @param int $id Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.$id; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -639,6 +646,7 @@ class Localtax extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -646,9 +654,9 @@ class Localtax extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status, $mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage return ''; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index ce76d74b803..8f986697a01 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -1,6 +1,7 @@ - * Copyright (C) 2014 Ferran Marcet +/* Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,7 +118,7 @@ if ($calc==0 || $calc==1) // Calculate on invoice for goods and services { $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec"); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; @@ -134,7 +135,7 @@ if ($calc==2) // Invoice for goods, payment for services { $calcmode=$langs->trans("CalcModeLT2Debt"); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 065c935c600..1e2c26c0c62 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -1,7 +1,8 @@ - * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2018 Laurent Destailleur +/* Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -223,7 +224,7 @@ $calcmode.= '('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/adm //if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='
'.$langs->trans("ThisIsAnEstimatedValue"); -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $builddate=dol_now(); diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 17a54f9e3f3..e49f42bb14f 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier * Copyright (C) 2014-2016 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -132,18 +133,22 @@ if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption'); if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices'); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; // Set period -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); -$prevyear=$year_start; $prevquarter=$q; +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); +$prevyear=$year_start; +$prevquarter=$q; if ($prevquarter > 1) { $prevquarter--; } else { - $prevquarter=4; $prevyear--; + $prevquarter=4; + $prevyear--; } -$nextyear=$year_start; $nextquarter=$q; +$nextyear=$year_start; +$nextquarter=$q; if ($nextquarter < 4) { $nextquarter++; } else { - $nextquarter=1; $nextyear++; + $nextquarter=1; + $nextyear++; } $description.=$fsearch; $builddate=dol_now(); @@ -209,7 +214,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $langs->load("errors"); if ($x_coll == -1) print '
'; - else if ($x_coll == -2) + elseif ($x_coll == -2) print ''; else print ''; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index c2ce95dd827..764ca818f7f 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -1,13 +1,14 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2014 Raphaël Doursenaud - * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> - * Copyright (C) 2015 Juanjo Menent +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -467,7 +468,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; // Payment mode diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 647cdadaf04..1f7b344f62d 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -386,7 +387,7 @@ if ($action == 'new') //print ''; // Filter print ''; print '"; print ''; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index be914f2333d..60e471d712d 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -1,7 +1,8 @@ - * Copyright (C) 2005-2010 Laurent Destailleur - * Copyright (C) 2010-2016 Juanjo Menent +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,15 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories')); +$langs->loadLangs(array('banks', 'categories','bills','withdrawals')); if (!$user->rights->prelevement->bons->lire) accessforbidden(); -$langs->load("bills"); -$langs->load("withdrawals"); - - // Security check if ($user->societe_id > 0) accessforbidden(); @@ -244,7 +241,7 @@ if ($id > 0 || $ref) print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).$form->select_date($date_end,'date_end',0,0,0,'',1,0,1).''.$form->selectDate($date_start,'date_start',0,0,0,'',1,0).$form->selectDate($date_end,'date_end',0,0,0,'',1,0).''; print ''; diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 13b99d92f6d..b1732e0883b 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -25,7 +25,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -$langs->load("install"); +// Load translation files required by the page +$langs->loadLangs(array("companies","install","users","other")); if (! $user->admin) accessforbidden(); @@ -40,10 +41,6 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$langs->load("companies"); -$langs->load("users"); -$langs->load("other"); - $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 41923aa068d..1ec7c98552e 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php'; -$langs->load("admin"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("admin","other")); $action=GETPOST('action','alpha'); @@ -76,7 +76,7 @@ print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; if (function_exists('curl_init')) { $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; - + if ($action == 'getlastversion') { if ($sfurl) @@ -95,7 +95,7 @@ if (function_exists('curl_init')) } $i++; } - + // Show version print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
'; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 32ebc4fb26e..6ddb4dae1b3 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -271,15 +271,16 @@ class DolibarrApi return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to forge a SQL criteria * * @param array $matches Array of found string by regex search * @return string Forged criteria. Example: "t.field like 'abc%'" */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function _forge_criteria_callback($matches) { + // phpcs:enable global $db; //dol_syslog("Convert matches ".$matches[1]); diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 8d8281745fa..e453bd331c2 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -59,15 +59,16 @@ class DolibarrApiAccess implements iAuthenticate */ public static $user = ''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName /** * Check access * * @return bool * @throws RestException */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName public function __isAllowed() { + // phpcs:enable global $conf, $db; $login = ''; @@ -165,15 +166,16 @@ class DolibarrApiAccess implements iAuthenticate return in_array(static::$role, (array) $requirefortest) || static::$role == 'admin'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName /** * @return string string to be used with WWW-Authenticate header * @example Basic * @example Digest * @example OAuth */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName public function __getWWWAuthenticateString() { + // phpcs:enable return ''; } diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 036aa8dc0ba..596b795999d 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -95,18 +95,36 @@ class Asset extends CommonObject 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1,), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Active', '-1'=>'Cancel')), ); + + /** + * @var int ID + */ public $rowid; + + /** + * @var string Ref + */ public $ref; + public $entity; /** - * @var string proper name for given parameter - */ - public $label; + * @var string Asset label + */ + public $label; public $amount; - public $fk_soc; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + + /** + * @var string description + */ public $description; + public $note_public; public $note_private; public $date_creation; @@ -338,6 +356,7 @@ class Asset extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -345,43 +364,37 @@ class Asset extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index e6b95d7ad37..df2f4c1415e 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -33,25 +33,34 @@ class AssetType extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'asset_type'; - + /** * @var string ID to identify managed object */ public $element = 'asset_type'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'group'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** @var string Label */ public $label; + /** @var string Accountancy code asset */ public $accountancy_code_asset; + /** @var string Accountancy code depreciation asset */ public $accountancy_code_depreciation_asset; + /** @var string Accountancy code depreciation expense */ public $accountancy_code_depreciation_expense; + /** @var string Public note */ public $note; + /** @var array Array of asset */ public $asset=array(); @@ -282,14 +291,15 @@ class AssetType extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of asset's type * * @return array List of types of members */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { + // phpcs:enable global $conf,$langs; $assettypes = array(); diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 6dd578993ca..a1f3632fd2f 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -178,19 +178,19 @@ if ($action == 'builddoc') { // List of values to scan for a replacement $substitutionarray = array ( - '%LOGIN%'=>$user->login, - '%COMPANY%'=>$mysoc->name, - '%ADDRESS%'=>$mysoc->address, - '%ZIP%'=>$mysoc->zip, - '%TOWN%'=>$mysoc->town, - '%COUNTRY%'=>$mysoc->country, - '%COUNTRY_CODE%'=>$mysoc->country_code, - '%EMAIL%'=>$mysoc->email, - '%YEAR%'=>$year, - '%MONTH%'=>$month, - '%DAY%'=>$day, - '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, - '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/" + '%LOGIN%' => $user->login, + '%COMPANY%' => $mysoc->name, + '%ADDRESS%' => $mysoc->address, + '%ZIP%' => $mysoc->zip, + '%TOWN%' => $mysoc->town, + '%COUNTRY%' => $mysoc->country, + '%COUNTRY_CODE%' => $mysoc->country_code, + '%EMAIL%' => $mysoc->email, + '%YEAR%' => $year, + '%MONTH%' => $month, + '%DAY%' => $day, + '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT, + '%SERVER%' => "http://".$_SERVER["SERVER_NAME"]."/", ); complete_substitutions_array($substitutionarray, $langs); @@ -416,7 +416,7 @@ print $langs->trans("BarcodeType").'   '; print '
'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); -$formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); +print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print '
'; // Barcode value diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 3fd68b836f3..cd558c020a6 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -1,6 +1,7 @@ - * Copyright (C) 2017-2018 Laurent Destailleur +/* Copyright (C) 2017 ATM Consulting + * Copyright (C) 2017-2018 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -372,10 +373,10 @@ print '
 '; //print $langs->trans("from").': '; -$form->select_date($search_start,'search_start'); +print $form->selectDate($search_start,'search_start'); //print '
'; //print $langs->trans("to").': '; -$form->select_date($search_end,'search_end'); +print $form->selectDate($search_end,'search_end'); print '
'.$langs->trans("DateActionStart").''; - if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend'); - else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend'); - else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); + if (GETPOST("afaire") == 1) { + print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldayend'); + } elseif (GETPOST("afaire") == 2) { + print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } else { + print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); + } print '
'.$langs->trans("DateActionEnd").''; - if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); - else if (GETPOST("afaire") == 2) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); - else $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); + if (GETPOST("afaire") == 1) { + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } elseif (GETPOST("afaire") == 2) { + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } else { + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } print '
'.$langs->trans("DateActionStart").''; - if (GETPOST("afaire") == 1) $form->select_date($datep?$datep:$object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart'); - else if (GETPOST("afaire") == 2) $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); - else $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); + if (GETPOST("afaire") == 1) { + print $form->selectDate($datep?$datep:$object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart'); + } elseif (GETPOST("afaire") == 2) { + print $form->selectDate($datep?$datep:$object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); + } else { + print $form->selectDate($datep?$datep:$object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); + } print '
'.$langs->trans("DateActionEnd").''; - if (GETPOST("afaire") == 1) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); - else if (GETPOST("afaire") == 2) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); - //else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend','ap'); - else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); + if (GETPOST("afaire") == 1) { + print $form->selectDate($datef?$datef:$object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } elseif (GETPOST("afaire") == 2) { + print $form->selectDate($datef?$datef:$object->datef,'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } else { + print $form->selectDate($datef?$datef:$object->datef,'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + } print '
'.$langs->trans("RepeatEvent").''; print ''; - $arrayrecurrulefreq=array( - 'no'=>$langs->trans("No"), - 'MONTHLY'=>$langs->trans("EveryMonth"), - 'WEEKLY'=>$langs->trans("EveryWeek"), - //'DAYLY'=>$langs->trans("EveryDay") - ); + $arrayrecurrulefreq = array( + 'no'=>$langs->trans("No"), + 'MONTHLY'=>$langs->trans("EveryMonth"), + 'WEEKLY'=>$langs->trans("EveryWeek"), + //'DAYLY'=>$langs->trans("EveryDay"), + ); $selectedrecurrulefreq='no'; $selectedrecurrulebymonthday=''; $selectedrecurrulebyday=''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6ad7ce68ba7..7b9caabb8a9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -35,24 +35,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; class ActionComm extends CommonObject { /** - * @var string ID to identify managed object - */ - public $element='action'; - + * @var string ID to identify managed object + */ + public $element='action'; + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'actioncomm'; - + public $table_rowid = 'id'; - public $picto='action'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'action'; + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; - + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user, 2=Same than 1 but accept record if fksoc is empty * @var integer @@ -63,7 +67,7 @@ class ActionComm extends CommonObject * Id of the event * @var int */ - public $id; + public $id; /** * Id of the event. Use $id as possible @@ -78,7 +82,7 @@ class ActionComm extends CommonObject var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) /** - * @var string proper name for given parameter + * @var string Agenda event label */ public $label; @@ -694,14 +698,15 @@ class ActionComm extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize this->userassigned array with list of id of user assigned to event * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_userassigned() { + // phpcs:enable $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; @@ -1017,6 +1022,7 @@ class ActionComm extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1024,10 +1030,10 @@ class ActionComm extends CommonObject * @param int $load_state_board Charge indicateurs this->nb de tableau de bord * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $load_state_board=0) { - global $conf, $langs; + // phpcs:enable + global $conf, $langs; if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp"; else { @@ -1142,6 +1148,7 @@ class ActionComm extends CommonObject return $this->LibStatut($this->percentage,$mode,$hidenastatus,$this->datep); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of action status * @@ -1151,9 +1158,9 @@ class ActionComm extends CommonObject * @param int $datestart Date start of event * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($percent,$mode,$hidenastatus=0,$datestart='') { + // phpcs:enable global $langs; if ($mode == 0) @@ -1351,6 +1358,7 @@ class ActionComm extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Export events from database into a cal file. * @@ -1361,9 +1369,9 @@ class ActionComm extends CommonObject * @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...) * @return int <0 if error, nb of events in new file if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_exportfile($format,$type,$cachedelay,$filename,$filters) { + // phpcs:enable global $conf,$langs,$dolibarr_main_url_root,$mysoc; require_once DOL_DOCUMENT_ROOT ."/core/lib/xcal.lib.php"; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index f797269a2e4..63773661cbd 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -34,17 +34,17 @@ class ActionCommReminder extends CommonObject * @var string ID to identify managed object */ public $element = 'actioncomm_reminder'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'actioncomm_reminder'; - + /** * @var array Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var string String with name of icon for actioncommreminder. Must be the part after the 'object_' into object_actioncommreminder.png */ @@ -84,7 +84,12 @@ class ActionCommReminder extends CommonObject public $rowid; public $dateremind; public $typeremind; + + /** + * @var int User ID + */ public $fk_user; + public $offsetvalue; public $offsetunit; public $status; @@ -168,6 +173,7 @@ class ActionCommReminder extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -175,9 +181,9 @@ class ActionCommReminder extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0 || $mode == 1) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index dedc515f61c..677e477cd89 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -219,7 +219,7 @@ class AgendaEvents extends DolibarrApi /** - * Update Agenda Event general fields (won't touch lines of expensereport) + * Update Agenda Event general fields * * @param int $id Id of Agenda Event to update * @param array $request_data Datas @@ -236,20 +236,20 @@ class AgendaEvents extends DolibarrApi throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); } - $result = $this->expensereport->fetch($id); + $result = $this->actioncomm->fetch($id); if ( ! $result ) { - throw new RestException(404, 'expensereport not found'); + throw new RestException(404, 'actioncomm not found'); } - if ( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { if ($field == 'id') continue; - $this->expensereport->$field = $value; + $this->actioncomm->$field = $value; } - if ($this->expensereport->update($id, DolibarrApiAccess::$user,1,'','','update')) + if ($this->actioncomm->update($id, DolibarrApiAccess::$user,1,'','','update')) return $this->get($id); return false; diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 2fcd4e63bd7..d6c25f6d4c1 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -24,7 +24,7 @@ /** - * Class to manage different types of events + * Class to manage different types of events */ class CActionComm { @@ -32,7 +32,7 @@ class CActionComm * @var string Error code (or message) */ public $error=''; - + /** * @var DoliDB Database handler. */ @@ -43,20 +43,24 @@ class CActionComm */ public $id; - var $code; - var $type; - var $libelle; // deprecated - + public $code; + public $type; + public $libelle; // deprecated + /** - * @var string proper name for given parameter + * @var string Type of agenda event label */ public $label; - - var $active; - var $color; - var $picto; - var $type_actions=array(); + public $active; + public $color; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto; + + public $type_actions=array(); /** @@ -114,6 +118,7 @@ class CActionComm } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of event types: array(id=>label) or array(code=>label) * @@ -125,9 +130,9 @@ class CActionComm * @param int $shortlabel 1=Get short label instead of long label * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='', $shortlabel=0) { + // phpcs:enable global $langs,$conf; $langs->load("commercial"); diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 4d8675bc8ee..d3c2070d321 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php'; /** - * Class to read/parse ICal calendars + * Class to read/parse ICal calendars */ class ICal { @@ -39,22 +39,23 @@ class ICal var $last_key; //Help variable save last key (multiline string) - /** - * Constructor - */ - public function __construct() - { - } + /** + * Constructor + */ + public function __construct() + { + } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Read text file, icalender text file * * @param string $file File * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function read_file($file) { + // phpcs:enable $this->file = $file; $file_text=''; @@ -67,25 +68,27 @@ class ICal return $file_text; // return all text } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the number of calendar events * * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_count() { + // phpcs:enable return $this->event_count; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the number of to do * * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_count() { + // phpcs:enable return $this->todo_count; } @@ -197,6 +200,7 @@ class ICal return $this->cal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add to $this->ical array one value and key. * @@ -205,9 +209,9 @@ class ICal * @param string $value Value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_array($type, $key, $value) { + // phpcs:enable //print 'type='.$type.' key='.$key.' value='.$value.'
'."\n"; @@ -258,16 +262,17 @@ class ICal $this->last_key = $key; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * * @param string $text Text * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function retun_key_value($text) { - /* + // phpcs:enable + /* preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches); if (empty($matches)) @@ -279,19 +284,20 @@ class ICal $matches = array_splice($matches, 1, 2); return $matches; }*/ - return explode(':',$text,2); + return explode(':',$text,2); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Parse RRULE return array * * @param string $value string * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_rrule($value) { - $result=array(); + // phpcs:enable + $result = array(); $rrule = explode(';',$value); foreach ($rrule as $line) { @@ -300,15 +306,17 @@ class ICal } return $result; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS) * * @param string $ical_date String date * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_date_to_unix($ical_date) { + // phpcs:enable $ical_date = str_replace('T', '', $ical_date); $ical_date = str_replace('Z', '', $ical_date); @@ -322,6 +330,7 @@ class ICal return $ntime; // ntime is a GTM time } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return unix date from iCal date format * @@ -329,10 +338,10 @@ class ICal * @param string $value Value * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dt_date($key, $value) { - $return_value=array(); + // phpcs:enable + $return_value = array(); $value = $this->ical_date_to_unix($value); // Analyse TZID @@ -352,14 +361,15 @@ class ICal return array($key,$return_value); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return sorted eventlist as array or false if calenar is empty * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sort_event_list() { + // phpcs:enable $temp = $this->get_event_list(); if (!empty($temp)) { @@ -372,6 +382,7 @@ class ICal } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Compare two unix timestamp * @@ -379,64 +390,69 @@ class ICal * @param array $b Operand b * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dtstart_compare($a, $b) { + // phpcs:enable return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_list() { + // phpcs:enable return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:''); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_freebusy_list() { + // phpcs:enable return $this->cal['VFREEBUSY']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return to do array (not sort to do array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_list() { + // phpcs:enable return $this->cal['VTODO']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return base calendar data * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_calender_data() { + // phpcs:enable return $this->cal['VCALENDAR']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array with all data * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_data() { + // phpcs:enable return $this->cal; } } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 178e4bfb6d7..7e27c0d924c 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -101,11 +101,15 @@ else if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); -if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); -if ($action == 'default') + +$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); +$defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW); +if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=$defaultview; +if ($action == 'default') // When action is default, we want a calendar view and not the list { - $action = ((! empty($conf->global->AGENDA_DEFAULT_VIEW) && $conf->global->AGENDA_DEFAULT_VIEW!='show_list') ? $conf->global->AGENDA_DEFAULT_VIEW : 'show_month'); + $action = (($defaultview != 'show_list') ? $defaultview : 'show_month'); } + if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; } // View by month diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 319499d65fd..5628e65c6d9 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2017 Open-DSI + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -189,9 +190,9 @@ $form=new Form($db); $userstatic=new User($db); $formactions=new FormActions($db); -$nav=''; -$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); -$nav.=' '; +$nav = ''; +$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); +$nav .=' '; $now=dol_now(); @@ -438,15 +439,17 @@ if ($resql) if (! empty($arrayfields['a.label']['checked'])) print '
'; - print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); + print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0); print ''; - print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1); + print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0); print '
'; - print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer); - print ''; - print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : '')); - - print '
'; + print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer); + print ''; + print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : '')); + print '
' . $langs->trans('Date') . ''; - $form->select_date('', '', '', '', '', "addprop", 1, 1); + print $form->selectDate('', '', '', '', '', "addprop", 1, 1); print '
' . $langs->trans('Date') . ''; - $form->select_date('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date + print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date print '
' . $langs->trans('AmountHT') . ''; - print $form->select_date('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', '', '', '', '', 1, 1); print '
'.$langs->trans('Date').''; - $html->select_date('','','','','',"add",1,1); + print $html->selectDate('', '', '', '', '', "add", 1, 1); print '
'.$langs->trans('PaymentConditionsShort').''; @@ -596,8 +597,8 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) $num = $db->num_rows($resql); print load_fiche_titre($title); $i = 0; - $period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1); - $periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1); + $period=$html->selectDate($date_start,'date_start',0,0,1,'',1,0).' - '.$html->selectDate($date_end,'date_end',0,0,1,'',1,0); + $periodely=$html->selectDate($date_starty,'date_start_dely',0,0,1,'',1,0).' - '.$html->selectDate($date_endy,'date_end_dely',0,0,1,'',1,0); if (! empty($socid)) { @@ -654,7 +655,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; print '
'; - + $generic_commande = new Commande($db); while ($i < $num) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index ff5a3b2fffd..311335fd96b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -666,7 +667,7 @@ if ($resql) } print '
'; - $form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction'); + print $form->selectDate(empty($dateop)?-1:$dateop, 'op', 0, 0, 0, 'transaction'); print ' '; @@ -787,17 +788,17 @@ if ($resql) $moreforfilter.='
'; $moreforfilter .= $langs->trans('DateOperationShort').' : '; $moreforfilter .= '
'.$langs->trans('From') . ' '; - $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0).'
'; //$moreforfilter .= ' - '; - $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0).'
'; $moreforfilter .= ''; $moreforfilter.='
'; $moreforfilter .= $langs->trans('DateValueShort').' : '; $moreforfilter .= '
'.$langs->trans('From') . ' '; - $moreforfilter .= $form->select_date($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0).'
'; //$moreforfilter .= ' - '; - $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0).'
'; $moreforfilter .= ''; if (! empty($conf->categorie->enabled)) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 461d193d1fe..b58619b66a2 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -6,6 +6,7 @@ * Copyright (C) 2014-2017 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -284,7 +285,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights-> $form = new Form($db); $formbank = new FormBank($db); $formcompany = new FormCompany($db); -if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); +if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; @@ -431,7 +432,7 @@ if ($action == 'create') print '
'.$langs->trans("Date").''; - $form->select_date('', 're', 0, 0, 0, 'formsoc'); + print $form->selectDate('', 're', 0, 0, 0, 'formsoc'); print '
'.$langs->trans("BalanceMinimalAllowed").''; - print $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro); + print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro); if (! $objp->rappro) { print '   '; @@ -521,7 +522,7 @@ if ($result) if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; - print $form->select_date($db->jdate($objp->dv),'datev','','','','update',1,0,1,$objp->rappro); + print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro); if (! $objp->rappro) { print '   '; diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 7ad8bc2ad96..38109b964b4 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -253,7 +254,7 @@ $form->select_comptes($account_to, 'account_to', 0, '', 1, '', empty($conf->mult print ""; -$form->select_date((! empty($dateo)?$dateo:''),'','','','','add'); +print $form->selectDate((! empty($dateo)?$dateo:''), '', '', '', '', 'add'); print "
'; print fieldLabel('DatePayment','datep',1).''; - print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); + print $form->selectDate((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print '
'; print fieldLabel('DateValue','datev',0).''; - print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); + print $form->selectDate((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print '
'; print '
'; - print $form->select_date($search_date, 'date_doc', 0, 0, 1); + print $form->selectDate($search_date, 'date_doc', 0, 0, 1); print '
'; print '
'.$langs->trans("Date").''; - print $form->select_date($datec?$datec:-1,'','','','','add',1,1,1); + print $form->selectDate($datec?$datec:-1, '', '', '', '', 'add', 1, 1); print '
'.$langs->trans("Date").''; - print $form->select_date($object->date,'',0,0,0,'update',1,0,1); + print $form->selectDate($object->date, '', 0, 0, 0, 'update', 1, 0); print '
' . $langs->trans('DateInvoice') . ''; - print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1); + print $form->selectDate($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1); print '
' . $langs->trans('DatePointOfTax') . ''; $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1); + print $form->selectDate($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1); print '
".$langs->trans('NextDateToExecution').""; $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); - print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1); + print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1); print "
'; - if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + if (! is_array($staffArray) || count($staffArray)==0) $staffArray = $formcompany->effectif_array(1); + print $staffArray[$obj->staff_code]; + print '
'.$langs->trans("DatePayment").''; - print $form->select_date($datep,"datep",'','','','add',1,1); + print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1); print '
'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->select_date($datev,"datev",'','','','add',1,1); + print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); print '
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'.$langs->trans('Date').''; $datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment); - $form->select_date($datepayment,'','','',0,"add_paiement",1,1,0,0,'','',$facture->date); + print $form->selectDate($datepayment, '', '', '', 0, "add_paiement", 1, 1, 0, '', '', $facture->date); print '
'.$langs->trans('Date').''.dol_print_date($now,'day').'
'.$langs->trans("DateChequeReceived").''; - print $form->select_date($filterdate,'fd',0,0,1,'',1,1,1); + print $form->selectDate($filterdate, 'fd', 0, 0, 1, '', 1, 1); print '
'.$langs->trans("BankAccount").''; $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); @@ -586,7 +587,7 @@ else print ''; print ''; print ''; - $form->select_date($object->date_bordereau,'datecreate_','','','',"setdate"); + print $form->selectDate($object->date_bordereau, 'datecreate_', '', '', '', "setdate"); print ''; print ''; } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index e858f599cc8..ade6895ac41 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -37,18 +37,21 @@ class RemiseCheque extends CommonObject * @var string ID to identify managed object */ public $element='chequereceipt'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='bordereau_cheque'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'payment'; - var $num; - var $intitule; + public $num; + public $intitule; //! Numero d'erreur Plage 1024-1279 - var $errno; + public $errno; public $amount; public $date_bordereau; @@ -56,6 +59,10 @@ class RemiseCheque extends CommonObject public $account_label; public $author_id; public $nbcheque; + + /** + * @var string Ref + */ public $ref; /** @@ -488,15 +495,16 @@ class RemiseCheque extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -542,14 +550,15 @@ class RemiseCheque extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -857,14 +866,15 @@ class RemiseCheque extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge les proprietes ref_previous et ref_next * * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_id() { + // phpcs:enable global $conf; $this->errno = 0; @@ -899,6 +909,7 @@ class RemiseCheque extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the creation date * @@ -906,9 +917,9 @@ class RemiseCheque extends CommonObject * @param int $date Date creation * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date) { + // phpcs:enable if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; @@ -934,6 +945,7 @@ class RemiseCheque extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the ref of bordereau * @@ -941,9 +953,9 @@ class RemiseCheque extends CommonObject * @param int $ref ref of bordereau * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_number($user, $ref) { + // phpcs:enable if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; @@ -1057,6 +1069,7 @@ class RemiseCheque extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1064,9 +1077,9 @@ class RemiseCheque extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); if ($mode == 0) @@ -1074,32 +1087,32 @@ class RemiseCheque extends CommonObject if ($status == 0) return $langs->trans('ToValidate'); if ($status == 1) return $langs->trans('Validated'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 0) return $langs->trans('ToValidate'); if ($status == 1) return $langs->trans('Validated'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut0').' '.$langs->trans('ToValidate'); if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut0'); if ($status == 1) return img_picto($langs->trans('Validated'),'statut4'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut0').' '.$langs->trans('ToValidate'); if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut0'); if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut0'); if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index c9794d9662e..1f0175bd370 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -135,15 +135,15 @@ class Cpaiement if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + //if (!$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + //} } // Commit or rollback @@ -278,15 +278,15 @@ class Cpaiement dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} // Commit or rollback if ($error) { @@ -316,17 +316,15 @@ class Cpaiement $this->db->begin(); - if (!$error) { - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_DELETE',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 1fd2ad8bbef..952f478087b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -40,40 +40,46 @@ class Paiement extends CommonObject * @var string ID to identify managed object */ public $element='payment'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='paiement'; - - public $picto = 'payment'; - var $facid; - var $datepaye; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'payment'; + + public $facid; + public $datepaye; + /** * @deprecated * @see amount, amounts */ - var $total; + public $total; + /** * @deprecated * @see amount, amounts */ - var $montant; - var $amount; // Total amount of payment - var $amounts=array(); // Array of amounts - var $multicurrency_amounts=array(); // Array of amounts - var $author; - var $paiementid; // Type de paiement. Stocke dans fk_paiement + public $montant; + + public $amount; // Total amount of payment + public $amounts=array(); // Array of amounts + public $multicurrency_amounts=array(); // Array of amounts + public $author; + public $paiementid; // Type de paiement. Stocke dans fk_paiement // de llx_paiement qui est lie aux types de //paiement de llx_c_paiement - var $num_paiement; // Numero du CHQ, VIR, etc... - var $num_payment; // Numero du CHQ, VIR, etc... - var $bank_account; // Id compte bancaire du paiement - var $bank_line; // Id de la ligne d'ecriture bancaire + public $num_paiement; // Numero du CHQ, VIR, etc... + public $num_payment; // Numero du CHQ, VIR, etc... + public $bank_account; // Id compte bancaire du paiement + public $bank_line; // Id de la ligne d'ecriture bancaire // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...) // fk_paiement dans llx_paiement_facture est le rowid du paiement - var $fk_paiement; // Type of paiment + public $fk_paiement; // Type of paiment /** @@ -702,15 +708,16 @@ class Paiement extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour du lien entre le paiement et la ligne generee dans llx_bank * * @param int $id_bank Id compte bancaire * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; @@ -728,15 +735,16 @@ class Paiement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Updates the payment date * * @param int $date New date * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_date($date) { + // phpcs:enable if (!empty($date) && $this->statut!=1) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; @@ -760,15 +768,16 @@ class Paiement extends CommonObject return -1; //no date given or already validated } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Updates the payment number * * @param string $num New num * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_num($num) { + // phpcs:enable if(!empty($num) && $this->statut!=1) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; @@ -1123,6 +1132,7 @@ class Paiement extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1130,9 +1140,9 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); @@ -1174,15 +1184,16 @@ class Paiement extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the third party of object, from id into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; if (empty($force_thirdparty_id)) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index fba8723d818..9b605e68929 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Frédéric France +/* Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2016-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +17,9 @@ */ /** - * \file htdocs/compta/paiement_charge.php - * \ingroup tax - * \brief Page to add payment of a tax + * \file htdocs/compta/paiement_charge.php + * \ingroup tax + * \brief Page to add payment of a tax */ require '../main.inc.php'; @@ -226,7 +226,7 @@ if ($action == 'create') print '
'.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0; - $form->select_date($datepayment,'','','','',"add_payment",1,1); + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print "
'.$langs->trans("NotifyTransmision").'
'.$langs->trans("TransData").''; - print $form->select_date('','','','','',"userfile",1,1); + print $form->selectDate('', '', '', '', '', "userfile", 1, 1); print '
'.$langs->trans("TransMetod").''; print $form->selectarray("methode",$object->methodes_trans); @@ -268,7 +265,7 @@ if ($id > 0 || $ref) print '
'.$langs->trans("NotifyCredit").'
'.$langs->trans('CreditDate').''; - print $form->select_date('','','','','',"infocredit",1,1); + print $form->selectDate('', '', '', '', '', "infocredit", 1, 1); print '
'; print '
'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice"); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7eba6afec29..7b93966aa8b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -43,33 +43,36 @@ class BonPrelevement extends CommonObject * @var string ID to identify managed object */ public $element='widthdraw'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='prelevement_bons'; - - public $picto = 'payment'; - var $date_echeance; - var $raison_sociale; - var $reference_remise; - var $emetteur_code_guichet; - var $emetteur_numero_compte; - var $emetteur_code_banque; - var $emetteur_number_key; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'payment'; - var $emetteur_iban; - var $emetteur_bic; - var $emetteur_ics; + public $date_echeance; + public $raison_sociale; + public $reference_remise; + public $emetteur_code_guichet; + public $emetteur_numero_compte; + public $emetteur_code_banque; + public $emetteur_number_key; - var $total; - var $_fetched; - var $statut; // 0-Wait, 1-Trans, 2-Done - var $labelstatut=array(); + public $emetteur_iban; + public $emetteur_bic; + public $emetteur_ics; - var $invoice_in_error=array(); - var $thirdparty_in_error=array(); + public $total; + public $fetched; + public $statut; // 0-Wait, 1-Trans, 2-Done + public $labelstatut=array(); + + public $invoice_in_error=array(); + public $thirdparty_in_error=array(); /** @@ -106,9 +109,10 @@ class BonPrelevement extends CommonObject $this->methodes_trans[0] = "Internet"; - $this->_fetched = 0; + $this->fetched = 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add invoice to withdrawal * @@ -122,9 +126,9 @@ class BonPrelevement extends CommonObject * @param string $number_key number key of account number * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) { + // phpcs:enable $result = 0; $line_id = 0; @@ -312,7 +316,7 @@ class BonPrelevement extends CommonObject $this->statut = $obj->statut; - $this->_fetched = 1; + $this->fetched = 1; return 1; } @@ -328,14 +332,15 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set credite and set status of linked invoices. Still used ?? * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_credite() { + // phpcs:enable global $user,$conf; $error = 0; @@ -406,6 +411,7 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set direct debit order to "credited" status. * @@ -413,14 +419,14 @@ class BonPrelevement extends CommonObject * @param int $date date of action * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_infocredit($user, $date) { + // phpcs:enable global $conf,$langs; $error = 0; - if ($this->_fetched == 1) + if ($this->fetched == 1) { if ($date >= $this->date_trans) { @@ -553,6 +559,7 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set withdrawal to transmited status * @@ -561,9 +568,9 @@ class BonPrelevement extends CommonObject * @param string $method method of transmision to bank * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_infotrans($user, $date, $method) { + // phpcs:enable global $conf,$langs; $error = 0; @@ -678,14 +685,15 @@ class BonPrelevement extends CommonObject return $arr; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns amount of withdrawal * * @return double Total amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SommeAPrelever() { + // phpcs:enable global $conf; $sql = "SELECT sum(pfd.amount) as nb"; @@ -716,6 +724,7 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get number of invoices to withdrawal * TODO delete params banque and agence when not necesary @@ -724,9 +733,9 @@ class BonPrelevement extends CommonObject * @param int $agence dolibarr mysoc agence * @return int 0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DeleteNotification($user, $action) { + // phpcs:enable $result = 0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; @@ -1243,6 +1255,7 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a notification * @@ -1251,9 +1264,9 @@ class BonPrelevement extends CommonObject * @param string $action notification action * @return int 0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddNotification($db, $user, $action) { + // phpcs:enable $result = 0; if ($this->DeleteNotification($user, $action) == 0) @@ -1469,6 +1482,7 @@ class BonPrelevement extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write recipient of request (customer) * @@ -1483,9 +1497,9 @@ class BonPrelevement extends CommonObject * @param string $rib_dom rib domiciliation * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='') { + // phpcs:enable fputs($this->file, "06"); fputs($this->file, "08"); // Prelevement ordinaire @@ -1556,6 +1570,7 @@ class BonPrelevement extends CommonObject return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write recipient of request (customer) * @@ -1577,9 +1592,9 @@ class BonPrelevement extends CommonObject * @param string $row_drum rib.rowid used to generate rum * @return string Return string with SEPA part DrctDbtTxInf */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) { + // phpcs:enable $CrLf = "\n"; $Rowing = sprintf("%06d", $row_idfac); @@ -1634,14 +1649,15 @@ class BonPrelevement extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write sender of request (me) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregEmetteur() { + // phpcs:enable fputs($this->file, "03"); fputs($this->file, "08"); // Prelevement ordinaire @@ -1700,6 +1716,7 @@ class BonPrelevement extends CommonObject fputs($this->file, "\n"); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write sender of request (me). * Note: The tag PmtInf is opened here but closed into caller @@ -1712,9 +1729,9 @@ class BonPrelevement extends CommonObject * @param string $format FRST or RCUR or ALL * @return string String with SEPA Sender */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n', $format='FRST') { + // phpcs:enable // SEPA INITIALISATION global $conf; @@ -1822,15 +1839,16 @@ class BonPrelevement extends CommonObject return $XML_SEPA_INFO; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write end * * @param int $total total amount * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregTotal($total) { + // phpcs:enable fputs($this->file, "08"); fputs($this->file, "08"); // Prelevement ordinaire @@ -1895,6 +1913,7 @@ class BonPrelevement extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for a status * @@ -1902,9 +1921,9 @@ class BonPrelevement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable if (empty($this->labelstatut)) { global $langs; @@ -1914,39 +1933,35 @@ class BonPrelevement extends CommonObject $this->labelstatut[2]=$langs->trans("StatusCredited"); } - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $this->labelstatut[$statut]; } - if ($mode == 1) - { - return $this->labelstatut[$statut]; - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut==1) return img_picto($this->labelstatut[$statut],'statut3').' '.$this->labelstatut[$statut]; if ($statut==2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return img_picto($this->labelstatut[$statut],'statut1'); if ($statut==1) return img_picto($this->labelstatut[$statut],'statut3'); if ($statut==2) return img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut==1) return img_picto($this->labelstatut[$statut],'statut3').' '.$this->labelstatut[$statut]; if ($statut==2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut3'); if ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut3'); diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index fc92302cf7d..d8434caefd8 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -35,7 +35,7 @@ class LignePrelevement * @var int ID */ public $id; - + /** * @var DoliDB Database handler. */ @@ -128,6 +128,7 @@ class LignePrelevement return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for a status * @@ -135,28 +136,28 @@ class LignePrelevement * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut6'); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 095defe986a..6e3cfe499a8 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -34,7 +34,7 @@ class RejetPrelevement * @var int ID */ public $id; - + /** * @var DoliDB Database handler. */ @@ -199,15 +199,16 @@ class RejetPrelevement } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Send email to all users that has asked the withdraw request * * @param Facture $fac Invoice object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _send_email($fac) { + // phpcs:enable global $langs; $userid = 0; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index b08e2c3662e..0d07c341458 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -1,9 +1,10 @@ - * Copyright (C) 2010-2015 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2012 Juanjo Menent - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2010-2015 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -153,7 +154,7 @@ print '' if ($nb) { if ($pricetowithdraw) { print $langs->trans('ExecutionDate').' '; - print $form->select_date(); + print $form->selectDate(); if ($mysoc->isInEEC()) { print ''; print ''; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index a1aaa932b5b..8dd1c87069a 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -1,8 +1,9 @@ - * Copyright (C) 2005-2012 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -196,7 +197,7 @@ if ($id) //Date print ''.$langs->trans("RefusedData").''; print ''; - print $form->select_date('','','','','',"confirm_rejet"); + print $form->selectDate('', '', '', '', '', "confirm_rejet"); print ''; //Reason diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index b30e65310b3..4d643536388 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1,12 +1,13 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Dourseanud - * Copyright (C) 2014-2106 Ferran Marcet - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2014 Florian Henry +/* Copyright (C) 2002-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Dourseanud + * Copyright (C) 2014-2106 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,7 +162,7 @@ if ($modecompta=="CREANCES-DETTES") $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; if (! empty($conf->accounting->enabled)) $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesResultDue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); @@ -175,9 +176,8 @@ elseif ($modecompta=="RECETTES-DEPENSES") $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; if (! empty($conf->accounting->enabled)) $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - //$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1); - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $periodlink=($year_start?"".img_previous()." ".img_next()."":""); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); + $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesResultInOut"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); @@ -188,8 +188,7 @@ elseif ($modecompta=="BOOKKEEPING") $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1); - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $arraylist=array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); $period.='     '.$langs->trans("DetailByAccount").' '. $form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 1bfd767ef19..5fc58955b60 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -1,10 +1,11 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014-2016 Ferran Marcet - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2014 Florian Henry +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014-2016 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,7 +125,7 @@ if ($modecompta == 'CREANCES-DETTES') $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; if (! empty($conf->accounting->enabled)) $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesAmountWithTaxIncluded"); $description.='
'.$langs->trans("RulesResultDue"); @@ -138,7 +139,7 @@ else if ($modecompta=="RECETTES-DEPENSES") { $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; if (! empty($conf->accounting->enabled)) $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesAmountWithTaxIncluded"); $description.='
'.$langs->trans("RulesResultInOut"); @@ -151,7 +152,7 @@ else if ($modecompta=="BOOKKEEPING") $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesAmountOnInOutBookkeepingRecord"); $description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("Chartofaccounts")).')'; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 87127fdb4cf..c4a6e2ec755 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -1,7 +1,8 @@ - * Copyright (C) 2016 Alexandre Spangaro - * Copyright (C) 2018 Laurent Destailleur +/* Copyright (C) 2016-2017 Jamal Elbaz + * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2018 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,7 +172,7 @@ if ($modecompta=="CREANCES-DETTES") $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; if (! empty($conf->accounting->enabled)) $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesResultDue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); @@ -179,25 +180,24 @@ if ($modecompta=="CREANCES-DETTES") $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="RECETTES-DEPENSES") { +elseif ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("AnnualByAccountInputOutputMode"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; if (! empty($conf->accounting->enabled)) $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - //$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1); - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesResultInOut"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups"); $calcmode=$langs->trans("CalcModeBookkeeping"); //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $arraylist=array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); $period.='     '.$langs->trans("DetailByAccount").' '. $form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $periodlink = $textprevyear . $textnextyear ; @@ -247,12 +247,12 @@ if ($modecompta == 'CREANCES-DETTES') //if (! empty($date_start) && ! empty($date_end)) // $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { //if (! empty($date_start) && ! empty($date_end)) // $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Get array of all report groups that are active diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 3d8cf0a38ab..f50d940a51a 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +48,7 @@ $projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : GETPOST // Security check $socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'salaries', '', '', 'payment'); +$result = restrictedArea($user, 'salaries', '', '', ''); $object = new PaymentSalary($db); @@ -255,13 +256,13 @@ if ($action == 'create') // Date payment print ''; print fieldLabel('DatePayment','datep',1).''; - print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); + print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print ''; // Date value for bank print ''; print fieldLabel('DateValue','datev',0).''; - print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); + print $form->selectDate((empty($datev)?-1:$datev), "datev", '', '', '', 'add', 1, 1); print ''; // Employee @@ -280,13 +281,13 @@ if ($action == 'create') // Date start period print ''; print fieldLabel('DateStartPeriod','datesp',1).''; - print $form->select_date($datesp,"datesp",'','','','add'); + print $form->selectDate($datesp, "datesp", '', '', '', 'add'); print ''; // Date end period print ''; print fieldLabel('DateEndPeriod','dateep',1).''; - print $form->select_date($dateep,"dateep",'','','','add'); + print $form->selectDate($dateep, "dateep", '', '', '', 'add'); print ''; // Amount diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 5aa11229452..dc45c9a4fb0 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -41,10 +41,18 @@ class PaymentSalary extends CommonObject */ public $table_element='payment_salary'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='payment'; public $tms; + + /** + * @var int User ID + */ public $fk_user; + public $datep; public $datev; public $amount; @@ -53,7 +61,7 @@ class PaymentSalary extends CommonObject public $num_payment; /** - * @var string proper name for given parameter + * @var string salary payments label */ public $label; @@ -486,15 +494,16 @@ class PaymentSalary extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment salary and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -584,6 +593,7 @@ class PaymentSalary extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -591,9 +601,9 @@ class PaymentSalary extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 5209c281f68..59ca8389193 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -44,8 +44,9 @@ $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); // Security check +$socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'salaries', $id, ''); +$result = restrictedArea($user, 'salaries', '', '', ''); // Get parameters diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index d9942d86b79..a8a0b82e7d9 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -148,7 +148,7 @@ if ($result) if ($optioncss != '') $param.='&optioncss='.$optioncss; $newcardbutton=''; - if ($user->rights->salaries->payment->write) + if (! empty($user->rights->salaries->write)) { $newcardbutton=''.$langs->trans('NewSalaryPayment').''; $newcardbutton.= ''; diff --git a/htdocs/compta/salaries/stats/index.php b/htdocs/compta/salaries/stats/index.php index 7c7dbb43e3a..d5e3e226615 100644 --- a/htdocs/compta/salaries/stats/index.php +++ b/htdocs/compta/salaries/stats/index.php @@ -41,18 +41,6 @@ $socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'salaries', '', '', ''); -// Other security check -$childids = $user->getAllChildIds(); -$childids[]=$user->id; -if ($userid > 0) -{ - if (empty($user->rights->salaries->payment->readall) && ! in_array($userid, $childids)) - { - accessforbidden(); - exit; - } -} - $nowyear=strftime("%Y", dol_now()); $year = GETPOST('year')>0?GETPOST('year'):$nowyear; //$startyear=$year-2; @@ -77,11 +65,6 @@ print load_fiche_titre($title, $mesg); dol_mkdir($dir); $useridtofilter=$userid; // Filter from parameters -if (empty($useridtofilter)) -{ - $useridtofilter=$childids; - if (! empty($user->rights->salaries->payment->readall)) $useridtofilter=0; -} $stats = new SalariesStats($db, $socid, $useridtofilter); diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 7f5caa13031..4ffa1a2829f 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -1,8 +1,8 @@ - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2016 Frédéric France - * Copyright (C) 2017 Alexandre Spangaro +/* Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2016-2018 Frédéric France + * Copyright (C) 2017 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -332,7 +332,7 @@ if ($action == 'create') print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")); print ''; print ''; - print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1); + print $form->selectDate(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1); print ''; print ''; @@ -342,7 +342,7 @@ if ($action == 'create') print $langs->trans("DateDue"); print ''; print ''; - print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1); + print $form->selectDate(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1); print ''; print "\n"; @@ -502,7 +502,7 @@ if ($id > 0) print ""; if ($action == 'edit') { - print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1); + print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); } else { @@ -514,10 +514,9 @@ if ($id > 0) if ($action == 'edit') { print ''.$langs->trans("DateDue").""; - print $form->select_date($object->date_ech, 'ech', 0, 0, 0, 'charge', 1); + print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1); print ""; - } - else { + } else { print "".$langs->trans("DateDue")."".dol_print_date($object->date_ech,'day').""; } diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index bfa8c97a058..409ee99aaae 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -461,6 +461,7 @@ class Cchargesociales return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -468,9 +469,9 @@ class Cchargesociales * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index bad851450a7..2ea82fb32c4 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -36,14 +36,17 @@ class ChargeSociales extends CommonObject * @var string ID to identify managed object */ public $element='chargesociales'; - + public $table='chargesociales'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='chargesociales'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'bill'; /** @@ -51,18 +54,18 @@ class ChargeSociales extends CommonObject */ protected $table_ref_field = 'ref'; - var $date_ech; - var $lib; - var $type; - var $type_libelle; - var $amount; - var $paye; - var $periode; - var $date_creation; - var $date_modification; - var $date_validation; - var $fk_account; - var $fk_project; + public $date_ech; + public $lib; + public $type; + public $type_libelle; + public $amount; + public $paye; + public $periode; + public $date_creation; + public $date_modification; + public $date_validation; + public $fk_account; + public $fk_project; /** @@ -367,15 +370,16 @@ class ChargeSociales extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag social contribution as payed completely * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql.= " paye = 1"; $sql.= " WHERE rowid = ".$this->id; @@ -383,15 +387,17 @@ class ChargeSociales extends CommonObject if ($return) return 1; else return -1; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove tag payed on social contribution * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql.= " paye = 0"; $sql.= " WHERE rowid = ".$this->id; @@ -412,6 +418,7 @@ class ChargeSociales extends CommonObject return $this->LibStatut($this->paye,$mode,$alreadypaid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -420,55 +427,50 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$alreadypaid=-1) { + // phpcs:enable global $langs; $langs->load('customers'); $langs->load('bills'); - if ($mode == 0) + if ($mode == 0 || $mode == 1) { if ($statut == 0) return $langs->trans("Unpaid"); if ($statut == 1) return $langs->trans("Paid"); } - if ($mode == 1) - { - if ($statut == 0) return $langs->trans("Unpaid"); - if ($statut == 1) return $langs->trans("Paid"); - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - return "Error, mode/status not found"; + else return "Error, mode/status not found"; } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 4a989554b69..442e63efe11 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -41,17 +41,22 @@ class PaymentSocialContribution extends CommonObject */ public $table_element='paiementcharge'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'payment'; public $fk_charge; public $datec=''; public $tms=''; public $datep=''; + /** * @deprecated * @see amount */ public $total; + public $amount; // Total amount of payment public $amounts=array(); // Array of amounts public $fk_typepaiement; @@ -600,15 +605,16 @@ class PaymentSocialContribution extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); @@ -636,6 +642,7 @@ class PaymentSocialContribution extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -643,9 +650,9 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index b70cc3649b2..48b2698c762 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -397,7 +397,7 @@ while($j<$numlt) // Payment Salary -if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) +if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { if (! $mode || $mode != 'sconly') { diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 74ec0bfe4ae..5c9366037ed 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -152,7 +153,7 @@ if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption'); if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices'); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; // Set period -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $prevyear=$year_start; $prevquarter=$q; if ($prevquarter > 1) { $prevquarter--; @@ -230,7 +231,7 @@ else if ($modecompta=="BOOKKEEPINGCOLLECTED") } -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='
'.img_previous().' '.img_next().''; else $periodlink = ''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 712bb950bb2..e7a3d4da480 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -1,7 +1,8 @@ - * Copyright (C) 2013-2016 Laurent Destailleur - * Copyright (C) 2015 Raphaël Doursenaud +/* Copyright (C) 2013 Antoine Iauch + * Copyright (C) 2013-2016 Laurent Destailleur + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -199,7 +200,7 @@ else if ($modecompta=="BOOKKEEPINGCOLLECTED") } -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().' '.img_next().''; else $periodlink = ''; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 72dfd3a5637..4f49b9492ff 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2013 Antoine Iauch +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2013 Antoine Iauch + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -177,7 +178,7 @@ else if ($modecompta=="BOOKKEEPINGCOLLECTED") } -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().' '.img_next().''; else $periodlink = ''; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index af6bd7fc625..309737111f5 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -5,6 +5,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Antoine Iauch * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -203,7 +204,7 @@ else if ($modecompta=="BOOKKEEPINGCOLLECTED") } -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().' '.img_next().''; else $periodlink = ''; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 38df153a560..c5ceccdad61 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2017 Olivier Geffroy +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2017 Olivier Geffroy + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,7 +120,7 @@ if ($modecompta=="CREANCES-DETTES") $calcmode=$langs->trans("CalcModeDebt"); //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); @@ -133,7 +134,7 @@ else if ($modecompta=="RECETTES-DEPENSES") $calcmode=$langs->trans("CalcModeEngagement"); //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); @@ -146,7 +147,7 @@ else if ($modecompta=="BOOKKEEPING") $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesCATotalSaleJournal"); $builddate=dol_now(); diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 4480682b091..69483d84be0 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -255,11 +256,11 @@ if ($action == 'create') print ""; print ''.$langs->trans("DatePayment").''; - print $form->select_date($datep,"datep",'','','','add',1,1); + print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1); print ''; print ''.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->select_date($datev,"datev",'','','','add',1,1); + print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); print ''; // Label diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index a5f7c3134d7..8b407c9be61 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -37,29 +37,32 @@ class Tva extends CommonObject * @var string ID to identify managed object */ public $element='tva'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='tva'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='payment'; - var $tms; - var $datep; - var $datev; - var $amount; - var $type_payment; - var $num_payment; - + public $tms; + public $datep; + public $datev; + public $amount; + public $type_payment; + public $num_payment; + /** - * @var string proper name for given parameter + * @var string label */ public $label; - - var $fk_bank; - var $fk_user_creat; - var $fk_user_modif; + + public $fk_bank; + public $fk_user_creat; + public $fk_user_modif; /** * Constructor @@ -363,15 +366,16 @@ class Tva extends CommonObject return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total of the VAT from invoices emitted by the thirdparty. * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_collectee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; @@ -403,15 +407,16 @@ class Tva extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * VAT payed * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_payee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.total_tva) as total_tva"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -444,15 +449,16 @@ class Tva extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total of the VAT payed * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_reglee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."tva as f"; @@ -636,15 +642,16 @@ class Tva extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment tva and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -800,6 +807,7 @@ class Tva extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -807,9 +815,9 @@ class Tva extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage return ''; diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index ae95d71ca9c..74a08d0d142 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2006 Yannick Warnier - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -136,18 +137,22 @@ if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption'); if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices'); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; // Set period -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); -$prevyear=$year_start; $prevquarter=$q; +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); +$prevyear=$year_start; +$prevquarter=$q; if ($prevquarter > 1) { $prevquarter--; } else { - $prevquarter=4; $prevyear--; + $prevquarter=4; + $prevyear--; } -$nextyear=$year_start; $nextquarter=$q; +$nextyear=$year_start; +$nextquarter=$q; if ($nextquarter < 4) { $nextquarter++; } else { - $nextquarter=1; $nextyear++; + $nextquarter=1; + $nextyear++; } $builddate=dol_now(); diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 7c4912411f6..8e4fccf4168 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -217,7 +218,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='
'.$langs->trans("ThisIsAnEstimatedValue"); -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $builddate=dol_now(); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index e2c7cc5d793..ff3e3ce127d 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2006-2007, 2015 Yannick Warnier - * Copyright (C) 2014 Ferran Marcet +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2006-2015 Yannick Warnier + * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,18 +136,21 @@ if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption'); if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices'); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; // Set period -$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); +$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $prevyear=$year_start; $prevquarter=$q; if ($prevquarter > 1) { $prevquarter--; } else { - $prevquarter=4; $prevyear--; + $prevquarter=4; + $prevyear--; } -$nextyear=$year_start; $nextquarter=$q; +$nextyear=$year_start; +$nextquarter=$q; if ($nextquarter < 4) { $nextquarter++; } else { - $nextquarter=1; $nextyear++; + $nextquarter=1; + $nextyear++; } $description.=$fsearch; $builddate=dol_now(); diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 06c65500527..7e413854846 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -31,7 +31,7 @@ abstract class ActionsContactCardCommon * @var DoliDB Database handler. */ public $db; - + var $dirmodule; var $targetmodule; var $canvas; @@ -41,12 +41,12 @@ abstract class ActionsContactCardCommon var $tpl = array(); //! Object container var $object; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) @@ -76,16 +76,17 @@ abstract class ActionsContactCardCommon //} } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Set content of ->tpl array, to use into template * * @param string $action Type of action * @param int $id Id * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $conf, $langs, $user, $canvas; global $form, $formcompany, $objsoc; @@ -266,14 +267,15 @@ abstract class ActionsContactCardCommon } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign POST values into object * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post() { + // phpcs:enable global $langs, $mysoc; $this->object->old_name = $_POST["old_name"]; diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 566434c1d5a..5831b943d76 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -29,8 +29,8 @@ include_once DOL_DOCUMENT_ROOT.'/contact/canvas/actions_contactcard_common.class */ class ActionsContactCardDefault extends ActionsContactCardCommon { - /** - * Constructor + /** + * Constructor * * @param DoliDB $db Handler acces base de donnees * @param string $dirmodule Name of directory of module @@ -66,6 +66,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas * @@ -73,9 +74,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @param int $id Id * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $db, $langs, $user; global $form; @@ -120,6 +121,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -129,9 +131,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf, $langs; //$this->getFieldList(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 52957d25343..9e1757fdc5a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1,13 +1,14 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry +/* Copyright (C) 2004-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -704,11 +705,11 @@ else $form=new Form($db); if ($object->birthday) { - print $form->select_date($object->birthday,'birthday',0,0,0,"perso", 1, 0, 1); + print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); } else { - print $form->select_date('','birthday',0,0,1,"perso", 1, 0, 1); + print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4cd6fe81820..f81c4eed4c3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -41,13 +41,17 @@ class Contact extends CommonObject * @var string ID to identify managed object */ public $element='contact'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='socpeople'; - + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'contact'; @@ -131,9 +135,6 @@ class Contact extends CommonObject public $oldcopy; // To contains a clone of this when we need to save old properties of object - - - /** * Constructor * @@ -145,14 +146,15 @@ class Contact extends CommonObject $this->statut = 1; // By default, status is enabled } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators into this->nb for board * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -475,6 +477,7 @@ class Contact extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -484,9 +487,9 @@ class Contact extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN; @@ -496,14 +499,15 @@ class Contact extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info = array(); @@ -570,6 +574,7 @@ class Contact extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update field alert birthday * @@ -578,9 +583,9 @@ class Contact extends CommonObject * @param int $notrigger 0=no, 1=yes * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_perso($id, $user=null, $notrigger=0) { + // phpcs:enable $error=0; $result=false; @@ -726,7 +731,7 @@ class Contact extends CommonObject $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - + $this->fk_departement = $obj->fk_departement; // deprecated $this->state_id = $obj->fk_departement; $this->departement_code = $obj->state_code; // deprecated @@ -852,6 +857,7 @@ class Contact extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load number of elements the contact is used as a link for * ref_facturation @@ -861,9 +867,9 @@ class Contact extends CommonObject * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_ref_elements() { + // phpcs:enable // Compte les elements pour lesquels il est contact $sql ="SELECT tc.element, count(ec.rowid) as nb"; $sql.=" FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -1194,6 +1200,7 @@ class Contact extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1201,9 +1208,9 @@ class Contact extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; if ($mode == 0) @@ -1240,15 +1247,16 @@ class Contact extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return translated label of Public or Private * * @param int $statut Type (0 = public, 1 = private) * @return string Label translated */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibPubPriv($statut) { + // phpcs:enable global $langs; if ($statut=='1') return $langs->trans('ContactPrivate'); else return $langs->trans('ContactPublic'); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 30b7c5158ba..b60fdd8886b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -154,7 +154,7 @@ $arrayfields=array( 'p.phone'=>array('label'=>"Phone", 'checked'=>1), 'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0), 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), - 'p.fax'=>array('label'=>"Fax", 'checked'=>1), + 'p.fax'=>array('label'=>"Fax", 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'checked'=>1), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))), 'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), @@ -307,7 +307,7 @@ if ($search_societe) $sql.= natural_search('s.nom', $search_socie if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')'; if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste); if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso); -if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone); +if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro); if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile); if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 3e5ec085132..4932d549df4 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -1,7 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -199,7 +200,7 @@ if ($action == 'edit') // Date To Birth print ''.$langs->trans("DateToBirth").''; $form=new Form($db); - print $form->select_date($object->birthday,'birthday',0,0,1,"perso", 1,0,1); + print $form->selectDate($object->birthday, 'birthday', 0, 0, 1, "perso", 1,0); print ''; print ''.$langs->trans("Alert").': '; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9c13a57112a..0e0b0ee44f1 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1,14 +1,15 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005-2014 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2017 Juanjo Menent +/* Copyright (C) 2003-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2017 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2014-2016 Marcos García - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1242,7 +1243,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("Date").''; - $form->select_date($datecontrat,'',0,0,'',"contrat"); + print $form->selectDate($datecontrat, '', 0, 0, '', "contrat"); print ""; // Project @@ -1781,9 +1782,9 @@ else print ''; print ''; print $langs->trans("DateStartPlanned").' '; - $form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update"); + print $form->selectDate($db->jdate($objp->date_debut), "date_start_update", $usehm, $usehm, ($db->jdate($objp->date_debut)>0?0:1), "update"); print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update"); + print $form->selectDate($db->jdate($objp->date_fin), "date_end_update", $usehm, $usehm, ($db->jdate($objp->date_fin)>0?0:1), "update"); print ''; print ''; @@ -1966,10 +1967,10 @@ else print ''; print ''.$langs->trans("DateServiceActivate").''; - print $form->select_date($dateactstart,'',$usehm,$usehm,'',"active",1,0,1); + print $form->selectDate($dateactstart, '', $usehm, $usehm, '', "active", 1, 0); print ''; print ''.$langs->trans("DateEndPlanned").''; - print $form->select_date($dateactend,"end",$usehm,$usehm,'',"active",1,0,1); + print $form->selectDate($dateactend, "end", $usehm, $usehm, '', "active", 1, 0); print ''; print ''; print ''; @@ -2027,7 +2028,7 @@ else if ($objp->statut == 4) { print $langs->trans("DateEndReal").' '; - print $form->select_date($dateactend,"end",$usehm,$usehm,($objp->date_fin_reelle>0?0:1),"closeline",1,1,1); + print $form->selectDate($dateactend, "end", $usehm, $usehm, ($objp->date_fin_reelle>0?0:1), "closeline", 1, 1); } } print ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c7601cf9c1d..a811f10f881 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -51,9 +51,20 @@ class Contrat extends CommonObject */ public $table_element='contrat'; + /** + * @var int Name of subtable line + */ public $table_element_line='contratdet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_contrat'; - public $picto='contract'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='contract'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -76,27 +87,29 @@ class Contrat extends CommonObject * Customer reference of the contract * @var string */ - var $ref_customer; + public $ref_customer; /** * Supplier reference of the contract * @var string */ - var $ref_supplier; + public $ref_supplier; /** * Client id linked to the contract * @var int */ - var $socid; - var $societe; // Objet societe + public $socid; + + public $societe; // Objet societe /** * Status of the contract * @var int */ - var $statut=0; // 0=Draft, - var $product; + public $statut=0; // 0=Draft, + + public $product; /** * @var int Id of user author of the contract @@ -123,7 +136,7 @@ class Contrat extends CommonObject /** * @var int Date of creation */ - var $date_creation; + public $date_creation; /** * @var int Date of last modification. Not filled until you call ->info() @@ -133,34 +146,34 @@ class Contrat extends CommonObject /** * @var int Date of validation */ - var $date_validation; + public $date_validation; /** * @var int Date when contract was signed */ - var $date_contrat; + public $date_contrat; /** * @var int Date of contract closure * @deprecated we close contract lines, not a contract */ - var $date_cloture; + public $date_cloture; - var $commercial_signature_id; - var $commercial_suivi_id; + public $commercial_signature_id; + public $commercial_suivi_id; /** * @deprecated Use fk_project instead * @see fk_project */ - var $fk_projet; + public $fk_projet; - var $extraparams=array(); + public $extraparams=array(); /** * @var ContratLigne[] Contract lines */ - var $lines=array(); + public $lines=array(); /** * Maps ContratLigne IDs to $this->lines indexes @@ -236,6 +249,7 @@ class Contrat extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate a contract line * @@ -246,9 +260,9 @@ class Contrat extends CommonObject * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function active_line($user, $line_id, $date, $date_end='', $comment='') { + // phpcs:enable $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); if ($result < 0) { @@ -259,6 +273,7 @@ class Contrat extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close a contract line * @@ -268,9 +283,9 @@ class Contrat extends CommonObject * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_line($user, $line_id, $date_end, $comment='') { + // phpcs:enable $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); if ($result < 0) { @@ -702,15 +717,16 @@ class Contrat extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load lines array into this->lines. * This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed * * @return ContratLigne[] Return array of contract lines */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->nbofserviceswait=0; $this->nbofservicesopened=0; $this->nbofservicesexpired=0; @@ -1780,6 +1796,7 @@ class Contrat extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update statut of contract according to services * @@ -1787,9 +1804,9 @@ class Contrat extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated This function will never be used. Status of a contract is status of its lines. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_statut($user) { + // phpcs:enable dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); // If draft, we keep it (should not happen) @@ -1819,6 +1836,7 @@ class Contrat extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi label of a given contrat status * @@ -1826,9 +1844,9 @@ class Contrat extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; $langs->load("contracts"); if ($mode == 0) @@ -2002,15 +2020,16 @@ class Contrat extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of line rowid * * @param int $statut Status of lines to get * @return array Array of line's rowid */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function array_detail($statut=-1) { + // phpcs:enable $tab=array(); $sql = "SELECT cd.rowid"; @@ -2078,6 +2097,7 @@ class Contrat extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2085,9 +2105,9 @@ class Contrat extends CommonObject * @param string $mode "inactive" pour services a activer, "expired" pour services expires * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $langs; $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; @@ -2157,14 +2177,15 @@ class Contrat extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -2482,51 +2503,60 @@ class ContratLigne extends CommonObjectLine */ public $id; - var $ref; - var $tms; + /** + * @var string Ref + */ + public $ref; + + public $tms; + + public $fk_contrat; + public $fk_product; + public $statut; // 0 inactive, 4 active, 5 closed + public $type; // 0 for product, 1 for service - var $fk_contrat; - var $fk_product; - var $statut; // 0 inactive, 4 active, 5 closed - var $type; // 0 for product, 1 for service /** * @var string * @deprecated */ - var $label; + public $label; + /** * @var string * @deprecated */ public $libelle; - var $description; + /** + * @var string description + */ + public $description; - var $product_ref; - var $product_label; + public $product_ref; + public $product_label; - var $date_commande; + public $date_commande; - var $date_start; // date start planned - var $date_start_real; // date start real - var $date_end; // date end planned - var $date_end_real; // date end real + public $date_start; // date start planned + public $date_start_real; // date start real + public $date_end; // date end planned + public $date_end_real; // date end real // For backward compatibility - var $date_ouverture_prevue; // date start planned - var $date_ouverture; // date start real - var $date_fin_validite; // date end planned - var $date_cloture; // date end real - var $tva_tx; - var $localtax1_tx; - var $localtax2_tx; - var $localtax1_type; // Local tax 1 type - var $localtax2_type; // Local tax 2 type - var $qty; - var $remise_percent; - var $remise; - var $fk_remise_except; + public $date_ouverture_prevue; // date start planned + public $date_ouverture; // date start real + public $date_fin_validite; // date end planned + public $date_cloture; // date end real + public $tva_tx; + public $localtax1_tx; + public $localtax2_tx; + public $localtax1_type; // Local tax 1 type + public $localtax2_type; // Local tax 2 type + public $qty; + public $remise_percent; + public $remise; + public $fk_remise_except; - var $subprice; // Unit price HT + public $subprice; // Unit price HT /** * @var float @@ -2535,22 +2565,22 @@ class ContratLigne extends CommonObjectLine */ public $price; - var $price_ht; + public $price_ht; - var $total_ht; - var $total_tva; - var $total_localtax1; - var $total_localtax2; - var $total_ttc; + public $total_ht; + public $total_tva; + public $total_localtax1; + public $total_localtax2; + public $total_ttc; - var $fk_fournprice; - var $pa_ht; + public $fk_fournprice; + public $pa_ht; - var $info_bits; - var $fk_user_author; - var $fk_user_ouverture; - var $fk_user_cloture; - var $commentaire; + public $info_bits; + public $fk_user_author; + public $fk_user_ouverture; + public $fk_user_cloture; + public $commentaire; const STATUS_INITIAL = 0; const STATUS_OPEN = 4; @@ -2580,6 +2610,7 @@ class ContratLigne extends CommonObjectLine return $this->LibStatut($this->statut,$mode,((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1)); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a contract line status * @@ -2589,9 +2620,9 @@ class ContratLigne extends CommonObjectLine * @param string $moreatt More attribute * @return string Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($statut,$mode,$expired=-1,$moreatt='') { + // phpcs:enable global $langs; $langs->load("contracts"); if ($mode == 0) @@ -3003,15 +3034,16 @@ class ContratLigne extends CommonObjectLine } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour en base des champs total_xxx de ligne * Used by migration process * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base @@ -3120,6 +3152,7 @@ class ContratLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate a contract line * @@ -3129,9 +3162,9 @@ class ContratLigne extends CommonObjectLine * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function active_line($user, $date, $date_end = '', $comment = '') { + // phpcs:enable global $langs, $conf; $error = 0; @@ -3178,6 +3211,7 @@ class ContratLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close a contract line * @@ -3187,9 +3221,9 @@ class ContratLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_line($user, $date_end, $comment = '', $notrigger=0) { + // phpcs:enable global $langs, $conf; // Update object diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 114490fa373..72b45f49db5 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018 Ferran Marcet +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -455,7 +456,7 @@ if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print $form->selectarray('filter_opouvertureprevue',$arrayofoperators,$filter_opouvertureprevue,1); print ' '; $filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); - print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1); + print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0); print ''; } if (! empty($arrayfields['cd.date_ouverture']['checked'])) @@ -465,7 +466,7 @@ if (! empty($arrayfields['cd.date_ouverture']['checked'])) print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1); print ' '; $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); - print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1); + print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0); print ''; } if (! empty($arrayfields['cd.date_fin_validite']['checked'])) @@ -475,7 +476,7 @@ if (! empty($arrayfields['cd.date_fin_validite']['checked'])) print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1); print ' '; $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); - print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1); + print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0); print ''; } if (! empty($arrayfields['cd.date_cloture']['checked'])) @@ -485,7 +486,7 @@ if (! empty($arrayfields['cd.date_cloture']['checked'])) print $form->selectarray('filter_opcloture',$arrayofoperators,$filter_opcloture,1); print ' '; $filter_date_cloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear); - print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1); + print $form->selectDate($filter_date_cloture, 'opcloture', 0, 0, 1, '', 1, 0); print ''; } // Extra fields diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 8c81c0efc6a..6afd6b1e354 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -42,7 +42,7 @@ if (GETPOST('addfile','alpha')) $vardir=$conf->user->dir_output."/".$user->id; $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid); + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0); $action='presend'; } diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 09252bc0edc..642dc1038d9 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -93,8 +93,8 @@ if ($time >= $_SESSION['auto_check_events_not_before']) while ($obj = $db->fetch_object($resql)) { - $langs->load("agenda"); - $langs->load("commercial"); + // Load translation files required by the page + $langs->loadLangs(array('agenda', 'commercial')); $actionmod->fetch($obj->id); diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index cb45c12351e..a48543a00f6 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -34,12 +34,12 @@ class box_project extends ModeleBoxes var $boximg="object_projectpub"; var $boxlabel; //var $depends = array("projet"); - + /** * @var DoliDB Database handler. */ public $db; - + var $param; var $info_box_head = array(); @@ -54,8 +54,9 @@ class box_project extends ModeleBoxes function __construct($db,$param='') { global $user, $langs; - $langs->load("boxes"); - $langs->load("projects"); + + // Load translation files required by the page + $langs->loadLangs(array('boxes', 'projects')); $this->db = $db; $this->boxlabel="Projects"; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 9625cfa1bea..b85ed0f4d8b 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -31,21 +31,21 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; */ class box_task extends ModeleBoxes { - var $boxcode="projet"; - var $boximg="object_projecttask"; - var $boxlabel; - //var $depends = array("projet"); - + public $boxcode="projet"; + public $boximg="object_projecttask"; + public $boxlabel; + //public $depends = array("projet"); + /** * @var DoliDB Database handler. */ public $db; - - var $param; - var $enabled = 0; // Disabled because bugged. - var $info_box_head = array(); - var $info_box_contents = array(); + public $param; + public $enabled = 0; // Disabled because bugged. + + public $info_box_head = array(); + public $info_box_contents = array(); /** @@ -57,8 +57,10 @@ class box_task extends ModeleBoxes function __construct($db,$param='') { global $user, $langs; - $langs->load("boxes"); - $langs->load("projects"); + + // Load translation files required by the page + $langs->loadLangs(array('boxes', 'projects')); + $this->boxlabel="Tasks"; $this->db = $db; @@ -131,7 +133,7 @@ class box_task extends ModeleBoxes } - // Add the sum à the bottom of the boxes + // Add the sum at the bottom of the boxes $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")." ".$textHead); $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0fdd3333549..45998a78869 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -827,15 +827,16 @@ class CMailFile return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?='; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read a file on disk and return encoded content for emails (mode = 'mail') * * @param string $sourcefile Path to file to encode * @return int <0 if KO, encoded string if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _encode_file($sourcefile) { + // phpcs:enable $newsourcefile=dol_osencode($sourcefile); if (is_readable($newsourcefile)) @@ -853,6 +854,7 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SMTP request into a dump file (mode = all) * Used for debugging. @@ -860,9 +862,9 @@ class CMailFile * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_mail() { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir @@ -947,14 +949,15 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create SMTP headers (mode = 'mail') * * @return string headers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_smtpheaders() { + // phpcs:enable global $conf; $out = ""; @@ -1010,6 +1013,7 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create header MIME (mode = 'mail') * @@ -1017,9 +1021,9 @@ class CMailFile * @param array $mimefilename_list Array of mime types * @return string mime headers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_mimeheaders($filename_list, $mimefilename_list) { + // phpcs:enable $mimedone=0; $out = ""; @@ -1040,15 +1044,16 @@ class CMailFile return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return email content (mode = 'mail') * * @param string $msgtext Message string * @return string String content */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_body($msgtext) { + // phpcs:enable global $conf; $out=''; @@ -1141,6 +1146,7 @@ class CMailFile return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach file to email (mode = 'mail') * @@ -1149,9 +1155,9 @@ class CMailFile * @param array $mimefilename_list Tableau * @return string Chaine fichiers encodes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_files($filename_list,$mimetype_list,$mimefilename_list) { + // phpcs:enable $out = ''; $filename_list_size=count($filename_list); @@ -1189,15 +1195,16 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach an image to email (mode = 'mail') * * @param array $images_list Tableau * @return string Chaine images encodees */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_images($images_list) { + // phpcs:enable $out = ''; if ($images_list) @@ -1221,6 +1228,7 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Try to create a socket connection * @@ -1228,9 +1236,9 @@ class CMailFile * @param int $port Example: 25, 465 * @return int Socket id if ok, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_server_port($host,$port) { + // phpcs:enable global $conf; $_retVal=0; @@ -1285,6 +1293,7 @@ class CMailFile return $_retVal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This function has been modified as provided by SirSir to allow multiline responses when * using SMTP Extensions. @@ -1293,9 +1302,9 @@ class CMailFile * @param string $response Response string * @return boolean true if success */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function server_parse($socket, $response) { + // phpcs:enable $_retVal = true; // Indicates if Object was created or not $server_response = ''; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 5bc8105049e..c2512af70ef 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -192,15 +192,16 @@ class CSMSFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SendSms request into a dump file (mode = all) * Used for debugging. * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_sms() { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir @@ -222,6 +223,7 @@ class CSMSFile } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SendSms result into a dump file (mode = all) * Used for debugging. @@ -229,9 +231,9 @@ class CSMSFile * @param int $result Result of sms sending * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_sms_result($result) { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index e1a50c63083..d18501d54d9 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -41,7 +41,7 @@ class AntiVir public $errors = array(); var $output; - + /** * @var DoliDB Database handler. */ @@ -57,6 +57,7 @@ class AntiVir $this->db=$db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Scan a file with antivirus. * This function runs the command defined in setup. This antivirus command must return 0 if OK. @@ -65,9 +66,9 @@ class AntiVir * @param string $file File to scan * @return int <0 if KO (-98 if error, -99 if virus), 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dol_avscan_file($file) { + // phpcs:enable global $conf; $return = 0; diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index c65b2ba6fe1..a4665701661 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -32,7 +32,7 @@ class Canvas * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -133,6 +133,7 @@ class Canvas //print ' => template_dir='.$this->template_dir.'
'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Shared method for canvas to assign values for templates * @@ -141,9 +142,9 @@ class Canvas * @param string $ref Object ref (if id not provided) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action='view', $id=0, $ref='') { + // phpcs:enable if (method_exists($this->control,'assign_values')) $this->control->assign_values($action, $id, $ref); } @@ -161,6 +162,7 @@ class Canvas else return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display a canvas page. This will include the template for output. * Variables used by templates may have been defined or loaded before into the assign_values function. @@ -168,9 +170,9 @@ class Canvas * @param string $action Action code * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_canvas($action) { + // phpcs:enable global $db, $conf, $langs, $user, $canvas; global $form, $formfile; diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 30f426ec30d..2f9a8636c8b 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -36,7 +36,7 @@ class Ccountry // extends CommonObject * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -46,7 +46,7 @@ class Ccountry // extends CommonObject * @var string[] Error codes (or messages) */ public $errors = array(); - + //var $element='ccountry'; //!< Id that identify managed objects //var $table_element='ccountry'; //!< Name of table without prefix where object is stored @@ -54,16 +54,16 @@ class Ccountry // extends CommonObject * @var int ID */ public $id; - - var $code; - var $code_iso; - + + public $code; + public $code_iso; + /** - * @var string proper name for given parameter + * @var string Countries label */ public $label; - - var $active; + + public $active; diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 518f02ef2af..287d260f4d2 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -31,9 +31,16 @@ class Comment extends CommonObject */ public $table_element='comment'; - public $fk_element; + /** + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element =''; + public $element_type; + /** + * @var string description + */ public $description; public $tms; @@ -42,6 +49,9 @@ class Comment extends CommonObject public $fk_user_author; + /** + * @var int Entity + */ public $entity; public $import_key; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 5a1bcd8440d..a818bfe7a2f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -48,6 +48,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -55,9 +56,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_user($user,$outputlangs) { + // phpcs:enable global $conf; $logotouse=$conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo; @@ -85,6 +86,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -92,9 +94,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_mysoc($mysoc,$outputlangs) { + // phpcs:enable global $conf; if (empty($mysoc->forme_juridique) && ! empty($mysoc->forme_juridique_code)) @@ -144,6 +146,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -151,9 +154,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_thirdparty($object,$outputlangs) { + // phpcs:enable global $conf; if (empty($object->country) && ! empty($object->country_code)) @@ -224,6 +227,7 @@ abstract class CommonDocGenerator return $array_thirdparty; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -232,9 +236,9 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { + // phpcs:enable global $conf; if(empty($object->country) && ! empty($object->country_code)) @@ -297,15 +301,16 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_other($outputlangs) { + // phpcs:enable global $conf; $now=dol_now('gmt'); // gmt @@ -334,6 +339,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -342,9 +348,9 @@ abstract class CommonDocGenerator * @param string $array_key Name of the key for return array * @return array Array of substitution */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + // phpcs:enable global $conf; $sumpayed=$sumdeposit=$sumcreditnote=''; @@ -481,6 +487,7 @@ abstract class CommonDocGenerator return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -488,9 +495,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_lines($line,$outputlangs) { + // phpcs:enable global $conf; $resarray= array( @@ -559,6 +566,7 @@ abstract class CommonDocGenerator return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -567,9 +575,9 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array Array of substitution */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_shipment($object,$outputlangs,$array_key='object') { + // phpcs:enable global $conf; dol_include_once('/core/lib/product.lib.php'); $object->list_delivery_methods($object->shipping_method_id); @@ -621,6 +629,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -628,10 +637,10 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_shipment_lines($line, $outputlangs) { - global $conf; + // phpcs:enable + global $conf; dol_include_once('/core/lib/product.lib.php'); $resarray = array( @@ -668,6 +677,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -676,17 +686,17 @@ abstract class CommonDocGenerator * @param boolean $recursive Want to fetch child array or child object * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) { + // phpcs:enable $array_other = array(); - if(!empty($object)) { + if (!empty($object)) { foreach($object as $key => $value) { - if(!empty($value)) { - if(!is_array($value) && !is_object($value)) { + if (!empty($value)) { + if (!is_array($value) && !is_object($value)) { $array_other['object_'.$key] = $value; } - if(is_array($value) && $recursive){ + if (is_array($value) && $recursive) { $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value,$outputlangs,false); } } @@ -696,6 +706,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fill array with couple extrafield key => extrafield value * @@ -706,9 +717,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function fill_substitutionarray_with_extrafields($object,$array_to_fill,$extrafields,$array_key,$outputlangs) + function fill_substitutionarray_with_extrafields($object,$array_to_fill,$extrafields,$array_key,$outputlangs) { + // phpcs:enable global $conf; foreach($extrafields->attribute_label as $key=>$label) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 54d9aed45e9..e9be4b1f9da 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -325,6 +325,7 @@ abstract class CommonInvoice extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if an invoice can be deleted * Rule is: @@ -337,9 +338,9 @@ abstract class CommonInvoice extends CommonObject * * @return int <=0 if no, >0 if yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_erasable() { + // phpcs:enable global $conf; // We check if invoice is a temporary number (PROVxxxx) @@ -450,6 +451,7 @@ abstract class CommonInvoice extends CommonObject return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -460,9 +462,9 @@ abstract class CommonInvoice extends CommonObject * @param int $type Type invoice * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($paye, $status, $mode=0, $alreadypaid=-1, $type=0) { + // phpcs:enable global $langs; $langs->load('bills'); @@ -485,7 +487,7 @@ abstract class CommonInvoice extends CommonObject else return $langs->trans('Bill'.$prefix.'StatusPaid'); } } - if ($mode == 1) + elseif ($mode == 1) { $prefix='Short'; if (! $paye) @@ -503,7 +505,7 @@ abstract class CommonInvoice extends CommonObject else return $langs->trans('Bill'.$prefix.'StatusPaid'); } } - if ($mode == 2) + elseif ($mode == 2) { $prefix='Short'; if (! $paye) @@ -521,7 +523,7 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPaid'); } } - if ($mode == 3) + elseif ($mode == 3) { $prefix='Short'; if (! $paye) @@ -539,7 +541,7 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6'); } } - if ($mode == 4) + elseif ($mode == 4) { $prefix=''; if (! $paye) @@ -557,7 +559,7 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6').' '.$langs->trans('BillStatusPaid'); } } - if ($mode == 5 || $mode == 6) + elseif ($mode == 5 || $mode == 6) { $prefix=''; if ($mode == 5) $prefix='Short'; @@ -582,6 +584,7 @@ abstract class CommonInvoice extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi une date limite de reglement de facture en fonction des * conditions de reglements de la facture et date de facturation @@ -589,9 +592,9 @@ abstract class CommonInvoice extends CommonObject * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return date Date limite de reglement si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function calculate_date_lim_reglement($cond_reglement=0) { + // phpcs:enable if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a00f91ac5bc..7991bbb9ae9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2017 ATM Consulting * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2018 Frederic France + * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify @@ -73,9 +73,9 @@ abstract class CommonObject public $table_element; /** - * @var + * @var int Name of subtable line */ - public $table_element_line; + public $table_element_line=''; /** * @var string Key value used to track if data is coming from import wizard @@ -168,6 +168,7 @@ abstract class CommonObject * @see fetch_origin() */ public $origin; + /** * @var int The id of originating object * @see fetch_origin() @@ -713,6 +714,7 @@ abstract class CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a link between element $this->element and a contact * @@ -722,9 +724,9 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) { + // phpcs:enable global $user,$langs; @@ -836,6 +838,7 @@ abstract class CommonObject } else return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Copy contact from one element to current * @@ -843,9 +846,9 @@ abstract class CommonObject * @param string $source Nature of contact ('internal' or 'external') * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function copy_linked_contact($objFrom, $source='internal') { + // phpcs:enable $contacts = $objFrom->liste_contact(-1, $source); foreach($contacts as $contact) { @@ -858,6 +861,7 @@ abstract class CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a link to contact line * @@ -867,9 +871,9 @@ abstract class CommonObject * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) { + // phpcs:enable // Insert into database $sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set"; $sql.= " statut = ".$statut; @@ -888,6 +892,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a link to contact line * @@ -895,9 +900,9 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_contact($rowid, $notrigger=0) { + // phpcs:enable global $user; @@ -926,6 +931,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete all links between an object $this and all its contacts * @@ -933,9 +939,9 @@ abstract class CommonObject * @param string $code Type of contact (code or id) * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_linked_contact($source='',$code='') { + // phpcs:enable $temp = array(); $typeContact = $this->liste_type_contact($source,'',0,0,$code); @@ -962,6 +968,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get array of all contacts for an object * @@ -971,9 +978,9 @@ abstract class CommonObject * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array Array of contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_contact($statut=-1,$source='external',$list=0,$code='') { + // phpcs:enable global $langs; $tab=array(); @@ -1070,6 +1077,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array with list of possible values for type of contacts * @@ -1080,9 +1088,9 @@ abstract class CommonObject * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_type_contact($source='internal', $order='position', $option=0, $activeonly=0, $code='') { + // phpcs:enable global $langs; if (empty($order)) $order='position'; @@ -1184,15 +1192,16 @@ abstract class CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object contact with id=$this->contactid into $this->contact * * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_contact($contactid=null) { + // phpcs:enable if (empty($contactid)) $contactid=$this->contactid; if (empty($contactid)) return 0; @@ -1204,15 +1213,16 @@ abstract class CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { + // phpcs:enable global $conf; if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) @@ -1266,6 +1276,7 @@ abstract class CommonObject return $this->fetch($result->rowid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load data for barcode into properties ->barcode_type* * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but @@ -1273,9 +1284,9 @@ abstract class CommonObject * * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_barcode() { + // phpcs:enable global $conf; dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type); @@ -1316,14 +1327,15 @@ abstract class CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the project with id $this->fk_project into this->project * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_projet() { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (empty($this->fk_project) && ! empty($this->fk_projet)) $this->fk_project = $this->fk_projet; // For backward compatibility @@ -1337,14 +1349,15 @@ abstract class CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the product with id $this->fk_product into this->product * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_product() { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (empty($this->fk_product)) return 0; @@ -1356,29 +1369,31 @@ abstract class CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the user with id $userid into this->user * * @param int $userid Id du contact * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_user($userid) { + // phpcs:enable $user = new User($this->db); $result=$user->fetch($userid); $this->user = $user; return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read linked origin object * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_origin() { + // phpcs:enable if ($this->origin == 'shipping') $this->origin = 'expedition'; if ($this->origin == 'delivery') $this->origin = 'livraison'; @@ -1538,6 +1553,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load properties id_previous and id_next by comparing $fieldid with $this->ref * @@ -1546,9 +1562,9 @@ abstract class CommonObject * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_ref($filter, $fieldid, $nodbprefix=0) { + // phpcs:enable global $conf, $user; if (! $this->table_element) @@ -2173,6 +2189,7 @@ abstract class CommonObject // TODO: Move line related operations to CommonObjectLine? + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. @@ -2182,9 +2199,9 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true) { + // phpcs:enable if (! $this->table_element_line) { dol_syslog(get_class($this)."::line_order was called on objet with property table_element_line not defined",LOG_ERR); @@ -2293,6 +2310,7 @@ abstract class CommonObject return $rows; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a line to have a lower rank * @@ -2300,9 +2318,9 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_up($rowid, $fk_parent_line=true) { + // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); // Get rang of line @@ -2312,6 +2330,7 @@ abstract class CommonObject $this->updateLineUp($rowid, $rang); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a line to have a higher rank * @@ -2319,9 +2338,9 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_down($rowid, $fk_parent_line=true) { + // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); // Get rang of line @@ -2356,15 +2375,16 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update position of line with ajax (rang) * * @param array $rows Array of rows * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_ajaxorder($rows) { + // phpcs:enable $num = count($rows); for ($i = 0 ; $i < $num ; $i++) { @@ -2472,15 +2492,16 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get max value used for position of line (rang) * * @param int $fk_parent_line Parent line id * @return int Max value of rang in table of lines */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_max($fk_parent_line=0) { + // phpcs:enable // Search the last rang with fk_parent_line if ($fk_parent_line) { @@ -2519,15 +2540,16 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update external ref of element * * @param string $ref_ext Update field ref_ext * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_ref_ext($ref_ext) { + // phpcs:enable if (! $this->table_element) { dol_syslog(get_class($this)."::update_ref_ext was called on objet with property table_element not defined", LOG_ERR); @@ -2551,6 +2573,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update note of element * @@ -2558,9 +2581,9 @@ abstract class CommonObject * @param string $suffix '', '_public' or '_private' * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_note($note, $suffix='') { + // phpcs:enable global $user; if (! $this->table_element) @@ -2603,6 +2626,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update public note (kept for backward compatibility) * @@ -2611,12 +2635,13 @@ abstract class CommonObject * @deprecated * @see update_note() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_note_public($note) { + // phpcs:enable return $this->update_note($note,'_public'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines). * Must be called at end of methods addline or updateline. @@ -2627,9 +2652,9 @@ abstract class CommonObject * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null) { + // phpcs:enable global $conf, $hookmanager, $action; // Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield) @@ -2856,6 +2881,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add objects linked in llx_element_element. * @@ -2864,9 +2890,9 @@ abstract class CommonObject * @return int <=0 if KO, >0 if OK * @see fetchObjectLinked, updateObjectLinked, deleteObjectLinked */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_object_linked($origin=null, $origin_id=null) { + // phpcs:enable $origin = (! empty($origin) ? $origin : $this->origin); $origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id); @@ -3617,15 +3643,16 @@ abstract class CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return incoterms informations * TODO Use a cache for label get * * @return string incoterms info */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_incoterms() { + // phpcs:enable $out = ''; $this->libelle_incoterms = ''; if (!empty($this->fk_incoterms)) @@ -4225,6 +4252,7 @@ abstract class CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add resources to the current object : add entry into llx_element_resources * Need $this->element & $this->id @@ -4235,9 +4263,9 @@ abstract class CommonObject * @param int $mandatory Mandatory or not * @return int <=0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0) { + // phpcs:enable $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_resources ("; @@ -4270,6 +4298,7 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a link to resource line * @@ -4278,9 +4307,9 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_resource($rowid, $element, $notrigger=0) { + // phpcs:enable global $user; $this->db->begin(); @@ -4653,6 +4682,7 @@ abstract class CommonObject /* For triggers */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Call trigger based on this instance. * Some context information may also be provided into array property this->context. @@ -4663,9 +4693,9 @@ abstract class CommonObject * @param User $user Object user * @return int Result of run_triggers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { + // phpcs:enable global $langs,$conf; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -4690,6 +4720,7 @@ abstract class CommonObject /* Functions for extrafields */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to get extra fields of an object into $this->array_options * This method is in most cases called by method fetch of objects but you can call it separately. @@ -4698,9 +4729,9 @@ abstract class CommonObject * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_optionals($rowid=null, $optionsArray=null) { + // phpcs:enable if (empty($rowid)) $rowid=$this->id; // To avoid SQL errors. Probably not the better solution though @@ -5294,11 +5325,11 @@ abstract class CommonObject $showtime = in_array($type,array('datetime')) ? 1 : 0; - // Do not show current date when field not required (see select_date() method) + // Do not show current date when field not required (see selectDate() method) if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1); + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); } elseif (in_array($type,array('int','integer'))) { @@ -6175,7 +6206,7 @@ abstract class CommonObject { //Show only the key field in params if (is_array($params) && array_key_exists('onlykey',$params) && $key != $params['onlykey']) continue; - + $enabled = 1; if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key])) { @@ -6462,6 +6493,7 @@ abstract class CommonObject return $buyPrice; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show photos of an object (nbmax maximum), into several columns * @@ -6479,9 +6511,9 @@ abstract class CommonObject * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_photos($modulepart, $sdir, $size=0, $nbmax=0, $nbbyrow=5, $showfilename=0, $showaction=0, $maxHeight=120, $maxWidth=160, $nolink=0, $notitle=0, $usesharelink=0) { + // phpcs:enable global $conf,$user,$langs; include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 26227048782..6d4c32d82bb 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -94,6 +94,7 @@ abstract class CommonStickerGenerator $this->db = $db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build PDF on disk, then output on HTTP strem. * @@ -103,8 +104,8 @@ abstract class CommonStickerGenerator * @param string $outputdir Output directory for pdf file * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir=''); + // phpcs:enable /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) @@ -116,6 +117,7 @@ abstract class CommonStickerGenerator */ abstract function addSticker(&$pdf,$outputlangs,$param); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Methode qui permet de modifier la taille des caracteres * Cela modiera aussi l'espace entre chaque ligne @@ -124,9 +126,9 @@ abstract class CommonStickerGenerator * @param int $pt point * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Set_Char_Size(&$pdf,$pt) { + // phpcs:enable if ($pt > 3) { $this->_Char_Size = $pt; $this->_Line_Height = $this->_Get_Height_Chars($pt); @@ -134,6 +136,7 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Print dot line * @@ -146,9 +149,9 @@ abstract class CommonStickerGenerator * @param int $nbPointilles Nb pointilles * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15) { + // phpcs:enable $pdf->SetLineWidth($epaisseur); $length=abs($x1-$x2); $hauteur=abs($y1-$y2); @@ -176,6 +179,7 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Function realisant une croix aux 4 coins des cartes * @@ -188,9 +192,9 @@ abstract class CommonStickerGenerator * @param int $taille Size * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4) { + // phpcs:enable $pdf->SetDrawColor(192,192,192); $pdf->SetLineWidth($epaisseur); @@ -211,6 +215,7 @@ abstract class CommonStickerGenerator $pdf->SetDrawColor(0,0,0); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Convert units (in to mm, mm to in) * $src and $dest must be 'in' or 'mm' @@ -220,9 +225,9 @@ abstract class CommonStickerGenerator * @param string $dest to * @return float value value after conversion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Convert_Metric($value, $src, $dest) { + // phpcs:enable if ($src != $dest) { $tab['in'] = 39.37008; $tab['mm'] = 1000; @@ -232,15 +237,16 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Give the height for a char size given. * * @param int $pt Point * @return int Height chars */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Get_Height_Chars($pt) { + // phpcs:enable // Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes $_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10); if (in_array($pt, array_keys($_Table_Hauteur_Chars))) { @@ -250,6 +256,7 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Set format * @@ -257,9 +264,9 @@ abstract class CommonStickerGenerator * @param string $format Format * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Set_Format(&$pdf, $format) { + // phpcs:enable $this->_Metric = $format['metric']; $this->_Avery_Name = $format['name']; $this->_Avery_Code = $format['code']; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 34b2fd97c55..db22d443c54 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -523,6 +523,9 @@ class Conf // By default, we open card if one found if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1; + // By default, we show state code in combo list + if (! isset($this->global->MAIN_SHOW_STATE_CODE)) $this->global->MAIN_SHOW_STATE_CODE=1; + // Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal" if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later. if (! empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 3b1016aa55f..085da06c754 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -36,7 +36,7 @@ class Cstate // extends CommonObject * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -46,7 +46,7 @@ class Cstate // extends CommonObject * @var string[] Error codes (or messages) */ public $errors = array(); - + //var $element='cstate'; //!< Id that identify managed objects //var $table_element='cstate'; //!< Name of table without prefix where object is stored @@ -54,10 +54,10 @@ class Cstate // extends CommonObject * @var int ID */ public $id; - - var $code_departement; - var $nom; - var $active; + + public $code_departement; + public $nom; + public $active; diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index aa3e6620d4f..9366cf6317b 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -31,7 +31,7 @@ class Ctypent // extends CommonObject * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -41,7 +41,7 @@ class Ctypent // extends CommonObject * @var string[] Error codes (or messages) */ public $errors = array(); - + //var $element='ctypent'; //!< Id that identify managed objects //var $table_element='ctypent'; //!< Name of table without prefix where object is stored @@ -49,11 +49,11 @@ class Ctypent // extends CommonObject * @var int ID */ public $id; - - var $code; - var $libelle; - var $active; - var $module; + + public $code; + public $libelle; + public $active; + public $module; diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index d459ff6fb41..297e48a940b 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -19,7 +19,7 @@ */ /** - * \file resource/ctyperesource.class.php + * \file htdocs/core/class/ctyperesource.class.php * \ingroup resource */ @@ -50,7 +50,7 @@ class Ctyperesource public $code; /** - * @var string proper name for given parameter + * @var string Type resource label */ public $label; @@ -127,15 +127,15 @@ class Ctyperesource if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + //if (!$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + //} } // Commit or rollback @@ -331,15 +331,15 @@ class Ctyperesource dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} // Commit or rollback if ($error) { @@ -369,17 +369,15 @@ class Ctyperesource $this->db->begin(); - if (!$error) { - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_DELETE',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} // If you need to delete child tables to, you can insert them here @@ -486,7 +484,7 @@ class CtyperesourceLine public $code; /** - * @var string proper name for given parameter + * @var string Type resource line label */ public $label; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index a2ac7a1f458..6f6e3a09041 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -32,26 +32,43 @@ class DiscountAbsolute * @var DoliDB Database handler. */ public $db; - + /** - * @var string Error code (or message) - */ - public $error; + * @var string Error code (or message) + */ + public $error; /** * @var string[] Array of error strings */ public $errors=array(); - public $id; // Id discount + /** + * @var int ID discount + */ + public $id; + + /** + * @var int Thirdparty ID + */ public $fk_soc; + public $discount_type; // 0 => customer discount, 1 => supplier discount public $amount_ht; // public $amount_tva; // public $amount_ttc; // public $tva_tx; // Vat rate - public $fk_user; // Id utilisateur qui accorde la remise - public $description; // Description libre + + /** + * @var int User ID Id utilisateur qui accorde la remise + */ + public $fk_user; + + /** + * @var string description + */ + public $description; + public $datec; // Date creation public $fk_facture_line; // Id invoice line when a discount is used into an invoice line (for absolute discounts) public $fk_facture; // Id invoice when a discount line is used into an invoice (for credit note) @@ -344,6 +361,7 @@ class DiscountAbsolute + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link the discount to a particular invoice line or a particular invoice. * When discount is a global discount used as an invoice line, we link using rowidline. @@ -353,9 +371,9 @@ class DiscountAbsolute * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduc payment of invoice) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function link_to_invoice($rowidline,$rowidinvoice) { + // phpcs:enable // Check parameters if (! $rowidline && ! $rowidinvoice) { @@ -399,15 +417,16 @@ class DiscountAbsolute } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link the discount to a particular invoice line or a particular invoice. * Do not call this if discount is linked to a reconcialiated invoice * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function unlink_invoice() { + // phpcs:enable $sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; if(! empty($this->discount_type)) { $sql.=" SET fk_invoice_supplier_line = NULL, fk_invoice_supplier = NULL"; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 52d9b47ecdf..548721be05f 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -137,6 +137,7 @@ class DolEditor } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output edit area inside the HTML stream. * Output depends on this->tool (fckeditor, ckeditor, textarea, ...) @@ -148,9 +149,9 @@ class DolEditor * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) * @return void|string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='') { + // phpcs:enable global $conf,$langs; $fullpage=false; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 55ecc77291a..618716ce0e4 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -69,7 +69,7 @@ class DolGraph var $showpercent=0; var $combine=0; // 0.05 if you want to combine records < 5% into "other" var $graph; // Objet Graph (Artichow, Phplot...) - + /** * @var string Error code (or message) */ @@ -128,120 +128,130 @@ class DolGraph } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set Y precision * * @param float $which_prec Precision * @return boolean */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetPrecisionY($which_prec) { + // phpcs:enable $this->PrecisionY = $which_prec; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * * @param float $xi Xi * @return boolean True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHorizTickIncrement($xi) { + // phpcs:enable $this->horizTickIncrement = $xi; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * * @param float $xt Xt * @return boolean True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetNumXTicks($xt) { + // phpcs:enable $this->SetNumXTicks = $xt; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set label interval to reduce number of labels * * @param float $x Label interval * @return boolean True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLabelInterval($x) { + // phpcs:enable $this->labelInterval = $x; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Hide X grid * * @param boolean $bool XGrid or not * @return boolean true */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHideXGrid($bool) { + // phpcs:enable $this->hideXGrid = $bool; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Hide Y grid * * @param boolean $bool YGrid or not * @return boolean true */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHideYGrid($bool) { + // phpcs:enable $this->hideYGrid = $bool; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set y label * * @param string $label Y label * @return boolean|null True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetYLabel($label) { + // phpcs:enable $this->YLabel = $label; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set width * * @param int $w Width * @return boolean|null True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetWidth($w) { + // phpcs:enable $this->width = $w; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set title * * @param string $title Title * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetTitle($title) { + // phpcs:enable $this->title = $title; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set data * @@ -249,161 +259,174 @@ class DolGraph * @return void * @see draw_jflot for syntax of data array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetData($data) { + // phpcs:enable $this->data = $data; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set data * * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetDataColor($datacolor) { + // phpcs:enable $this->datacolor = $datacolor; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set type * * @param array $type Array with type for each serie. Example: array('pie'), array('lines',...,'bars') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetType($type) { + // phpcs:enable $this->type = $type; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set legend * * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLegend($legend) { + // phpcs:enable $this->Legend = $legend; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set min width * * @param int $legendwidthmin Min width * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLegendWidthMin($legendwidthmin) { + // phpcs:enable $this->LegendWidthMin = $legendwidthmin; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set max value * * @param int $max Max value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetMaxValue($max) { + // phpcs:enable $this->MaxValue = $max; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get max value * * @return int Max value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMaxValue() { + // phpcs:enable return $this->MaxValue; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set min value * * @param int $min Min value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetMinValue($min) { + // phpcs:enable $this->MinValue = $min; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get min value * * @return int Max value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMinValue() { + // phpcs:enable return $this->MinValue; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set height * * @param int $h Height * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHeight($h) { + // phpcs:enable $this->height = $h; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set shading * * @param string $s Shading * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetShading($s) { + // phpcs:enable $this->SetShading = $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set shading * * @param string $s Shading * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetCssPrefix($s) { + // phpcs:enable $this->cssprefix = $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reset bg color * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetBgColor() { + // phpcs:enable unset($this->bgcolor); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reset bgcolorgrid * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetBgColorGrid() { + // phpcs:enable unset($this->bgcolorgrid); } @@ -452,15 +475,16 @@ class DolGraph + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define background color of complete image * * @param array $bg_color array(R,G,B) ou 'onglet' ou 'default' * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetBgColor($bg_color = array(255,255,255)) { + // phpcs:enable global $theme_bgcolor,$theme_bgcoloronglet; if (! is_array($bg_color)) @@ -481,15 +505,16 @@ class DolGraph } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define background color of grid * * @param array $bg_colorgrid array(R,G,B) ou 'onglet' ou 'default' * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetBgColorGrid($bg_colorgrid = array(255,255,255)) { + // phpcs:enable global $theme_bgcolor,$theme_bgcoloronglet; if (! is_array($bg_colorgrid)) @@ -510,25 +535,27 @@ class DolGraph } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reset data color * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetDataColor() { + // phpcs:enable unset($this->datacolor); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get max value * * @return int Max value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMaxValueInData() { + // phpcs:enable $k = 0; $vals = array(); @@ -547,14 +574,15 @@ class DolGraph return $vals[0]; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return min value of all data * * @return int Min value of all data */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMinValueInData() { + // phpcs:enable $k = 0; $vals = array(); @@ -573,14 +601,15 @@ class DolGraph return $vals[0]; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return max value of all data * * @return int Max value of all data */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetCeilMaxValue() { + // phpcs:enable $max = $this->GetMaxValueInData(); if ($max != 0) $max++; $size=dol_strlen(abs(ceil($max))); @@ -597,14 +626,15 @@ class DolGraph return $res; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return min value of all data * * @return double Max value of all data */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetFloorMinValue() { + // phpcs:enable $min = $this->GetMinValueInData(); if ($min == '') $min=0; if ($min != 0) $min--; @@ -652,6 +682,7 @@ class DolGraph } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Build a graph onto disk using Artichow library and return img string to it * @@ -659,9 +690,9 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_artichow($file,$fileurl) { + // phpcs:enable global $artichow_defaultfont; dol_syslog(get_class($this)."::draw_artichow this->type=".join(',',$this->type)); @@ -832,6 +863,7 @@ class DolGraph } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Build a graph using JFlot library. Input when calling this method should be: * $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB)); @@ -848,9 +880,9 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk. Never used here. * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_jflot($file,$fileurl) { + // phpcs:enable global $artichow_defaultfont; dol_syslog(get_class($this)."::draw_jflot this->type=".join(',',$this->type)." this->MaxValue=".$this->MaxValue); @@ -960,7 +992,7 @@ class DolGraph var percent=Math.round(series.percent); var number=series.data[0][1]; return \''; - $this->stringtoshow.='\'; + $this->stringtoshow.='\'; }, background: { opacity: 0.0, diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index a00da884aba..8734c4126e7 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -1,6 +1,6 @@ + * Copyright (C) 2015-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,25 +105,25 @@ class dolReceiptPrinter extends Escpos const CONNECTOR_NETWORK_PRINT = 3; const CONNECTOR_WINDOWS_PRINT = 4; //const CONNECTOR_JAVA = 5; - + /** * @var DoliDB Database handler. */ public $db; - + var $tags; var $printer; var $template; - + /** - * @var string Error code (or message) - */ - public $error=''; - + * @var string Error code (or message) + */ + public $error=''; + /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); + * @var string[] Error codes (or messages) + */ + public $errors = array(); @@ -216,6 +216,7 @@ class dolReceiptPrinter extends Escpos global $conf; $error = 0; $line = 0; + $obj = array(); $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; $sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt'; $sql.= ' WHERE entity = '.$conf->entity; @@ -283,6 +284,7 @@ class dolReceiptPrinter extends Escpos global $conf; $error = 0; $line = 0; + $obj = array(); $sql = 'SELECT rowid, name, template'; $sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template'; $sql.= ' WHERE entity = '.$conf->entity; @@ -350,6 +352,7 @@ class dolReceiptPrinter extends Escpos } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Add a printer in db * @@ -359,9 +362,9 @@ class dolReceiptPrinter extends Escpos * @param string $parameter Printer parameter * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddPrinter($name, $type, $profile, $parameter) { + // phpcs:enable global $conf; $error = 0; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt'; @@ -375,6 +378,7 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer in db * @@ -385,9 +389,9 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function UpdatePrinter($name, $type, $profile, $parameter, $printerid) { + // phpcs:enable global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt'; @@ -404,15 +408,16 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Delete a printer from db * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DeletePrinter($printerid) { + // phpcs:enable global $conf; $error = 0; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt'; @@ -425,6 +430,7 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer template in db * @@ -433,9 +439,9 @@ class dolReceiptPrinter extends Escpos * @param int $templateid Template id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function UpdateTemplate($name, $template, $templateid) { + // phpcs:enable global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template'; @@ -451,15 +457,16 @@ class dolReceiptPrinter extends Escpos } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Send Test page to Printer * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SendTestToPrinter($printerid) { + // phpcs:enable global $conf; $error = 0; $img = new EscposImage(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png'); @@ -486,6 +493,7 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Print Receipt Ticket * @@ -494,9 +502,9 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SendToPrinter($object, $templateid, $printerid) { + // phpcs:enable global $conf; $error = 0; $ret = $this->loadTemplate($templateid); @@ -650,15 +658,16 @@ class dolReceiptPrinter extends Escpos } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function Init Printer * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function InitPrinter($printerid) { + // phpcs:enable global $conf; $error=0; $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index ffff8ef1941..d2bf33b5461 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -39,17 +39,17 @@ class EmailSenderProfile extends CommonObject * @var string ID to identify managed object */ public $element = 'emailsenderprofile'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'c_email_senderprofile'; - + /** * @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; - + /** * @var string String with name of icon for emailsenderprofile */ @@ -88,8 +88,17 @@ class EmailSenderProfile extends CommonObject 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1), ); + + /** + * @var int ID + */ public $rowid; + + /** + * @var int Entity + */ public $entity; + public $label; public $email; public $date_creation; @@ -310,6 +319,7 @@ class EmailSenderProfile extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -317,43 +327,36 @@ class EmailSenderProfile extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index b4fa7133bff..2ac2a51d2ed 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -63,13 +63,17 @@ class Events // extends CommonObject var $type; var $entity; var $dateevent; - var $description; + + /** + * @var string description + */ + public $description; // List of all Audit/Security events supported by triggers var $eventstolog=array( - array('id'=>'USER_LOGIN', 'test'=>1), + /*array('id'=>'USER_LOGIN', 'test'=>1), array('id'=>'USER_LOGIN_FAILED', 'test'=>1), - array('id'=>'USER_LOGOUT', 'test'=>1), + array('id'=>'USER_LOGOUT', 'test'=>1),*/ array('id'=>'USER_CREATE', 'test'=>1), array('id'=>'USER_MODIFY', 'test'=>1), array('id'=>'USER_NEW_PASSWORD', 'test'=>1), diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d7b16293a11..c86bd3eff3f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -95,7 +95,7 @@ class ExtraFields * @var string Error code (or message) */ public $error=''; - + var $errno; @@ -293,6 +293,7 @@ class ExtraFields } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add description of a new optional attribute * @@ -316,9 +317,9 @@ class ExtraFields * @param string $enabled Condition to have the field enabled or not * @return int <=0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $default='', $computed='',$entity='', $langfile='', $enabled='1') { + // phpcs:enable global $conf,$user; if ($elementtype == 'thirdparty') $elementtype='societe'; @@ -463,6 +464,7 @@ class ExtraFields } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete description of an optional attribute * @@ -470,9 +472,9 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @return int < 0 if KO, 0 if nothing is done, 1 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function delete_label($attrname, $elementtype='member') { + // phpcs:enable global $conf; if ($elementtype == 'thirdparty') $elementtype='societe'; @@ -612,6 +614,7 @@ class ExtraFields } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Modify description of personalized attribute * @@ -636,9 +639,9 @@ class ExtraFields * @param int $totalizable Is extrafield totalizable on list * @return int <=0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$help='',$default='',$computed='',$entity='',$langfile='',$enabled='1', $totalizable=0) { + // phpcs:enable global $conf, $user; dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable); @@ -672,11 +675,22 @@ class ExtraFields $params=''; } - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; - $sql_del.= " WHERE name = '".$attrname."'"; - $sql_del.= " AND entity = ".($entity===''?$conf->entity:$entity); - $sql_del.= " AND elementtype = '".$elementtype."'"; - + if ($entity === '' || $entity != '0') + { + // We dont want on all entities, we delete all and current + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; + $sql_del.= " WHERE name = '".$attrname."'"; + $sql_del.= " AND entity IN (0, ".($entity===''?$conf->entity:$entity).")"; + $sql_del.= " AND elementtype = '".$elementtype."'"; + } + else + { + // We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity) + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; + $sql_del.= " WHERE name = '".$attrname."'"; + $sql_del.= " AND entity = 0"; + $sql_del.= " AND elementtype = '".$elementtype."'"; + } $resql1=$this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; @@ -748,6 +762,7 @@ class ExtraFields } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ... * @@ -755,9 +770,9 @@ class ExtraFields * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required. * @return array Array of attributes keys+label for all extra fields. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_name_optionals_label($elementtype,$forceload=false) { + // phpcs:enable global $conf; if (empty($elementtype)) return array(); @@ -982,11 +997,11 @@ class ExtraFields $showtime = in_array($type,array('datetime')) ? 1 : 0; - // Do not show current date when field not required (see select_date() method) + // Do not show current date when field not required (see selectDate() method) if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1); + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); } elseif (in_array($type,array('int','integer'))) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 0bc58a64e64..de4dc46ac90 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -38,25 +38,36 @@ class Fiscalyear extends CommonObject */ public $table_element='accounting_fiscalyear'; + /** + * @var int Name of subtable line + */ public $table_element_line = ''; - public $fk_element = ''; - public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - - var $rowid; /** - * @var string proper name for given parameter + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element = ''; + + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + /** + * @var int ID + */ + public $rowid; + + /** + * @var string fiscal year label */ public $label; - var $date_start; - var $date_end; - var $datec; - var $statut; // 0=open, 1=closed - var $entity; + public $date_start; + public $date_end; + public $datec; + public $statut; // 0=open, 1=closed + public $entity; - var $statuts=array(); - var $statuts_short=array(); + public $statuts=array(); + public $statuts_short=array(); /** * Constructor @@ -250,6 +261,7 @@ class Fiscalyear extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Give a label from a status * @@ -257,38 +269,38 @@ class Fiscalyear extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ca16cf90b02..c1619f97f6f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -17,6 +17,7 @@ * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2014 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -210,11 +211,11 @@ class Form } else if ($typeofdata == 'day' || $typeofdata == 'datepicker') { - $ret.=$this->select_date($value,$htmlname,0,0,1,'form'.$htmlname,1,0,1); + $ret.=$this->selectDate($value,$htmlname,0,0,1,'form'.$htmlname,1,0); } else if ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { - $ret.=$this->select_date($value,$htmlname,1,1,1,'form'.$htmlname,1,0,1); + $ret.=$this->selectDate($value,$htmlname,1,1,1,'form'.$htmlname,1,0); } else if (preg_match('/^select;/',$typeofdata)) { @@ -653,6 +654,7 @@ class Form return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return combo list of activated countries, into language of user * @@ -666,9 +668,9 @@ class Form * @param int $disablefavorites Disable favorites * @return string HTML string with select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0) { + // phpcs:enable global $conf,$langs; $langs->load("dict"); @@ -750,6 +752,7 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of incoterms * @@ -762,9 +765,9 @@ class Form * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string HTML string with select and input */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_incoterms($selected='', $location_incoterms='', $page='', $htmlname='incoterm_id', $htmloption='', $forcecombo=1, $events=array()) { + // phpcs:enable global $conf,$langs; $langs->load("dict"); @@ -843,6 +846,7 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of lines (product or service) * Example: 0=product, 1=service, 9=other (for external module) @@ -854,9 +858,9 @@ class Form * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0) { + // phpcs:enable global $db,$langs,$user,$conf; // If product & services are enabled or both disabled. @@ -899,14 +903,15 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into cache cache_types_fees, array of types of fees * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_types_fees() { + // phpcs:enable global $langs; $num = count($this->cache_types_fees); @@ -947,6 +952,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of notes * @@ -955,9 +961,9 @@ class Form * @param int $showempty Add an empty field * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees($selected='',$htmlname='type',$showempty=0) { + // phpcs:enable global $user, $langs; dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); @@ -986,6 +992,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML code to select a company. * @@ -998,12 +1005,13 @@ class Form * @return string Return select box for thirdparty. * @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0) { + // phpcs:enable return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0, $limit); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a third party * @@ -1023,9 +1031,9 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter) * @return string HTML string with select box for thirdparty. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false) { + // phpcs:enable global $conf,$user,$langs; $out=''; @@ -1067,6 +1075,7 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a third party. * Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company. @@ -1086,9 +1095,9 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return string HTML string with */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false) { + // phpcs:enable global $conf,$user,$langs; $out=''; @@ -1249,6 +1258,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of absolute discounts * @@ -1259,9 +1269,9 @@ class Form * @param int $maxvalue Max value for lines that can be selected * @return int Return number of qualifed lines in list */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_remises($selected, $htmlname, $filter, $socid, $maxvalue=0) { + // phpcs:enable global $langs,$conf; // On recherche les remises @@ -1325,6 +1335,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of all contacts (for a third party or all) * @@ -1345,9 +1356,9 @@ class Form * @return int <0 if KO, Nb of contact in list if OK * @deprected You can use selectcontacts directly (warning order of param was changed) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $events=array(), $options_only=false, $moreparam='', $htmlid='') { + // phpcs:enable print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); return $this->num; } @@ -1485,6 +1496,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users * @@ -1500,12 +1512,13 @@ class Form * @deprecated Use select_dolusers instead * @see select_dolusers() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity='0') { + // phpcs:enable print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users * @@ -1529,9 +1542,9 @@ class Form * @return string HTML select string * @see select_dolgroups */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false) { + // phpcs:enable global $conf,$user,$langs; // If no preselected user defined, we take current user @@ -1714,6 +1727,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users. Selected users are stored into session. * List of users are provided into $_SESSION['assignedtouser']. @@ -1736,9 +1750,9 @@ class Form * @return string HTML select string * @see select_dolgroups */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array()) { + // phpcs:enable global $conf, $user, $langs; $userstatic=new User($this->db); @@ -1803,6 +1817,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for customer in Ajax if Ajax activated or go to select_produits_list * @@ -1828,9 +1843,9 @@ class Form * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array()) { + // phpcs:enable global $langs,$conf; $price_level = (! empty($price_level) ? $price_level : 0); @@ -1946,6 +1961,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for a customer * @@ -1969,9 +1985,9 @@ class Form * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @return array Array of keys for json */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus='') { + // phpcs:enable global $langs,$conf,$user,$db; $out=''; @@ -2433,6 +2449,7 @@ class Form $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list) * @@ -2446,9 +2463,9 @@ class Form * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0) { + // phpcs:enable global $langs,$conf; global $price_level, $status, $finished; @@ -2475,6 +2492,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of suppliers products * @@ -2490,9 +2508,9 @@ class Form * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return array Array of keys for json */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100,$alsoproductwithnosupplierprice=0) { + // phpcs:enable global $langs,$conf,$db; $out=''; @@ -2705,6 +2723,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of suppliers prices for a product * @@ -2713,9 +2732,9 @@ class Form * @param int $selected_supplier Pre-selected supplier if more than 1 result * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_product_fourn_price($productid, $htmlname='productfournpriceid', $selected_supplier='') { + // phpcs:enable global $langs,$conf; $langs->load('stocks'); @@ -2817,6 +2836,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of delivery address * @@ -2826,10 +2846,10 @@ class Form * @param int $showempty Add an empty field * @return integer|null */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_address($selected, $socid, $htmlname='address_id',$showempty=0) { - // On recherche les utilisateurs + // phpcs:enable + // looking for users $sql = "SELECT a.rowid, a.label"; $sql .= " FROM ".MAIN_DB_PREFIX ."societe_address as a"; $sql .= " WHERE a.fk_soc = ".$socid; @@ -2870,14 +2890,15 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into cache list of payment terms * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_conditions_paiements() { + // phpcs:enable global $langs; $num = count($this->cache_conditions_paiements); @@ -2918,14 +2939,15 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge dans cache la liste des délais de livraison possibles * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_availability() { + // phpcs:enable global $langs; $num = count($this->cache_availability); @@ -3085,14 +3107,15 @@ class Form if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge dans cache la liste des types de paiements possibles * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_types_paiements() { + // phpcs:enable global $langs; $num=count($this->cache_types_paiements); @@ -3138,6 +3161,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of payment modes. * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. @@ -3151,9 +3175,9 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_conditions_paiements($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0, $noinfoadmin=0, $morecss='') { + // phpcs:enable global $langs, $user, $conf; dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); @@ -3183,6 +3207,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of payment methods * @@ -3197,9 +3222,9 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') { + // phpcs:enable global $langs,$user; dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); @@ -3459,6 +3484,7 @@ class Form return $return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list of bank accounts * @@ -3471,9 +3497,9 @@ class Form * @param int $showcurrency Show currency in label * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='',$showcurrency=0) { + // phpcs:enable global $langs, $conf; $langs->load("admin"); @@ -3563,6 +3589,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of categories having choosed type * @@ -3575,9 +3602,9 @@ class Form * @return string * @see select_categories */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0) { + // phpcs:enable global $conf, $langs; $langs->load("categories"); @@ -3649,6 +3676,7 @@ class Form return $output; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a confirmation HTML form or AJAX popup * @@ -3665,9 +3693,9 @@ class Form * @deprecated * @see formconfirm() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { + // phpcs:enable print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); } @@ -3780,7 +3808,7 @@ class Form { $more.=''.$input['label'].''; $more.=''; - $more.=$this->select_date($input['value'],$input['name'],0,0,0,'',1,0,1); + $more.=$this->selectDate($input['value'],$input['name'],0,0,0,'',1,0); $more.=''."\n"; $formquestion[] = array('name'=>$input['name'].'day'); $formquestion[] = array('name'=>$input['name'].'month'); @@ -3961,6 +3989,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select a project * @@ -3974,9 +4003,9 @@ class Form * @param int $nooutput No print is done. String is returned. * @return string Return html content */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0) { + // phpcs:enable global $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; @@ -4020,6 +4049,7 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select payment conditions * @@ -4029,9 +4059,9 @@ class Form * @param int $addempty Add empty entry * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4054,6 +4084,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select a delivery delay * @@ -4063,9 +4094,9 @@ class Form * @param int $addempty Ajoute entree vide * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_availability($page, $selected='', $htmlname='availability', $addempty=0) { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4129,6 +4160,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form + html select a date * @@ -4139,11 +4171,11 @@ class Form * @param int $displaymin Display minutes selector * @param int $nooutput 1=No print output, return string * @return string - * @see select_date + * @see selectDate */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) { + // phpcs:enable global $langs; $ret=''; @@ -4155,7 +4187,7 @@ class Form $ret.=''; $ret.=''; $ret.=''; $ret.=''; $ret.='
'; - $ret.=$this->select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname,1,0,1); + $ret.=$this->selectDate($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname,1,0); $ret.='
'; @@ -4171,6 +4203,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a select form to choose a user * @@ -4181,9 +4214,9 @@ class Form * @param array $include List of users id to include * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_users($page, $selected='', $htmlname='userid', $exclude='', $include='') { + // phpcs:enable global $langs; if ($htmlname != "none") @@ -4210,6 +4243,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with payment mode * @@ -4220,9 +4254,9 @@ class Form * @param int $active Active or not, -1 = all * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1) { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4245,6 +4279,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with multicurrency code * @@ -4253,9 +4288,9 @@ class Form * @param string $htmlname Name of select html field * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_multicurrency_code($page, $selected='', $htmlname='multicurrency_code') { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4273,6 +4308,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with multicurrency rate * @@ -4282,9 +4318,9 @@ class Form * @param string $currency Currency code to explain the rate * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { + // phpcs:enable global $langs, $mysoc, $conf; if ($htmlname != "none") @@ -4315,6 +4351,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a select box with available absolute discounts * @@ -4330,9 +4367,9 @@ class Form * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0, $discount_type=0) { + // phpcs:enable global $conf,$langs; if ($htmlname != "none") { @@ -4411,6 +4448,7 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show forms to select a contact * @@ -4420,9 +4458,9 @@ class Form * @param string $htmlname Name of HTML select. If 'none', we just show contact link. * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_contacts($page, $societe, $selected='', $htmlname='contactid') { + // phpcs:enable global $langs, $conf; if ($htmlname != "none") @@ -4456,6 +4494,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html select to select thirdparty * @@ -4469,9 +4508,9 @@ class Form * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array()) { + // phpcs:enable global $langs; if ($htmlname != "none") @@ -4499,6 +4538,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste des devises, dans la langue de l'utilisateur * @@ -4506,9 +4546,9 @@ class Form * @param string $htmlname name of HTML select list * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_currency($selected='',$htmlname='currency_id') { + // phpcs:enable print $this->selectCurrency($selected,$htmlname); } @@ -4611,15 +4651,16 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into the cache vat rates of a country * * @param string $country_code Country code with quotes ("'CA'", or "'CA,IN,...'") * @return int Nb of loaded lines, 0 if already loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_vatrates($country_code) { + // phpcs:enable global $langs; $num = count($this->cache_vatrates); @@ -4677,6 +4718,7 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output an HTML select vat rate. * The name of this function should be selectVat. We keep bad name for compatibility purpose. @@ -4698,9 +4740,9 @@ class Form * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0) { + // phpcs:enable global $langs,$conf,$mysoc; $langs->load('errors'); @@ -4865,8 +4907,9 @@ class Form } - /** - * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. * Fields are preselected with : * - set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM') * - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location) @@ -4885,19 +4928,53 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. - * @return string|null Nothing or string if nooutput is 1 - * @see form_date, select_month, select_year, select_dayofweek + * @return string|null Nothing or string if nooutput is 1 + * @deprecated + * @see form_date, select_month, select_year, select_dayofweek */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') + function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') + { + // phpcs:enable + $retstring = $this->selectDate($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof=''); + if (! empty($nooutput)) { + return $retstring; + } + + print $retstring; + return; + } + + /** + * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. + * Fields are preselected with : + * - set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM') + * - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location) + * - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1) + * + * @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). + * @param string $prefix Prefix for fields name + * @param int $h 1 or 2=Show also hours (2=hours on a new line), -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show hour always empty + * @param int $m 1=Show also minutes, -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show minutes always empty + * @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only + * @param string $form_name Not used + * @param int $d 1=Show days, month, years + * @param int $addnowlink Add a link "Now" + * @param int $disabled Disable input fields + * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 + * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. + * @param datetime $adddateof Add a link "Date of invoice" using the following date. + * @return string Html for selectDate + * @see form_date, select_month, select_year, select_dayofweek + */ + function selectDate($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { global $conf,$langs; $retstring=''; - if($prefix=='') $prefix='re'; - if($h == '') $h=0; - if($m == '') $m=0; + if ($prefix=='') $prefix='re'; + if ($h == '') $h=0; + if ($m == '') $m=0; $emptydate=0; $emptyhours=0; if ($empty == 1) { $emptydate=1; $emptyhours=1; } @@ -5235,12 +5312,10 @@ class Form $retstring.=' -
- + + diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 626d30ccd60..f429f7216c0 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2018 Frédéric France * * 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 @@ -481,16 +482,16 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da if (! empty($object->element) && $object->element == 'contrat') { print $langs->trans("DateStartPlanned").' '; - $form->select_date($date_start,"date_start",$usehm,$usehm,1,"addproduct"); + print $form->selectDate($date_start,"date_start",$usehm,$usehm,1,"addproduct"); print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date($date_end,"date_end",$usehm,$usehm,1,"addproduct"); + print $form->selectDate($date_end,"date_end",$usehm,$usehm,1,"addproduct"); } else { echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - echo $form->select_date($date_start,'date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct",1,0,1); + print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); echo ' '.$langs->trans('to').' '; - echo $form->select_date($date_end,'date_end',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct",1,0,1); + print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); }; print ''; + } + print ' '.$langs->trans("AddThirdParty").''; + print ''; + } + print '' . "\n"; + + } + + // Date print ''.$langs->trans("Date").''; - $form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1); + print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1); print ''; - // Amount - print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; + // Amount + print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; + // Public donation print ''.$langs->trans("PublicDonation").""; print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1); print "\n"; - print "".''.$langs->trans("Company").''; - print "".''.$langs->trans("Lastname").''; - print "".''.$langs->trans("Firstname").''; - print "".''.$langs->trans("Address").''; - print ''; + if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES)) + { + print "".''.$langs->trans("Company").''; + print "".''.$langs->trans("Lastname").''; + print "".''.$langs->trans("Firstname").''; + print "".''.$langs->trans("Address").''; + print ''; - // Zip / Town - print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); - print ' '; - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); - print ''; + // Zip / Town + print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); + print ' '; + print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); + print ''; - // Country - print ''; - print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); - print ''; + // Country + print ''; + print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print ''; - print "".''.$langs->trans("EMail").''; + print "".''.$langs->trans("EMail").''; + } // Payment mode print "".$langs->trans("PaymentMode")."\n"; @@ -455,7 +511,7 @@ if (! empty($id) && $action == 'edit') // Date print ''.$langs->trans("Date").''; - $form->select_date($object->date,'','','','',"update"); + print $form->selectDate($object->date,'','','','',"update"); print ''; // Amount @@ -791,6 +847,16 @@ if (! empty($id) && $action != 'edit') $linktoelem = $form->showLinkToObjectBlock($object, null, array('don')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + // Show online payment link + $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); + + if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT && + { + print '
'."\n"; + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + print showOnlinePaymentUrl('donation', $object->ref).'
'; + } + print '
'; print '
'; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index d2039a200cb..0723ecb659a 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -38,38 +38,40 @@ class Don extends CommonObject * @var string ID to identify managed object */ public $element='don'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='don'; - - public $fk_element = 'fk_donation'; - public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $picto = 'generic'; - - var $date; - var $amount; - var $societe; - var $address; - var $zip; - var $town; - var $email; - var $public; - var $fk_project; - var $fk_typepayment; - var $num_payment; - var $date_valid; - var $modepaymentid = 0; - - var $labelstatut; - var $labelstatutshort; /** - * @deprecated - * @see note_private, note_public + * @var int Field with ID of parent key if this field has a parent */ - var $commentaire; + public $fk_element = 'fk_donation'; + + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'generic'; + + public $date; + public $amount; + public $societe; + public $address; + public $zip; + public $town; + public $email; + public $public; + public $fk_project; + public $fk_typepayment; + public $num_payment; + public $date_valid; + public $modepaymentid = 0; + + public $labelstatut; + public $labelstatutshort; /** @@ -79,9 +81,7 @@ class Don extends CommonObject */ function __construct($db) { - global $langs; - - $this->db = $db; + $this->db = $db; } @@ -96,6 +96,7 @@ class Don extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -103,10 +104,10 @@ class Don extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { - if (empty($this->labelstatut) || empty($this->labelstatushort)) + // phpcs:enable + if (empty($this->labelstatut) || empty($this->labelstatutshort)) { global $langs; $langs->load("donations"); @@ -124,44 +125,44 @@ class Don extends CommonObject { return $this->labelstatut[$statut]; } - if ($mode == 1) + elseif ($mode == 1) { return $this->labelstatutshort[$statut]; } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatutshort[$statut]; - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; + elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; + elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; + elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5'); - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); + elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); + elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); + elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatut[$statut]; - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; + elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; + elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; + elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); - if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); + elseif ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); + elseif ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); + elseif ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); - if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); + elseif ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); + elseif ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); + elseif ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } } @@ -375,8 +376,8 @@ class Don extends CommonObject $sql.= ", '".$this->db->escape($this->address)."'"; $sql.= ", '".$this->db->escape($this->zip)."'"; $sql.= ", '".$this->db->escape($this->town)."'"; - $sql.= ", ".$this->country_id; - $sql.= ", ".$this->public; + $sql.= ", ".($this->country_id > 0 ? $this->country_id : '0'); + $sql.= ", ".((int) $this->public); $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null"); $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); @@ -388,7 +389,6 @@ class Don extends CommonObject $sql.= ", '".$this->db->escape($this->phone_mobile)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -424,8 +424,8 @@ class Don extends CommonObject if (!$error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS)) { - $res = $this->setValid($user); - if ($res < 0) $error++; + //$res = $this->setValid($user); + //if ($res < 0) $error++; } if (!$error) @@ -679,7 +679,6 @@ class Don extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf; - $this->commentaire = $obj->note; // deprecated // Retreive all extrafield // fetch optionals attributes and labels @@ -694,6 +693,7 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Validate a promise of donation * @@ -702,9 +702,9 @@ class Don extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function valid_promesse($id, $userid, $notrigger=0) { + // phpcs:enable global $langs, $user; $error=0; @@ -745,6 +745,7 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the donation as paid, the donation was received * @@ -752,9 +753,9 @@ class Don extends CommonObject * @param int $modepayment mode of payment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $modepayment=0) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; if ($modepayment) { @@ -781,15 +782,16 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set donation to status cancelled * * @param int $id id of donation * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($id) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id; $resql=$this->db->query($sql); @@ -811,15 +813,16 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Sum of donations * * @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses * @return int Summ of donations */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function sum_donations($param) { + // phpcs:enable global $conf; $result=0; @@ -839,14 +842,15 @@ class Don extends CommonObject return $result; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 3a839c2e759..69c6e8b5501 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -39,8 +39,14 @@ class PaymentDonation extends CommonObject */ public $table_element='payment_donation'; - public $picto = 'payment'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'payment'; + /** + * @var int ID + */ public $rowid; public $fk_donation; @@ -453,6 +459,7 @@ class PaymentDonation extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -460,10 +467,10 @@ class PaymentDonation extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { - global $langs; + // phpcs:enable + global $langs; return ''; } @@ -577,15 +584,16 @@ class PaymentDonation extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between the donation payment and the generated line in llx_bank * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index d1cfaa6f0ad..e016bb80a8e 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -174,7 +175,7 @@ if (GETPOST('action','aZ09') == 'create') print ''; print ''; print ''; - + dol_fiche_head(); print ''; @@ -205,7 +206,7 @@ if (GETPOST('action','aZ09') == 'create') print '"; print ''; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 6393d201188..f477e27b37b 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -31,13 +31,16 @@ class EcmDirectory // extends CommonObject * @var string ID to identify managed object */ public $element='ecm_directories'; - + /** * @var string Name of table without prefix where object is stored */ //public $table_element='ecm_directories'; - - var $picto = 'dir'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'dir'; /** * @var int ID @@ -45,24 +48,33 @@ class EcmDirectory // extends CommonObject public $id; /** - * @var string proper name for given parameter + * @var string ECM directories label */ public $label; - - var $fk_parent; - var $description; - var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated' - var $date_c; - var $date_m; + + public $fk_parent; + + /** + * @var string description + */ + public $description; + + public $cachenbofdoc=-1; // By default cache initialized with value 'not calculated' + public $date_c; + public $date_m; public $fk_user_m; public $fk_user_c; + + /** + * @var string Ref + */ public $ref; - var $cats=array(); - var $motherof=array(); + public $cats=array(); + public $motherof=array(); - var $forbiddenchars = array('<','>',':','/','\\','?','*','|','"'); - var $forbiddencharsdir = array('<','>',':','?','*','|','"'); + public $forbiddenchars = array('<','>',':','/','\\','?','*','|','"'); + public $forbiddencharsdir = array('<','>',':','?','*','|','"'); public $full_arbo_loaded; @@ -70,7 +82,7 @@ class EcmDirectory // extends CommonObject * @var string Error code (or message) */ public $error; - + /** * @var string[] Error codes (or messages) */ @@ -512,14 +524,15 @@ class EcmDirectory // extends CommonObject return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load this->motherof that is array(id_son=>id_parent, ...) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_motherof() { + // phpcs:enable global $conf; $this->motherof=array(); @@ -560,6 +573,7 @@ class EcmDirectory // extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -567,14 +581,15 @@ class EcmDirectory // extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: @@ -594,9 +609,9 @@ class EcmDirectory // extends CommonObject * @param int $force Force reload of full arbo even if already loaded in cache $this->cats * @return array Tableau de array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($force=0) { + // phpcs:enable global $conf; if (empty($force) && ! empty($this->full_arbo_loaded)) @@ -676,6 +691,7 @@ class EcmDirectory // extends CommonObject return $this->cats; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs. * Separator between directories is always '/', whatever is OS. @@ -684,9 +700,9 @@ class EcmDirectory // extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=0) { + // phpcs:enable // Define fullpath if (! empty($this->cats[$id_categ]['id_mere'])) { @@ -761,6 +777,7 @@ class EcmDirectory // extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Call trigger based on this instance * @@ -772,9 +789,9 @@ class EcmDirectory // extends CommonObject * @param User $user Object user * @return int Result of run_triggers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { + // phpcs:enable global $langs,$conf; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 95d4b42a4b6..54077a68de6 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -40,22 +40,39 @@ class EcmFiles extends CommonObject * @var string Id to identify managed objects */ public $element = 'ecmfiles'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'ecm_files'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'generic'; - public $ref; // hash of file path + /** + * @var string Ref hash of file path + */ + public $ref; + public $label; // hash of file content (md5_file(dol_osencode($destfull)) public $share; // hash for file sharing, empty by default (example: getRandomPassword(true)) + + /** + * @var int Entity + */ public $entity; + public $filename; public $filepath; public $fullpath_orig; + + /** + * @var string description + */ public $description; + public $keywords; public $cover; public $position; @@ -68,7 +85,7 @@ class EcmFiles extends CommonObject public $acl; public $src_object_type; public $src_object_id; - + /** * Constructor @@ -779,6 +796,7 @@ class EcmFiles extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -786,9 +804,9 @@ class EcmFiles extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; } @@ -831,11 +849,21 @@ class EcmFiles extends CommonObject class EcmfilesLine { public $label; + + /** + * @var int Entity + */ public $entity; + public $filename; public $filepath; public $fullpath_orig; + + /** + * @var string description + */ public $description; + public $keywords; public $cover; public $position; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7270fec52cc..a811b79b9ca 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -9,8 +9,9 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2016 Yasser Carreón + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -974,7 +975,7 @@ if ($action == 'create') print '\n"; print ''; @@ -1041,7 +1042,7 @@ if ($action == 'create') if ($object->fetch_optionals() > 0) { $expe->array_options = array_merge($expe->array_options, $object->array_options); } - print $object->showOptionals($extrafields, 'edit'); + print $expe->showOptionals($extrafields, 'edit'); } @@ -1797,7 +1798,7 @@ else if ($id || $ref) print ''; print ''; print ''; - print $form->select_date($object->date_delivery?$object->date_delivery:-1,'liv_',1,1,'',"setdate_livraison",1,0,1); + print $form->selectDate($object->date_delivery?$object->date_delivery:-1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print ''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index c666bbf4c37..ec55363a483 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -56,53 +56,65 @@ class Expedition extends CommonObject */ public $table_element="expedition"; + /** + * @var int Name of subtable line + */ public $table_element_line="expeditiondet"; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'sending'; - var $socid; - var $ref_customer; - var $ref_int; - var $brouillon; - var $entrepot_id; - var $lines=array(); - var $tracking_number; - var $tracking_url; - var $billed; - var $model_pdf; + public $socid; + public $ref_customer; + public $ref_int; + public $brouillon; + public $entrepot_id; + public $lines=array(); + public $tracking_number; + public $tracking_url; + public $billed; + public $model_pdf; - var $trueWeight; - var $weight_units; - var $trueWidth; - var $width_units; - var $trueHeight; - var $height_units; - var $trueDepth; - var $depth_units; + public $trueWeight; + public $weight_units; + public $trueWidth; + public $width_units; + public $trueHeight; + public $height_units; + public $trueDepth; + public $depth_units; // A denormalized value - var $trueSize; + public $trueSize; + + public $date_delivery; // Date delivery planed - var $date_delivery; // Date delivery planed /** * @deprecated * @see date_shipping */ - var $date; + public $date; + /** * @deprecated * @see date_shipping */ - var $date_expedition; + public $date_expedition; + /** * Effective delivery date * @var int */ public $date_shipping; - var $date_creation; - var $date_valid; - var $meths; - var $listmeths; // List of carriers + public $date_creation; + public $date_valid; + + public $meths; + public $listmeths; // List of carriers const STATUS_DRAFT = 0; @@ -380,6 +392,7 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a expedition line * @@ -389,9 +402,9 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, line_id if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) { + //phpcs:enable $expeditionline = new ExpeditionLigne($this->db); $expeditionline->fk_expedition = $this->id; $expeditionline->entrepot_id = $entrepot_id; @@ -407,6 +420,7 @@ class Expedition extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create the detail (eat-by date) of the expedition line * @@ -414,9 +428,9 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line_batch($line_ext,$array_options=0) { + // phpcs:enable $error = 0; $stockLocationQty = array(); // associated array with batch qty in stock location @@ -807,15 +821,16 @@ class Expedition extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a delivery receipt from a shipment * * @param User $user User * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_delivery($user) { + // phpcs:enable global $conf; if ($conf->livraison_bon->enabled) @@ -915,6 +930,7 @@ class Expedition extends CommonObject $this->lines[$num] = $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a shipment line with batch record * @@ -922,9 +938,9 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function addline_batch($dbatch,$array_options=0) { + // phpcs:enable global $conf,$langs; $num = count($this->lines); @@ -1303,14 +1319,15 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load lines * * @return int >0 if OK, Otherwise if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable global $conf, $mysoc; // TODO: recuperer les champs du document associe a part @@ -1590,6 +1607,7 @@ class Expedition extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1597,9 +1615,9 @@ class Expedition extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; if ($mode==0) @@ -1713,6 +1731,7 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the planned delivery date * @@ -1720,9 +1739,9 @@ class Expedition extends CommonObject * @param timestamp $date_livraison Date de livraison * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { + // phpcs:enable if ($user->rights->expedition->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; @@ -1748,14 +1767,15 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch deliveries method and return an array. Load array this->meths(rowid=>label). * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_delivery_methods() { + // phpcs:enable global $langs; $this->meths = array(); @@ -1775,15 +1795,16 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch all deliveries method and return an array. Load array this->listmeths. * * @param id $id only this carrier, all if none * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_delivery_methods($id='') { + // phpcs:enable global $langs; $this->listmeths = array(); @@ -1810,6 +1831,7 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update/create delivery method. * @@ -1817,9 +1839,9 @@ class Expedition extends CommonObject * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_delivery_method($id='') { + // phpcs:enable if ($id=='') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; @@ -1839,6 +1861,7 @@ class Expedition extends CommonObject if ($resql < 0) dol_print_error($this->db,''); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate delivery method. * @@ -1846,15 +1869,16 @@ class Expedition extends CommonObject * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function activ_delivery_method($id) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1'; $sql.= ' WHERE rowid='.$id; $resql = $this->db->query($sql); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * DesActivate delivery method. * @@ -1862,9 +1886,9 @@ class Expedition extends CommonObject * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function disable_delivery_method($id) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0'; $sql.= ' WHERE rowid='.$id; @@ -1872,15 +1896,16 @@ class Expedition extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Forge an set tracking url * * @param string $value Value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetUrlTrackingStatus($value='') { + // phpcs:enable if (! empty($this->shipping_method_id)) { $sql = "SELECT em.code, em.tracking"; @@ -2058,14 +2083,15 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_billed() { + // phpcs:enable global $user; $error=0; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 4675680368f..24ccda21579 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2015 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -370,7 +371,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; print ''; - $form->select_date($object->date_livraison>0?$object->date_livraison:-1,'liv_','','','',"setdatedelivery"); + print $form->selectDate($object->date_livraison>0?$object->date_livraison:-1, 'liv_', '', '', '', "setdatedelivery"); print ''; print ''; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 75285bf35cf..064d92a10c4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015-2017 Alexandre Spangaro - * Copyright (C) 2017 Ferran Marcet +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1335,7 +1336,7 @@ if ($action == 'create') print '
'; print ''; print ''; print ''; @@ -1343,7 +1344,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; @@ -1500,13 +1501,13 @@ else print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; @@ -2078,7 +2079,7 @@ else // Select date print ''; // Select project @@ -2161,7 +2162,7 @@ else // Select date print ''; // Select project diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 7ccb88d82ee..53ac035c0be 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -147,7 +147,7 @@ class ExpenseReport extends CommonObject // List of language codes for status $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut8'); + $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut5'); return 1; } @@ -547,6 +547,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the expense report as paid * @@ -555,9 +556,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $fuser, $notrigger = 0) { + // phpcs:enable $error = 0; $this->db->begin(); @@ -619,6 +620,7 @@ class ExpenseReport extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -626,30 +628,30 @@ class ExpenseReport extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) return $langs->transnoentities($this->statuts[$status]); - if ($mode == 1) + elseif ($mode == 1) return $langs->transnoentities($this->statuts_short[$status]); - if ($mode == 2) + elseif ($mode == 2) return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]); - if ($mode == 3) + elseif ($mode == 3) return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - if ($mode == 4) + elseif ($mode == 4) return img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]); - if ($mode == 5) + elseif ($mode == 5) return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); - if ($mode == 6) + elseif ($mode == 6) return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); } @@ -794,6 +796,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_line_by_project * @@ -801,9 +804,9 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_line_by_project($projectid,$user='') { + // phpcs:enable global $conf,$db,$langs; $langs->load('trips'); @@ -951,14 +954,15 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_lines * * @return int <0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; @@ -1195,15 +1199,16 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_save_from_refuse * * @param User $fuser User * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_save_from_refuse($fuser) { + // phpcs:enable global $conf,$langs; // Sélection de la date de début de la NDF @@ -1368,6 +1373,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_unpaid * @@ -1375,9 +1381,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($fuser, $notrigger = 0) { + // phpcs:enable $error = 0; if ($this->fk_c_deplacement_statuts != 5) @@ -1428,6 +1434,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_cancel * @@ -1436,9 +1443,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($fuser,$detail, $notrigger=0) { + // phpcs:enable $error = 0; $this->date_cancel = $this->db->idate(gmmktime()); if ($this->fk_statut != 4) @@ -1613,6 +1620,7 @@ class ExpenseReport extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you add a line. * @@ -1620,9 +1628,9 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_add($ligne_total_ht,$ligne_total_tva) { + // phpcs:enable $this->total_ht = $this->total_ht + $ligne_total_ht; $this->total_tva = $this->total_tva + $ligne_total_tva; $this->total_ttc = $this->total_ht + $this->total_tva; @@ -1642,6 +1650,7 @@ class ExpenseReport extends CommonObject endif; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you delete a line. * @@ -1649,9 +1658,9 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_del($ligne_total_ht,$ligne_total_tva) { + // phpcs:enable $this->total_ht = $this->total_ht - $ligne_total_ht; $this->total_tva = $this->total_tva - $ligne_total_tva; $this->total_ttc = $this->total_ht + $this->total_tva; @@ -2058,6 +2067,7 @@ class ExpenseReport extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * periode_existe * @@ -2066,9 +2076,9 @@ class ExpenseReport extends CommonObject * @param Date $date_fin End date * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function periode_existe($fuser, $date_debut, $date_fin) { + // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE fk_user_author = '{$fuser->id}'"; @@ -2115,15 +2125,16 @@ class ExpenseReport extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of people with permission to validate expense reports. * Search for permission "approve expense report" * * @return array Array of user ids */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_expensereport() { + // phpcs:enable $users_validator=array(); $sql = "SELECT DISTINCT ur.fk_user"; @@ -2222,14 +2233,15 @@ class ExpenseReport extends CommonObject return $ret; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); @@ -2257,6 +2269,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2264,9 +2277,9 @@ class ExpenseReport extends CommonObject * @param string $option 'topay' or 'toapprove' * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $option='topay') { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -2696,6 +2709,7 @@ class ExpenseReportLine } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des differents etats d'une note de frais. * Les valeurs de la liste sont les id de la table c_expensereport_statuts @@ -2706,9 +2720,9 @@ class ExpenseReportLine * @param int $useshortlabel Use short labels * @return string HTML select with status */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1, $useshortlabel=0) { + // phpcs:enable global $db, $langs; $tmpep=new ExpenseReport($db); @@ -2733,6 +2747,7 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt print ''; } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of notes with select value = id * @@ -2742,9 +2757,9 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt * @param int $active 1=Active only, 0=Unactive only, -1=All * @return string Select html */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees_id($selected='',$htmlname='type',$showempty=0, $active=1) { + // phpcs:enable global $db,$langs,$user; $langs->load("trips"); diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 0dceeae4808..f2275676049 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -40,24 +40,27 @@ class PaymentExpenseReport extends CommonObject */ public $table_element='payment_expensereport'; - public $picto = 'payment'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'payment'; - var $rowid; + public $rowid; - var $fk_expensereport; - var $datec=''; - var $tms=''; - var $datep=''; - var $amount; // Total amount of payment - var $amounts=array(); // Array of amounts - var $fk_typepayment; - var $num_payment; - var $fk_bank; - var $fk_user_creat; - var $fk_user_modif; + public $fk_expensereport; + public $datec=''; + public $tms=''; + public $datep=''; + public $amount; // Total amount of payment + public $amounts=array(); // Array of amounts + public $fk_typepayment; + public $num_payment; + public $fk_bank; + public $fk_user_creat; + public $fk_user_modif; //Unknow field - var $chid; - var $total; + public $chid; + public $total; /** * Constructor @@ -450,16 +453,17 @@ class PaymentExpenseReport extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $statut Id statut * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; return ''; @@ -604,15 +608,16 @@ class PaymentExpenseReport extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between the expense report payment and the generated line in llx_bank * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php index 8ea72191b1d..f018a23e478 100644 --- a/htdocs/expensereport/export_csv.php +++ b/htdocs/expensereport/export_csv.php @@ -1,5 +1,6 @@ + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,7 +115,7 @@ if (isset($_POST['action'])) { if($_POST['action'] == 'export') { - $select_date = $_POST['annee'].'-'.$_POST['mois']; + $dateselected = $_POST['annee'].'-'.$_POST['mois']; //var_dump($conf->expensereport->dir_output.'/export/'); if (!file_exists($conf->expensereport->dir_output.'/export/')) @@ -122,7 +123,7 @@ if (isset($_POST['action'])) dol_mkdir($conf->expensereport->dir_output.'/export/'); } - $dir = $conf->expensereport->dir_output.'/export/expensereport-'.$select_date.'.csv'; + $dir = $conf->expensereport->dir_output.'/export/expensereport-'.$dateselected.'.csv'; $outputlangs = $langs; $outputlangs->charset_output = 'UTF-8'; @@ -183,7 +184,7 @@ if (isset($_POST['action'])) fwrite($open,$ligne); fclose($open); - print 'Télécharger le fichier expensereport-'.$select_date.'.csv'; + print 'Télécharger le fichier expensereport-'.$dateselected.'.csv'; } else { diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index dc78b933055..5136dff3cce 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -1,6 +1,7 @@ - * Copyright (C) 2015 Laurent Destailleur +/* Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -235,7 +236,7 @@ if ($action == 'create' || empty($action)) print '"; print ''; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index fd685ad74fd..46d21eba031 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -70,6 +70,7 @@ class Export } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load an exportable dataset * @@ -77,9 +78,9 @@ class Export * @param string $filter Load a particular dataset only * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_arrays($user,$filter='') { + // phpcs:enable global $langs,$conf,$mysoc; dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); @@ -208,6 +209,7 @@ class Export } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the sql export request. * Arrays this->array_export_xxx are already loaded for required datatoexport @@ -217,9 +219,9 @@ class Export * @param array $array_filterValue Filter records on array of value for fields * @return string SQL String. Example "select s.rowid as r_rowid, s.status as s_status from ..." */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_sql($indice, $array_selected, $array_filterValue) { + // phpcs:enable // Build the sql request $sql=$this->array_export_sql_start[$indice]; $i=0; @@ -271,6 +273,7 @@ class Export return $sql; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the conditionnal string from filter the query * @@ -279,9 +282,9 @@ class Export * @param string $ValueField Value of the field for filter. Must not be '' * @return string sql string of then field ex : "field='xxx'>" */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_filterQuery($TypeField, $NameField, $ValueField) { + // phpcs:enable //print $TypeField." ".$NameField." ".$ValueField; $InfoFieldList = explode(":", $TypeField); // build the input field on depend of the type of file @@ -365,6 +368,7 @@ class Export return $Condition; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build an input field used to filter the query * @@ -373,9 +377,9 @@ class Export * @param string $ValueField Initial value of the field to filter * @return string html string of the input field ex : "" */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_filterField($TypeField, $NameField, $ValueField) { + // phpcs:enable global $conf,$langs; $szFilterField=''; @@ -514,6 +518,7 @@ class Export return $szMsg; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build export file. * File is built into directory $conf->export->dir_temp.'/'.$user->id @@ -527,9 +532,9 @@ class Export * @param string $sqlquery If set, transmit the sql request for select (otherwise, sql request is generated from arrays) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '') { + // phpcs:enable global $conf,$langs; $indice=0; @@ -825,15 +830,16 @@ class Export } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output list all export models * TODO Move this into a class htmlxxx.class.php * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_export_model() { + // phpcs:enable global $conf, $langs; $sql = "SELECT em.rowid, em.field, em.label, em.type, em.filter"; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index d084f9be546..b32bb39185b 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -8,6 +8,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016-2018 Charlie Benke + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -357,7 +358,7 @@ if ($action == 'create') { $date_next_execution = (GETPOST('remonth') ? dol_mktime( 12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear') ) : -1); - print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1); + print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1); print ""; // Number max of generation diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index c5ff6d18ddc..75866d586f6 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1490,8 +1490,11 @@ else if ($id > 0 || ! empty($ref)) // Date d'intervention print ''; // Duration @@ -1556,18 +1559,25 @@ else if ($id > 0 || ! empty($ref)) print ''; // Duration print ''; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 9c40dad3d0c..4c66b192c95 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -39,14 +39,25 @@ class Fichinter extends CommonObject * @var string ID to identify managed object */ public $element='fichinter'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='fichinter'; - + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_fichinter'; + + /** + * @var int Name of subtable line + */ public $table_element_line='fichinterdet'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'intervention'; /** @@ -54,36 +65,44 @@ class Fichinter extends CommonObject */ protected $table_ref_field = 'ref'; - var $socid; // Id client + public $socid; // Id client - var $author; - var $datec; - var $datev; - var $dateo; - var $datee; - var $datet; - var $datem; - var $duration; - var $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate - var $description; - var $fk_contrat = 0; - var $fk_project = 0; - var $extraparams=array(); + public $author; + public $datec; + public $datev; + public $dateo; + public $datee; + public $datet; + public $datem; + public $duration; + public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate - var $lines = array(); + /** + * @var string description + */ + public $description; + + public $fk_contrat = 0; + public $fk_project = 0; + public $extraparams=array(); + + public $lines = array(); /** * Draft status */ const STATUS_DRAFT = 0; + /** * Validated status */ const STATUS_VALIDATED = 1; + /** * Billed */ const STATUS_BILLED = 2; + /** * Closed */ @@ -101,14 +120,15 @@ class Fichinter extends CommonObject $this->products = array(); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators into this->nb for board * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -630,6 +650,7 @@ class Fichinter extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -637,9 +658,9 @@ class Fichinter extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable // Init/load array of translation of status if (empty($this->statuts) || empty($this->statuts_short)) { @@ -662,17 +683,17 @@ class Fichinter extends CommonObject if ($mode == 0) return $this->statuts[$statut]; - if ($mode == 1) + elseif ($mode == 1) return $this->statuts_short[$statut]; - if ($mode == 2) + elseif ($mode == 2) return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts_short[$statut]; - if ($mode == 3) + elseif ($mode == 3) return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]); - if ($mode == 4) + elseif ($mode == 4) return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts[$statut]; - if ($mode == 5) + elseif ($mode == 5) return ''.$this->statuts_short[$statut].' '.img_picto($this->statuts[$statut],$this->statuts_logo[$statut]); - if ($mode == 6) + elseif ($mode == 6) return ''.$this->statuts[$statut].' '.img_picto($this->statuts[$statut],$this->statuts_logo[$statut]); return ''; @@ -973,6 +994,7 @@ class Fichinter extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Defines a delivery date of intervention * @@ -980,9 +1002,9 @@ class Fichinter extends CommonObject * @param date $date_delivery date of delivery * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_delivery($user, $date_delivery) { + // phpcs:enable global $conf; if ($user->rights->ficheinter->creer) @@ -1006,6 +1028,7 @@ class Fichinter extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define the label of the intervention * @@ -1013,9 +1036,9 @@ class Fichinter extends CommonObject * @param string $description description * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_description($user, $description) { + // phpcs:enable global $conf; if ($user->rights->ficheinter->creer) @@ -1040,6 +1063,7 @@ class Fichinter extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link intervention to a contract * @@ -1047,9 +1071,9 @@ class Fichinter extends CommonObject * @param int $contractid Description * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_contrat($user, $contractid) { + // phpcs:enable global $conf; if ($user->rights->ficheinter->creer) @@ -1249,14 +1273,15 @@ class Fichinter extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array lines ->lines * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines = array(); $sql = 'SELECT rowid, description, duree, date, rang'; @@ -1326,35 +1351,38 @@ class FichinterLigne extends CommonObjectLine * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; // From llx_fichinterdet - var $fk_fichinter; - var $desc; // Description ligne - var $datei; // Date intervention - var $duration; // Duree de l'intervention - var $rang = 0; + public $fk_fichinter; + public $desc; // Description ligne + public $datei; // Date intervention + public $duration; // Duree de l'intervention + public $rang = 0; /** * @var string ID to identify managed object */ public $element='fichinterdet'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='fichinterdet'; - + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_fichinter'; /** - * Constructor + * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ function __construct($db) { @@ -1561,14 +1589,15 @@ class FichinterLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total duration into llx_fichinter * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable global $conf; $this->db->begin(); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 0cb9f9350cf..92498e99589 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -109,7 +109,7 @@ if (empty($reshook)) if ($action == 'setsupplier_order_min_amount') { $object->fetch($id); - $object->supplier_order_min_amount=GETPOST('supplier_order_min_amount'); + $object->supplier_order_min_amount=price2num(GETPOST('supplier_order_min_amount','alpha')); $result=$object->update($object->id, $user); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } @@ -298,15 +298,17 @@ if ($object->id > 0) print ''; print ''; - print ''; - print ''; - print ''; + if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) + { + print ''; + print ''; + print ''; + } // Categories if (! empty($conf->categorie->enabled)) diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 66f0c730938..878f4bee67e 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -102,14 +102,15 @@ class Fournisseur extends Societe } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load statistics indicators * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -144,6 +145,7 @@ class Fournisseur extends Societe } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a supplier category * @@ -151,9 +153,9 @@ class Fournisseur extends Societe * @param string $name Category name * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function CreateCategory($user, $name) { + // phpcs:enable $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label,visible,type)"; $sql.= " VALUES "; $sql.= " ('".$this->db->escape($name)."',1,1)"; @@ -173,14 +175,15 @@ class Fournisseur extends Societe } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the suppliers list * * @return array Array of suppliers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ListArray() { + // phpcs:enable global $conf; global $user; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5e4a18c32b3..0ef569f3304 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -4,11 +4,11 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2010-2016 Philippe Grand + * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -50,8 +50,16 @@ class CommandeFournisseur extends CommonOrder */ public $table_element='commande_fournisseur'; - public $table_element_line = 'commande_fournisseurdet'; - public $fk_element = 'fk_commande'; + /** + * @var int Name of subtable line + */ + public $table_element_line = 'commande_fournisseurdet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element = 'fk_commande'; + public $picto='order'; /** @@ -71,7 +79,10 @@ class CommandeFournisseur extends CommonOrder */ protected $table_ref_field = 'ref'; - public $id; + /** + * @var int ID + */ + public $id; /** * Supplier order reference @@ -100,17 +111,20 @@ class CommandeFournisseur extends CommonOrder * Delivery date */ public $date_livraison; + public $total_ht; public $total_tva; public $total_localtax1; // Total Local tax 1 public $total_localtax2; // Total Local tax 2 public $total_ttc; public $source; + /** * @deprecated * @see note_private, note_public */ public $note; + public $note_private; public $note_public; public $model_pdf; @@ -136,6 +150,7 @@ class CommandeFournisseur extends CommonOrder * @var CommandeFournisseurLigne[] */ public $lines = array(); + //Add for supplier_proposal public $origin; public $origin_id; @@ -153,34 +168,42 @@ class CommandeFournisseur extends CommonOrder * Draft status */ const STATUS_DRAFT = 0; + /** * Validated status */ const STATUS_VALIDATED = 1; + /** * Accepted */ const STATUS_ACCEPTED = 2; + /** * Order sent, shipment on process */ const STATUS_ORDERSENT = 3; + /** * Received partially */ const STATUS_RECEIVED_PARTIALLY = 4; + /** * Received completely */ const STATUS_RECEIVED_COMPLETELY = 5; + /** * Order canceled */ const STATUS_CANCELED = 6; + /** * Order canceled/never received */ const STATUS_CANCELED_AFTER_ORDER = 7; + /** * Refused */ @@ -336,15 +359,16 @@ class CommandeFournisseur extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { + // phpcs:enable //$result=$this->fetch_lines(); $this->lines=array(); @@ -576,6 +600,7 @@ class CommandeFournisseur extends CommonOrder return $this->LibStatut($this->statut,$mode,$this->billed); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -584,9 +609,9 @@ class CommandeFournisseur extends CommonOrder * @param int $billed 1=Billed * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$billed=0) { + // phpcs:enable global $conf, $langs; if (empty($this->statuts) || empty($this->statutshort)) @@ -1039,6 +1064,7 @@ class CommandeFournisseur extends CommonOrder return $result ; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Cancel an approved order. * The cancellation is done after approval @@ -1047,9 +1073,9 @@ class CommandeFournisseur extends CommonOrder * @param int $idwarehouse Id warehouse to use for stock change (not used for supplier orders). * @return int >0 if Ok, <0 if Ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Cancel($user, $idwarehouse=-1) { + // phpcs:enable global $langs,$conf; $error=0; @@ -1101,6 +1127,7 @@ class CommandeFournisseur extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Submit a supplier order to supplier * @@ -1110,9 +1137,9 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps public function commande($user, $date, $methode, $comment='') { + // phpcs:enable global $langs; dol_syslog(get_class($this)."::commande"); $error = 0; @@ -1960,14 +1987,15 @@ class CommandeFournisseur extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get list of order methods * * @return 0 if Ok, <0 if Ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_methodes_commande() { + // phpcs:enable $sql = "SELECT rowid, libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method"; $sql.= " WHERE active = 1"; @@ -2046,6 +2074,7 @@ class CommandeFournisseur extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set a delivery in database for this supplier order * @@ -2055,9 +2084,9 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Livraison($user, $date, $type, $comment) { + // phpcs:enable global $conf, $langs; $result = 0; @@ -2163,7 +2192,8 @@ class CommandeFournisseur extends CommonOrder return $result ; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Set the planned delivery date * * @param User $user Objet user making change @@ -2171,9 +2201,9 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { + // phpcs:enable if ($user->rights->fournisseur->commande->creer) { $error=0; @@ -2228,6 +2258,7 @@ class CommandeFournisseur extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the id projet * @@ -2236,9 +2267,9 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_id_projet($user, $id_projet, $notrigger=0) { + // phpcs:enable if ($user->rights->fournisseur->commande->creer) { $error=0; @@ -2688,14 +2719,15 @@ class CommandeFournisseur extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -2730,15 +2762,16 @@ class CommandeFournisseur extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 10bf73b015c..906e9bb1377 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -60,14 +60,22 @@ class CommandeFournisseurDispatch extends CommonObject public $table_element='commande_fournisseur_dispatch'; //!< Name of table without prefix where object is stored public $lines=array(); - public $id; + /** + * @var int ID + */ + public $id; public $fk_commande; public $fk_product; public $fk_commandefourndet; public $qty; public $fk_entrepot; + + /** + * @var int User ID + */ public $fk_user; + public $datec=''; public $comment; public $status; @@ -479,6 +487,7 @@ class CommandeFournisseurDispatch extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -486,9 +495,9 @@ class CommandeFournisseurDispatch extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('orders'); @@ -496,27 +505,27 @@ class CommandeFournisseurDispatch extends CommonObject { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statutshort[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f9f352c1f70..e3943ed7415 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2017 Juanjo Menent - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2015 Bahfir Abbes @@ -51,8 +51,16 @@ class FactureFournisseur extends CommonInvoice */ public $table_element='facture_fourn'; - public $table_element_line='facture_fourn_det'; - public $fk_element='fk_facture_fourn'; + /** + * @var int Name of subtable line + */ + public $table_element_line='facture_fourn_det'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element='fk_facture_fourn'; + public $picto='bill'; /** @@ -72,8 +80,16 @@ class FactureFournisseur extends CommonInvoice */ protected $table_ref_field = 'ref'; - public $rowid; - public $ref; + /** + * @var int ID + */ + public $rowid; + + /** + * @var string Ref + */ + public $ref; + public $product_ref; public $ref_supplier; public $socid; @@ -131,6 +147,7 @@ class FactureFournisseur extends CommonInvoice * @var SupplierInvoiceLine[] */ public $lines = array(); + /** * @deprecated */ @@ -668,14 +685,15 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load this->lines * * @return int 1 si ok, < 0 si erreur */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines = array(); $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; @@ -894,15 +912,16 @@ class FactureFournisseur extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) * * @param int $idremise Id of absolute discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1146,17 +1165,18 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Tag invoice as a payed invoice + * Tag invoice as a payed invoice * * @param User $user Object user * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet. Not implementd yet. * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet. * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user, $close_code='', $close_note='') { + // phpcs:enable global $conf,$langs; $error=0; @@ -1195,6 +1215,7 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Fonction utilisee quand un paiement prelevement est refuse, @@ -1203,9 +1224,9 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that change status * @return int <0 si ok, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { + // phpcs:enable global $conf,$langs; $error=0; @@ -1407,6 +1428,7 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -1414,9 +1436,9 @@ class FactureFournisseur extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $idwarehouse=-1) { + // phpcs:enable global $conf,$langs; $error=0; @@ -1972,16 +1994,17 @@ class FactureFournisseur extends CommonInvoice } } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Renvoi liste des factures remplacables * Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee * * @param int $socid Id societe * @return array Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_replacable_supplier_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -2019,6 +2042,7 @@ class FactureFournisseur extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi liste des factures qualifiables pour correction par avoir * Les factures qui respectent les regles suivantes sont retournees: @@ -2027,9 +2051,9 @@ class FactureFournisseur extends CommonInvoice * @param int $socid Id societe * @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_qualified_avoir_supplier_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -2070,15 +2094,16 @@ class FactureFournisseur extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut'; @@ -2100,7 +2125,7 @@ class FactureFournisseur extends CommonInvoice $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); - $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=suppliers_bills'; + $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills'; $response->img=img_object($langs->trans("Bills"),"bill"); $facturestatic = new FactureFournisseur($this->db); @@ -2367,14 +2392,15 @@ class FactureFournisseur extends CommonInvoice $this->total_ttc = $xnbp*119.6; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -3106,14 +3132,16 @@ class SupplierInvoiceLine extends CommonObjectLine return -2; } } - /** + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Mise a jour de l'objet ligne de commande en base * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 77a31689237..f97a6c4f4ba 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -41,52 +41,52 @@ class ProductFournisseur extends Product * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - var $product_fourn_price_id; // id of ligne product-supplier + public $product_fourn_price_id; // id of ligne product-supplier /** * @var int ID */ public $id; - + /** * @deprecated * @see ref_supplier */ - var $fourn_ref; - var $delivery_time_days; - var $ref_supplier; // ref supplier (can be set by get_buyprice) - var $desc_supplier; - var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) + public $fourn_ref; + public $delivery_time_days; + public $ref_supplier; // ref supplier (can be set by get_buyprice) + public $desc_supplier; + public $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) - var $fourn_id; //supplier id - var $fourn_qty; // quantity for price (can be set by get_buyprice) - var $fourn_pu; // unit price for quantity (can be set by get_buyprice) + public $fourn_id; //supplier id + public $fourn_qty; // quantity for price (can be set by get_buyprice) + public $fourn_pu; // unit price for quantity (can be set by get_buyprice) - var $fourn_price; // price for quantity - var $fourn_remise_percent; // discount for quantity (percent) - var $fourn_remise; // discount for quantity (amount) - var $product_fourn_id; // supplier id - var $fk_availability; // availability delay - visible/used if option FOURN_PRODUCT_AVAILABILITY is on (duplicate information compared to delivery delay) - var $fourn_unitprice; - var $fourn_tva_tx; - var $fourn_tva_npr; + public $fourn_price; // price for quantity + public $fourn_remise_percent; // discount for quantity (percent) + public $fourn_remise; // discount for quantity (amount) + public $product_fourn_id; // supplier id + public $fk_availability; // availability delay - visible/used if option FOURN_PRODUCT_AVAILABILITY is on (duplicate information compared to delivery delay) + public $fourn_unitprice; + public $fourn_tva_tx; + public $fourn_tva_npr; - var $fk_supplier_price_expression; - var $supplier_reputation; // reputation of supplier - var $reputations=array(); // list of available supplier reputations + public $fk_supplier_price_expression; + public $supplier_reputation; // reputation of supplier + public $reputations=array(); // list of available supplier reputations // Multicurreny - var $fourn_multicurrency_id; - var $fourn_multicurrency_code; - var $fourn_multicurrency_tx; - var $fourn_multicurrency_price; - var $fourn_multicurrency_unitprice; + public $fourn_multicurrency_id; + public $fourn_multicurrency_code; + public $fourn_multicurrency_tx; + public $fourn_multicurrency_price; + public $fourn_multicurrency_unitprice; /** * Constructor @@ -104,15 +104,16 @@ class ProductFournisseur extends Product + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove all prices for this couple supplier-product * * @param int $id_fourn Supplier Id * @return int < 0 if error, > 0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_fournisseur($id_fourn) { + // phpcs:enable $ok=1; $this->db->begin(); @@ -141,15 +142,16 @@ class ProductFournisseur extends Product } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a price for a couple supplier-product * * @param int $rowid Line id of price * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_product_fournisseur_price($rowid) { + // phpcs:enable global $conf, $user; $error=0; @@ -186,6 +188,7 @@ class ProductFournisseur extends Product } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Modify the purchase price for a supplier * @@ -212,9 +215,9 @@ class ProductFournisseur extends Product * @param string $desc_fourn Custom description for product_fourn_price * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='', $localtaxes_array=array(), $newdefaultvatcode='', $multicurrency_buyprice=0, $multicurrency_price_base_type='HT',$multicurrency_tx=1,$multicurrency_code='', $desc_fourn='') { + // phpcs:enable global $conf, $langs; //global $mysoc; @@ -441,6 +444,7 @@ class ProductFournisseur extends Product } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Loads the price information of a provider * @@ -448,9 +452,9 @@ class ProductFournisseur extends Product * @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) { + // phpcs:enable global $conf; $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.info_bits as fourn_tva_npr, pfp.fk_availability,"; @@ -529,6 +533,7 @@ class ProductFournisseur extends Product } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List all supplier prices of a product * @@ -539,9 +544,9 @@ class ProductFournisseur extends Product * @param int $offset Offset * @return array Array of Products with new properties to define supplier price */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $limit=0, $offset=0) { + // phpcs:enable global $conf; $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; @@ -630,6 +635,7 @@ class ProductFournisseur extends Product } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load properties for minimum price * @@ -638,9 +644,9 @@ class ProductFournisseur extends Product * @param int $socid get min price for specific supplier * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0) { + // phpcs:enable global $conf; if (empty($prodid)) @@ -818,6 +824,7 @@ class ProductFournisseur extends Product return $thirdparty->getNomUrl($withpicto,$option,$maxlen,$notooltip); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display price of product * @@ -829,9 +836,9 @@ class ProductFournisseur extends Product * to display in table format. * @return string String with supplier price */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { + // phpcs:enable global $langs; $out = ''; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 19a8705aa42..fcf7332dbd0 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -39,12 +39,12 @@ class PaiementFourn extends Paiement * @var string ID to identify managed object */ public $element='payment_supplier'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='paiementfourn'; - + public $picto = 'payment'; var $statut; //Status of payment. 0 = unvalidated; 1 = validated @@ -505,6 +505,7 @@ class PaiementFourn extends Paiement return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -512,9 +513,9 @@ class PaiementFourn extends Paiement * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; $langs->load('compta'); @@ -770,15 +771,16 @@ class PaiementFourn extends Paiement } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the third party of object, from id into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; if (empty($force_thirdparty_id)) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0ed6f7fed14..60a109cf4d5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ion Agorria + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -403,7 +404,7 @@ if (empty($reshook)) if(!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); $type = $productsupplier->type; @@ -1542,7 +1543,7 @@ if ($action=='create') print ''; // Bank Account @@ -2044,7 +2045,7 @@ elseif (! empty($object->id)) print ''; $usehourmin=0; if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin=1; - $form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_',$usehourmin,$usehourmin,'',"setdate_livraison"); + print $form->selectDate($object->date_livraison?$object->date_livraison:-1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); print ''; print ''; } @@ -2120,7 +2121,7 @@ elseif (! empty($object->id)) // Total $alert = ''; - if($object->total_ht < $object->thirdparty->supplier_order_min_amount) { + if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) { $alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount)); } print ''; @@ -2468,7 +2469,7 @@ elseif (! empty($object->id)) print ''; print ''; print '\n"; print "'; print ''; print ''; print ''; // Supplier ref + Qty ordered + qty already dispatched } else { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4123e73d522..823e7261fc8 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1,11 +1,12 @@ +/* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -681,7 +682,7 @@ if ($resql) print $langs->trans('DateInvoice'); print ''; print ''; print ''; print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index ee6cc6c6af8..1409fb5ea78 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin @@ -8,6 +8,7 @@ * Copyright (C) 2012-2017 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -332,7 +333,7 @@ if ($action == 'create' && !$error) { // Date invoice print ''; // Payment term print ''; // Due date print ''; // Payment term diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index b9ae654d4ca..3fa525415bb 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2002-2006 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2013-2018 Philippe Grand @@ -10,6 +10,7 @@ * Copyright (C) 2015 Abbes Bahfir * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -512,7 +513,7 @@ if ($resql) print $langs->trans('DateInvoice'); print ''; print ''; print ''; print ''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 79bda41264e..0bcd9fd79ab 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -443,7 +444,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print $supplierstatic->getNomUrl(1,'supplier'); print ''; print ''; print ''; print ''; print ''; print ''; } @@ -1126,9 +1127,9 @@ else print ''; print ''; print ''; print ''; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0240ff8a34c..d75c90e2b64 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -36,12 +36,12 @@ class Holiday extends CommonObject * @var string ID to identify managed object */ public $element='holiday'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='holiday'; - + public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $fk_element = 'fk_holiday'; public $picto = 'holiday'; @@ -52,9 +52,18 @@ class Holiday extends CommonObject */ var $rowid; - var $fk_user; + /** + * @var int User ID + */ + public $fk_user; + var $date_create=''; - var $description; + + /** + * @var string description + */ + public $description; + var $date_debut=''; // Date start in PHP server TZ var $date_fin=''; // Date end in PHP server TZ var $date_debut_gmt=''; // Date start in GMT @@ -921,6 +930,7 @@ class Holiday extends CommonObject return $this->LibStatut($this->statut, $mode, $this->date_debut); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -929,61 +939,61 @@ class Holiday extends CommonObject * @param date $startdate Date holiday should start * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0, $startdate='') { + // phpcs:enable global $langs; if ($mode == 0) { if ($statut == 1) return $langs->trans('DraftCP'); - if ($statut == 2) return $langs->trans('ToReviewCP'); - if ($statut == 3) return $langs->trans('ApprovedCP'); - if ($statut == 4) return $langs->trans('CancelCP'); - if ($statut == 5) return $langs->trans('RefuseCP'); + elseif ($statut == 2) return $langs->trans('ToReviewCP'); + elseif ($statut == 3) return $langs->trans('ApprovedCP'); + elseif ($statut == 4) return $langs->trans('CancelCP'); + elseif ($statut == 5) return $langs->trans('RefuseCP'); } - if ($mode == 2) + elseif ($mode == 2) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft - if ($statut == 2) return img_picto($langs->trans('ToReviewCP'),'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval - if ($statut == 3) return img_picto($langs->trans('ApprovedCP'),$pictoapproved).' '.$langs->trans('ApprovedCP'); - if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP'); - if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP'); + elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'),'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval + elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'),$pictoapproved).' '.$langs->trans('ApprovedCP'); + elseif ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP'); + elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP'); } - if ($mode == 3) + elseif ($mode == 3) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0'); - if ($statut == 2) return img_picto($langs->trans('ToReviewCP'),'statut1'); - if ($statut == 3) return img_picto($langs->trans('ApprovedCP'),$pictoapproved); - if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5'); - if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5'); + elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'),'statut1'); + elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'),$pictoapproved); + elseif ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5'); + elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5'); } - if ($mode == 5) + elseif ($mode == 5) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft - if ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'),'statut1'); // Waiting approval - if ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'),$pictoapproved); - if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); - if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); + elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'),'statut1'); // Waiting approval + elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'),$pictoapproved); + elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); + elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft - if ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'),'statut1'); // Waiting approval - if ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'),$pictoapproved); - if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); - if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); + elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'),'statut1'); // Waiting approval + elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'),$pictoapproved); + elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); + elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); } - return $statut; + else return $statut; } @@ -1580,15 +1590,16 @@ class Holiday extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of people with permission to validate leave requests. * Search for permission "approve leave requests" * * @return array Array of user ids */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_holiday() { + // phpcs:enable $users_validator=array(); $sql = "SELECT DISTINCT ur.fk_user"; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index c452ac27ff0..655a3ff5d2a 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -1,11 +1,12 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2013 Cédric Salvador +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -152,7 +153,7 @@ if ($object->id) print ''; print ''; print ''; @@ -174,9 +175,9 @@ if ($object->id) print ''; print ''; print ''; print ''; } diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 5bb3bcaeca8..e9b98deb1f9 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -81,7 +81,7 @@ print ''; $sql = "SELECT cp.rowid, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; -$sql .= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " WHERE cp.rowid > 0"; $sql .= " AND cp.statut = 3"; // Approved diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 60493b0b7f0..20850964a66 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -32,19 +32,38 @@ class Establishment extends CommonObject * @var string ID to identify managed object */ public $element='establishment'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='establishment'; - + + /** + * @var int Name of subtable line + */ public $table_element_line = ''; + + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element = 'fk_establishment'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto='building'; - public $id; - public $ref; + /** + * @var int ID + */ + public $id; + + /** + * @var string Ref + */ + public $ref; + + /** + * @var int ID + */ public $rowid; public $name; @@ -52,6 +71,10 @@ class Establishment extends CommonObject public $zip; public $town; public $status; // 0=open, 1=closed + + /** + * @var int Entity + */ public $entity; public $country_id; @@ -265,6 +288,7 @@ class Establishment extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Give a label from a status * @@ -272,35 +296,35 @@ class Establishment extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$status]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); } - if ($mode == 2) + elseif ($mode == 2) { if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts_short[$status]); if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]); } - if ($mode == 3) + elseif ($mode == 3) { if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5'); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts[$status]); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]); } - if ($mode == 5) + elseif ($mode == 5) { if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4'); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 26ed9f82682..6d1e16433cf 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -221,7 +221,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) $userstatic->statut=$obj->statut; print ''; - print ''; + print ''; print ''; print ''; @@ -300,7 +300,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) $userstatic->photo=$obj->photo; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -373,7 +373,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire $userstatic->photo=$obj->photo; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 3d3e195b7c9..a0d33d4c28a 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -65,6 +65,7 @@ class Import } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load description int this->array_import_module, this->array_import_fields, ... of an importable dataset * @@ -72,9 +73,9 @@ class Import * @param string $filter Load a particular dataset only. Index will start to 0. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_arrays($user,$filter='') { + // phpcs:enable global $langs,$conf; dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); @@ -184,6 +185,7 @@ class Import + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build an import example file. * Arrays this->array_export_xxx are already loaded for required datatoexport @@ -194,9 +196,9 @@ class Import * @param string $datatoimport Dataset to import * @return string <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_example_file($model, $headerlinefields, $contentlinevalues,$datatoimport) { + // phpcs:enable global $conf,$langs; $indice=0; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 6660156e59e..a9c1fc2317a 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -548,8 +548,8 @@ if ($step == 3 && $datatoimport) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''.$langs->trans("ChooseFileToImport",img_picto('','filenew')).'

'; @@ -648,7 +648,8 @@ if ($step == 4 && $datatoimport) $classname = "Import".ucfirst($model); require_once $dir.$file; $obj = new $classname($db,$datatoimport); - if ($model == 'csv') { + if ($model == 'csv') + { $obj->separator = $separator; $obj->enclosure = $enclosure; } @@ -796,9 +797,9 @@ if ($step == 4 && $datatoimport) print ''; print ''; print $langs->trans("Separator").' : '; - print ''; + print ''; print '    '.$langs->trans("Enclosure").' : '; - print ''; + print ''; print ''; print ''; print ''; @@ -833,8 +834,8 @@ if ($step == 4 && $datatoimport) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0; - $form->select_date($datepayment,'','','','',"add_payment",1,1); + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print "
'; //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. $date_delivery = ($date_delivery?$date_delivery:$object->date_livraison); // $date_delivery comes from GETPOST - print $form->select_date($date_delivery?$date_delivery:-1,'date_delivery',1,1,1); + print $form->selectDate($date_delivery?$date_delivery:-1, 'date_delivery', 1, 1, 1); print "
'.$langs->trans("DateStart").''; - $form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1); + print $form->selectDate($date_start?$date_start:-1, 'date_debut', 0, 0, 0, '', 1, 1); print '
'.$langs->trans("DateEnd").''; - $form->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1); + print $form->selectDate($date_end?$date_end:-1, 'date_fin', 0, 0, 0, '', 1, 1); print '
'.$langs->trans("DateStart").''; - $form->select_date($object->date_debut,'date_debut'); + print $form->selectDate($object->date_debut, 'date_debut'); print '
'.$langs->trans("DateEnd").''; - $form->select_date($object->date_fin,'date_fin'); + print $form->selectDate($object->date_fin, 'date_fin'); print '
'; - $form->select_date($line->date,'date'); + print $form->selectDate($line->date,'date'); print ''; - $form->select_date($date?$date:-1,'date'); + print $form->selectDate($date?$date:-1, 'date'); print '
'.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0; - $form->select_date($datepayment,'','','','',"add_payment",1,1); + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print "
'; - if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) $form->select_date($db->jdate($objp->date_intervention),'di',0,0,0,"date_intervention"); - else $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { + print $form->selectDate($db->jdate($objp->date_intervention),'di',0,0,0,"date_intervention"); + } else { + print $form->selectDate($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + } print ''; $now=dol_now(); $timearray=dol_getdate($now); - if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); - else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); - if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) $form->select_date($timewithnohour,'di',0,0,0,"addinter"); - else $form->select_date($timewithnohour,'di',1,1,0,"addinter"); + if (! GETPOST('diday','int')) { + $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); + } else { + $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); + } + if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { + print $form->selectDate($timewithnohour,'di',0,0,0,"addinter"); + } else { + print $form->selectDate($timewithnohour,'di',1,1,0,"addinter"); + } print ''; if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { $selectmode = 'select'; - if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) + if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) { $selectmode = 'text'; + } $form->select_duration('duration', (!GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) ? 3600 : (60 * 60 * GETPOST('durationhour', 'int') + 60 * GETPOST('durationmin', 'int')), 0, $selectmode); } print '
'; - print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer); - print ''; - $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; - print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : '')); - - print '
'; + print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer); + print ''; + $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; + print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : '')); + print '
'; $usehourmin=0; if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin=1; - $form->select_date($datelivraison?$datelivraison:-1,'liv_',$usehourmin,$usehourmin,'',"set"); + print $form->selectDate($datelivraison?$datelivraison:-1, 'liv_', $usehourmin, $usehourmin, '', "set"); print '
'.$langs->trans("AmountHT").'
'.$langs->trans("OrderDate").''; $date_com = dol_mktime(GETPOST('rehour','int'), GETPOST('remin','int'), GETPOST('resec','int'), GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); if (empty($date_com)) $date_com=dol_now(); - print $form->select_date($date_com,'',1,1,'',"commande",1,1,1); + print $form->selectDate($date_com, '', 1, 1, '', "commande", 1, 1); print '
'.$langs->trans("OrderMode").''; @@ -2524,7 +2525,7 @@ elseif (! empty($object->id)) //print '
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; $datepreselected = dol_now(); - print $form->select_date($datepreselected,'',1,1,'',"commande",1,1,1); + print $form->selectDate($datepreselected, '', 1, 1, '', "commande", 1, 1); print "
".$langs->trans("Delivery")."\n"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index ea14b9aca90..6aa9b5ca127 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -7,6 +7,7 @@ * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -636,11 +637,11 @@ if ($id > 0 || ! empty($ref)) { print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); - $form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, ""); + print $form->selectDate($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, ''); print ''; $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year')); - $form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, ""); + print $form->selectDate($dluodatesuffix, 'dluo' . $suffix, '', '', 1, ''); print ' '; - print $form->select_date('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', '', '', '', '', 1, 1); print '
' . $langs->trans('Date') . ''; - $html->select_date('', '', '', '', '', "add", 1, 1); + print $html->selectDate('', '', '', '', '', "add", 1, 1); print '
' . $langs->trans('PaymentConditionsShort') . ''; @@ -486,8 +487,8 @@ if (($action != 'create' && $action != 'add') && !$error) { $num = $db->num_rows($resql); print load_fiche_titre($title); $i = 0; - $period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); - $periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1); + $period = $html->selectDate($date_start, 'date_start', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_end, 'date_end', 0, 0, 1, '', 1, 0); + $periodely = $html->selectDate($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0); if (! empty($socid)) { // Company diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a5fcfe076e4..a543cc13137 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2016-2017 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1955,12 +1956,12 @@ if ($action == 'create') // Date invoice print '
'.$langs->trans('DateInvoice').''; - $form->select_date($dateinvoice,'','','','',"add",1,1); + print $form->selectDate($dateinvoice, '', '', '', '', "add", 1, 1); print '
'.$langs->trans('DateMaxPayment').''; - $form->select_date($datedue,'ech','','','',"add",1,1); + print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); print '
'; - print $form->select_date('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', '', '', '', '', 1, 1); print '
'.$langs->trans('Date').''; - $form->select_date($dateinvoice,'','','','',"addpaiement",1,1,0,0,'','',$object->date); + print $form->selectDate($dateinvoice,'','','','',"addpaiement",1,1,0,0,'','',$object->date); print '
'.$langs->trans('PaymentMode').''; $form->select_types_paiements(empty($_POST['paiementid'])?$obj->fk_mode_reglement:$_POST['paiementid'],'paiementid'); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index fd050c4f772..be365c52351 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -4,7 +4,8 @@ * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro - * Copyright (C) 2014-2017 Ferran Marcet + * Copyright (C) 2014-2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -909,10 +910,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; // Si la demande ne vient pas de l'agenda if (! GETPOST('date_debut_')) { - $form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1); + print $form->selectDate(-1, 'date_debut_', 0, 0, 0, '', 1, 1); } else { $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int')); - $form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); + print $form->selectDate($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); } print '     '; print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning')); @@ -928,10 +929,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; // Si la demande ne vient pas de l'agenda if (! GETPOST('date_fin_')) { - $form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1); + print $form->selectDate(-1, 'date_fin_', 0, 0, 0, '', 1, 1); } else { $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int')); - $form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1); + print $form->selectDate($tmpdate, 'date_fin_', 0, 0, 0, '', 1, 1); } print '     '; print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon')); @@ -1104,9 +1105,9 @@ else print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; - $form->select_date($object->date_debut,'date_debut_'); - print '     '; - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); + print $form->selectDate($object->date_debut, 'date_debut_'); + print '     '; + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; - $form->select_date($object->date_fin,'date_fin_'); - print '     '; - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); + print $form->selectDate($object->date_fin, 'date_fin_'); + print '     '; + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; - $form->select_date($object->date_debut,'date_debut_'); + print $form->selectDate($object->date_debut, 'date_debut_'); print '     '; print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; - $form->select_date($object->date_fin,'date_fin_'); + print $form->selectDate($object->date_fin, 'date_fin_'); print '     '; - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); print '
'.$holidaystatic->getNomUrl(1).''.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(-1, 'leave').''.$typeleaves[$obj->fk_type]['label'].'
'.$deplacementstatic->getNomUrl(1).''.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm),'day').'
'.$expensereportstatic->getNomUrl(1).''.$expensereportstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->dm),'day').'
'; // Landing page - print ''; print ''; - print ''; print ''; // Language - print ''; print ''; - print ''; + print ''; print ''; - + // Max size for lists print ''; print ''; - print ''; + print ''; print ''; + // AGENDA_DEFAULT_VIEW + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''."\n"; + print '
'; print $langs->trans("SelectImportFields",img_picto('','grip_title','')).' '; $htmlother->select_import_model($importmodelid,'importmodelid',$datatoimport,1); @@ -1116,8 +1117,8 @@ if ($step == 4 && $datatoimport) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -1262,10 +1263,8 @@ if ($step == 5 && $datatoimport) if ($model == 'csv') { print ''; print ''; } diff --git a/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt b/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt deleted file mode 100755 index 1076f8b4b2b..00000000000 --- a/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 Michael Aufreiter, http://www.quasipartikel.at - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/htdocs/includes/jquery/plugins/multiselect/css/ui.multiselect.css b/htdocs/includes/jquery/plugins/multiselect/css/ui.multiselect.css deleted file mode 100755 index 2072baa57c4..00000000000 --- a/htdocs/includes/jquery/plugins/multiselect/css/ui.multiselect.css +++ /dev/null @@ -1,144 +0,0 @@ -/* Multiselect -----------------------------------*/ -.multiselect { - width: 600px; - height: 150px; -} - -.ui-multiselect { - border: solid 1px; - font-size: 0.8em; -} - -.ui-multiselect ul { - -moz-user-select: none; -} - -.ui-multiselect li { - margin: 0; - padding: 0; - cursor: default; - line-height: 20px; - height: 20px; - font-size: 11px; - list-style: none; -} - -.ui-multiselect li a { - color: #999; - text-decoration: none; - padding: 0; - display: block; - float: left; - cursor: pointer; -} - -.ui-multiselect li.ui-draggable-dragging { - padding-left: 10px; -} - -.ui-multiselect div.selected { - position: relative; - padding: 0; - margin: 0; - border: 0; - float: left; -} - -.ui-multiselect ul.selected { - position: relative; - padding: 0; - overflow: auto; - overflow-x: hidden; - background: #fff; - margin: 0; - list-style: none; - border: 0; - position: relative; - width: 100%; -} - -.ui-multiselect ul.selected li { - -} - -.ui-multiselect div.available { - position: relative; - padding: 0; - margin: 0; - border: 0; - float: left; - border-left: 1px solid; -} - -.ui-multiselect ul.available { - position: relative; - padding: 0; - overflow: auto; - overflow-x: hidden; - background: #fff; - margin: 0; - list-style: none; - border: 0; - width: 100%; -} - -.ui-multiselect ul.available li { - padding-left: 10px; -} - -.ui-multiselect .ui-state-default { - border: none; - margin-bottom: 1px; - position: relative; - padding-left: 20px; -} - -.ui-multiselect .ui-state-hover { - border: none; -} - -.ui-multiselect .ui-widget-header { - border: none; - font-size: 11px; - margin-bottom: 1px; -} - -.ui-multiselect .add-all { - float: right; - padding: 7px; -} - -.ui-multiselect .remove-all { - float: right; - padding: 7px; -} - -.ui-multiselect .search { - float: left; - padding: 4px; -} - -.ui-multiselect .count { - float: left; - padding: 7px; -} - -.ui-multiselect li span.ui-icon-arrowthick-2-n-s { - position: absolute; - left: 2px; -} - -.ui-multiselect li a.action { - position: absolute; - right: 2px; - top: 2px; -} - -.ui-multiselect input.search { - height: 14px; - padding: 1px; - opacity: 0.5; - margin: 4px; - width: 100px; -} \ No newline at end of file diff --git a/htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js b/htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js new file mode 100644 index 00000000000..ee62d1f588d --- /dev/null +++ b/htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js @@ -0,0 +1,360 @@ +// jquery.multi-select.js +// by mySociety +// https://github.com/mysociety/jquery-multi-select + +;(function($) { + + "use strict"; + + var pluginName = "multiSelect", + defaults = { + 'containerHTML': '
', + 'menuHTML': '
', + 'buttonHTML': '', + 'menuItemsHTML': '
', + 'menuItemHTML': '
'; - $boxwork.='"; print ''; // Date End print ""; print ''; // Number of terms @@ -501,7 +501,7 @@ if ($id > 0) print ""; print ''; diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index c33e015ec79..139183e0375 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -42,7 +42,7 @@ class MailmanSpip * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -170,15 +170,16 @@ class MailmanSpip return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui donne les droits redacteurs dans spip * * @param Adherent $object Object with data (->firstname, ->lastname, ->email and ->login) * @return int =0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_spip($object) { + // phpcs:enable dol_syslog(get_class($this)."::add_to_spip"); if ($this->isSpipEnabled()) @@ -213,15 +214,16 @@ class MailmanSpip return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui enleve les droits redacteurs dans spip * * @param Adherent $object Object with data (->login) * @return int =0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_spip($object) { + // phpcs:enable dol_syslog(get_class($this)."::del_to_spip"); if ($this->isSpipEnabled()) @@ -253,15 +255,16 @@ class MailmanSpip return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui dit si cet utilisateur est un redacteur existant dans spip * * @param object $object Object with data (->login) * @return int 1=exists, 0=does not exists, -1=error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_in_spip($object) { + // phpcs:enable if ($this->isSpipEnabled()) { if ($this->checkSpipConfig()) @@ -304,6 +307,7 @@ class MailmanSpip return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Subscribe an email to all mailing-lists * @@ -311,9 +315,9 @@ class MailmanSpip * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_mailman($object,$listes='') { + // phpcs:enable global $conf,$langs,$user; dol_syslog(get_class($this)."::add_to_mailman"); @@ -376,6 +380,7 @@ class MailmanSpip } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Unsubscribe an email from all mailing-lists * Used when a user is resiliated @@ -384,9 +389,9 @@ class MailmanSpip * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_mailman($object,$listes='') { + // phpcs:enable global $conf,$langs,$user; dol_syslog(get_class($this)."::del_to_mailman"); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ffd0dd90618..48715787d31 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -752,7 +752,7 @@ if (! defined('NOLOGIN')) { $db->rollback(); session_destroy(); - dol_print_error($db,'Error in some hooks afterLogin (or old trigger USER_LOGIN)'); + dol_print_error($db,'Error in some hooks afterLogin'); exit; } else @@ -1312,7 +1312,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; print ''."\n"; // We include full because we need the support of containerCssClass } - } + if (! defined('DISABLE_MULTISELECT')) // jQuery plugin "mutiselect" to select with checkboxes + { + print ''."\n"; + } + } if (! $disablejs && ! empty($conf->use_javascript_ajax)) { diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index dc546a7f9b4..5c808051a06 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -110,11 +110,11 @@ print ''; // Start date print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; @@ -360,15 +361,13 @@ if ($resql) } } - - // Virtual stock if ($virtualdiffersfromphysical) { - print ''; + print $product->stock_theorique; + print ''; } print ''; print ''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 8fa05f5c453..9f205580444 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -37,12 +37,12 @@ class Entrepot extends CommonObject * @var string ID to identify managed object */ public $element='stock'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='entrepot'; - + public $picto='stock'; /** @@ -61,7 +61,12 @@ class Entrepot extends CommonObject const STATUS_OPEN_INTERNAL = 2; var $libelle; - var $description; + + /** + * @var string description + */ + public $description; + var $statut; var $lieu; var $address; @@ -415,15 +420,16 @@ class Entrepot extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of all warehouses * * @param int $status Status * @return array Array list of warehouses */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_array($status=1) { + // phpcs:enable $liste = array(); $sql = "SELECT rowid, ref as label"; @@ -447,14 +453,15 @@ class Entrepot extends CommonObject return $liste; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of unique different product into a warehouse * * @return Array Array('nb'=>Nb, 'value'=>Value) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_different_products() { + // phpcs:enable $ret=array(); $sql = "SELECT count(distinct p.rowid) as nb"; @@ -480,14 +487,15 @@ class Entrepot extends CommonObject return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return stock and value of warehosue * * @return Array Array('nb'=>Nb, 'value'=>Value) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_products() { + // phpcs:enable $ret=array(); $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; @@ -525,6 +533,7 @@ class Entrepot extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -532,9 +541,9 @@ class Entrepot extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('stocks'); @@ -652,14 +661,15 @@ class Entrepot extends CommonObject $this->country_code='FR'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return full path to current warehouse * * @return string String full path to current warehouse separated by " >> " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo() { + // phpcs:enable global $user,$langs,$conf; $TArbo = array(empty($this->label)?$this->libelle:$this->label); @@ -693,6 +703,7 @@ class Entrepot extends CommonObject return implode(' >> ', array_reverse($TArbo)); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array of children warehouses ids from $id warehouse (recursive function) * @@ -700,9 +711,9 @@ class Entrepot extends CommonObject * @param array $TChildWarehouses array which will contain all children (param by reference) * @return array $TChildWarehouses array which will contain all children */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_children_warehouses($id, &$TChildWarehouses) { + // phpcs:enable $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'entrepot diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ba82e007086..76225ff8902 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -34,7 +34,7 @@ class MouvementStock extends CommonObject * @var string Id to identify managed objects */ public $element = 'stockmouvement'; - + /** * @var string Name of table without prefix where object is stored */ @@ -858,6 +858,7 @@ class MouvementStock extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Url link of origin object * @@ -865,9 +866,9 @@ class MouvementStock extends CommonObject * @param int $origintype Type origin * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_origin($fk_origin, $origintype) { + // phpcs:enable $origin=''; switch ($origintype) { @@ -1012,38 +1013,35 @@ class MouvementStock extends CommonObject return $this->LibStatut($mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $langs->trans('StatusNotApplicable'); } - if ($mode == 1) - { - return $langs->trans('StatusNotApplicable'); - } - if ($mode == 2) + elseif ($mode == 2) { return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); } - if ($mode == 3) + elseif ($mode == 3) { return img_picto($langs->trans('StatusNotApplicable'),'statut9'); } - if ($mode == 4) + elseif ($mode == 4) { return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); } - if ($mode == 5) + elseif ($mode == 5) { return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); } diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0c501a1a09f..7eb3593de35 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -39,7 +39,7 @@ class Productlot extends CommonObject * @var string Id to identify managed objects */ public $element = 'productlot'; - + /** * @var string Name of table without prefix where object is stored */ @@ -55,9 +55,10 @@ class Productlot extends CommonObject public $lines = array(); /** + * @var int Entity */ - public $entity; + public $fk_product; public $batch; public $eatby = ''; @@ -68,9 +69,6 @@ class Productlot extends CommonObject public $fk_user_modif; public $import_key; - /** - */ - /** * Constructor @@ -475,6 +473,7 @@ class Productlot extends CommonObject return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -482,9 +481,9 @@ class Productlot extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; //$langs->load('stocks'); diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index 651ee59c22e..e0c15d03520 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -44,7 +44,7 @@ class ProductStockEntrepot extends CommonObject * @var string Id to identify managed objects */ public $element = 'ProductStockEntrepot'; - + /** * @var string Name of table without prefix where object is stored */ @@ -511,6 +511,7 @@ class ProductStockEntrepot extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -518,9 +519,9 @@ class ProductStockEntrepot extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 8a39327b7c0..324e14047d4 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Simon TOSSER @@ -8,6 +8,7 @@ * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2014-2015 Cédric Gross * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -884,10 +885,10 @@ if ($resql) print '
'.$langs->trans("CsvOptions").''; - print $langs->trans("Separator").' : '; - print htmlentities($separator); - print '    '.$langs->trans("Enclosure").' : '; - print htmlentities($enclosure); + print $langs->trans("Separator").' : '.dol_escape_htmltag($separator); + print '    '.$langs->trans("Enclosure").' : '.dol_escape_htmltag($enclosure); print '
'; + $boxwork.=''; $text=''; if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')'; else $text=$langs->transnoentitiesnoconv("NoItemLate"); diff --git a/htdocs/install/check.php b/htdocs/install/check.php index a5913f9304f..f220978e4db 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -555,7 +555,7 @@ else if (count($notavailable_choices)) { print '
'; - print ' '.$langs->trans('ShowNotAvailableOptions').''; + print ''; print '
'; print '
'.$langs->trans("DateStart").''; - print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1); + print $form->selectDate($datestart?$datestart:-1,'start','','','','add',1,1); print '
'.$langs->trans("DateEnd").''; - print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1); + print $form->selectDate($dateend?$dateend:-1,'end','','','','add',1,1); print '
"; if ($action == 'edit') { - print $form->select_date($object->datestart, 'start', 0, 0, 0, 'update', 1, 0, 1); + print $form->selectDate($object->datestart, 'start', 0, 0, 0, 'update', 1, 0); } else { @@ -514,7 +514,7 @@ if ($id > 0) print ""; if ($action == 'edit') { - print $form->select_date($object->dateend, 'end', 0, 0, 0, 'update', 1, 0, 1); + print $form->selectDate($object->dateend, 'end', 0, 0, 0, 'update', 1, 0); } else { diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index b1bcbc65567..437c72f258a 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,7 +43,11 @@ class Loan extends CommonObject public $picto = 'bill'; + /** + * @var int ID + */ public $rowid; + public $datestart; public $dateend; public $label; @@ -333,15 +337,16 @@ class Loan extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag loan as payed completely * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql.= " paid = 1"; $sql.= " WHERE rowid = ".$this->id; @@ -366,6 +371,7 @@ class Loan extends CommonObject return $this->LibStatut($this->paid,$mode,$alreadypaid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label for given status * @@ -374,54 +380,49 @@ class Loan extends CommonObject * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$alreadypaid=-1) { + // phpcs:enable global $langs; $langs->loadLangs(array("customers","bills")); - if ($mode == 0) + if ($mode == 0 || $mode == 1) { if ($statut == 0) return $langs->trans("Unpaid"); - if ($statut == 1) return $langs->trans("Paid"); + elseif ($statut == 1) return $langs->trans("Paid"); } - if ($mode == 1) - { - if ($statut == 0) return $langs->trans("Unpaid"); - if ($statut == 1) return $langs->trans("Paid"); - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); - if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); + elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - return "Error, mode/status not found"; + else return "Error, mode/status not found"; } diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 80341e8df0c..2f37b1a870c 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -58,7 +58,7 @@ class LoanSchedule extends CommonObject * @deprecated * @see amount, amounts */ - var $total; + public $total; /** * Constructor @@ -372,6 +372,7 @@ class LoanSchedule extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Calculate mensuality * @@ -380,9 +381,9 @@ class LoanSchedule extends CommonObject * @param int $nbterm nb term * @return double mensuality */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function calc_mens($capital, $rate, $nbterm) { + // phpcs:enable $result=''; if (!empty($capital) && !empty($rate) && !empty($nbterm)) { @@ -429,7 +430,7 @@ class LoanSchedule extends CommonObject { while($obj = $this->db->fetch_object($resql)) { - $line = New LoanSchedule($this->db); + $line = new LoanSchedule($this->db); $line->id = $obj->rowid; $line->ref = $obj->rowid; @@ -460,14 +461,15 @@ class LoanSchedule extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * trans_paiment * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function trans_paiment() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 32b4080187f..add1aef496d 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -478,15 +478,16 @@ class PaymentLoan extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between loan's payment and the line generate in llx_bank * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."payment_loan SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index ee83bf17f00..d84ea4ae26b 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France +/* Copyright (C) 2014-2018 Alexandre Spangaro + * Copyright (C) 2015-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -200,7 +200,7 @@ if ($action == 'create') print '
'.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0; - $form->select_date($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print "
'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; -$form->select_date($startdate,'startdate','','',1,"sel",1,1); +print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; -$form->select_date($enddate,'enddate','','',1,"sel",1,1); +print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); print ''; print ''; @@ -271,4 +271,3 @@ $(document).ready(function() { // End of page llxFooter(); $db->close(); - diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 7160a13ed59..06527f42b91 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -165,11 +165,11 @@ print ''; print ''; print ''; print ''; print ''; print ''; // Start date print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; // Expire date print ''; // Expire date print ''; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index d7c35fdd082..8664e616c55 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ print ''."\n"; print ''."\n"; print '
' . $langs->trans('DateStart') . ' (' . $langs->trans("DateValidation") . ')'; -$form->select_date($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); print '' . $langs->trans('DateEnd') . ' (' . $langs->trans("DateValidation") . ')'; -$form->select_date($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); print ''; print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 7b33517556e..675fe527a47 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -159,11 +159,11 @@ print '
'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; -$form->select_date($startdate,'startdate','','',1,"sel",1,1); +print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; -$form->select_date($enddate,'enddate','','',1,"sel",1,1); +print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); print ''; print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 55fef4e5c35..cb8bd53f790 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -134,11 +134,11 @@ print '
'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; -$form->select_date($startdate,'startdate','','',1,"sel",1,1); +print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; -$form->select_date($enddate,'enddate','','',1,"sel",1,1); +print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); print ''; print ''; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 1af3fc23d1e..d325e52a343 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1185,7 +1185,7 @@ elseif (! empty($module)) print '
'; print '
'; - print_fiche_titre($langs->trans("DescriptorFile")); + print load_fiche_titre($langs->trans("DescriptorFile")); if (! empty($moduleobj)) { @@ -1249,7 +1249,7 @@ elseif (! empty($module)) print '

'; // Readme file - print_fiche_titre($langs->trans("ReadmeFile")); + print load_fiche_titre($langs->trans("ReadmeFile")); print '
'; print '
'; @@ -1259,7 +1259,7 @@ elseif (! empty($module)) print '

'; // ChangeLog - print_fiche_titre($langs->trans("ChangeLog")); + print load_fiche_titre($langs->trans("ChangeLog")); print '
'; print '
'; diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 36b8b1d3fa8..ab559a26612 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -120,6 +120,7 @@ class MyModuleApi extends DolibarrApi $restictonsocid = 0; // Set to 1 if there is a field socid in table of object // If the internal user must only see his customers, force searching by him + $search_sale = 0; if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 21e8df59efc..2da97f5b800 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -36,22 +36,22 @@ class MyObject extends CommonObject * @var string ID to identify managed object */ public $element = 'myobject'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'mymodule_myobject'; - + /** * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var int Does myobject support extrafields ? 0=No, 1=Yes */ public $isextrafieldmanaged = 1; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -101,9 +101,21 @@ class MyObject extends CommonObject 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), ); + /** + * @var int ID + */ public $rowid; + + /** + * @var string Ref + */ public $ref; + + /** + * @var int Entity + */ public $entity; + public $label; public $amount; public $status; @@ -122,22 +134,22 @@ class MyObject extends CommonObject * @var int Name of subtable line */ //public $table_element_line = 'myobjectdet'; - + /** * @var int Field with ID of parent key if this field has a parent */ //public $fk_element = 'fk_myobject'; - + /** * @var int Name of subtable class that manage subtable lines */ //public $class_element_line = 'MyObjectline'; - + /** * @var array Array of child tables (child tables to delete before deleting a record) */ //protected $childtables=array('myobjectdet'); - + /** * @var MyObjectLine[] Array of subtable lines */ @@ -368,6 +380,7 @@ class MyObject extends CommonObject return $this->LibStatut($this->status, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -375,9 +388,9 @@ class MyObject extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status, $mode=0) { + // phpcs:enable if (empty($this->labelstatus)) { global $langs; @@ -397,27 +410,27 @@ class MyObject extends CommonObject elseif ($mode == 2) { if ($status == 1) return img_picto($this->labelstatus[$status],'statut4').' '.$this->labelstatus[$status]; - if ($status == 0) return img_picto($this->labelstatus[$status],'statut5').' '.$this->labelstatus[$status]; + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5').' '.$this->labelstatus[$status]; } elseif ($mode == 3) { if ($status == 1) return img_picto($this->labelstatus[$status],'statut4'); - if ($status == 0) return img_picto($this->labelstatus[$status],'statut5'); + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5'); } elseif ($mode == 4) { if ($status == 1) return img_picto($this->labelstatus[$status],'statut4').' '.$this->labelstatus[$status]; - if ($status == 0) return img_picto($this->labelstatus[$status],'statut5').' '.$this->labelstatus[$status]; + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5').' '.$this->labelstatus[$status]; } elseif ($mode == 5) { if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4'); - if ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5'); + elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5'); } elseif ($mode == 6) { if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4'); - if ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5'); + elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5'); } } diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 9b52b3119f6..545e53d350a 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -27,7 +27,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets var $enabled=0; var $require_module=array(); var $picto='mymodule@mymodule'; - + /** * @var DoliDB Database handler. */ @@ -92,6 +92,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -99,9 +100,9 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int <0 if error, number of emails added if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { + // phpcs:enable $target = array(); $cibles = array(); $j = 0; diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index b325f2f7443..1935054893b 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -113,11 +113,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'USER_SETINGROUP': //case 'USER_REMOVEFROMGROUP': - //case 'USER_LOGIN': - //case 'USER_LOGIN_FAILED': - //case 'USER_LOGOUT': - //case 'USER_UPDATE_SESSION': // Warning: To increase performances, this action is triggered only if constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - // Actions //case 'ACTION_MODIFY': //case 'ACTION_CREATE': diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 2e3723ab667..ab72aabaee0 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -42,12 +42,12 @@ class MultiCurrency extends CommonObject * @var string Id to identify managed objects */ public $element = 'multicurrency'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'multicurrency'; - + /** * @var string Name of table without prefix where object is stored */ @@ -62,32 +62,32 @@ class MultiCurrency extends CommonObject * @var mixed Sample property 1 */ public $id; - + /** * @var mixed Sample property 1 */ public $code; - + /** * @var mixed Sample property 2 */ public $name; - + /** - * @var mixed Sample property 2 + * @var int Entity */ public $entity; - + /** * @var mixed Sample property 2 */ public $date_create; - + /** * @var mixed Sample property 2 */ public $fk_user; - + /** * @var mixed Sample property 2 */ @@ -694,32 +694,32 @@ class CurrencyRate extends CommonObjectLine * @var string Id to identify managed objects */ public $element = 'multicurrency_rate'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'multicurrency_rate'; - + /** * @var int ID */ public $id; - + /** * @var double Rate */ public $rate; - + /** * @var date Date synchronisation */ public $date_sync; - + /** * @var int Id of currency */ public $fk_multicurrency; - + /** * @var int Id of entity */ diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 0df6400bcc9..2a2b3f85ae4 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -1,6 +1,7 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013-2015 Laurent Destailleur + * Copyright (C) 2014 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -306,7 +307,7 @@ print '
'.$langs->trans('ExpireDate').''; -if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire',0,0,0,'',1,0,1); +if ($action == 'edit') print $form->selectDate($expiredate?$expiredate:$object->date_fin, 'expire', 0, 0, 0, '', 1, 0); else { print dol_print_date($object->date_fin,'day'); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 62a9a798617..169aebde712 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -52,6 +52,10 @@ class Opensurveysondage extends CommonObject * @see description */ public $commentaires; + + /** + * @var string description + */ public $description; public $mail_admin; @@ -467,14 +471,15 @@ class Opensurveysondage extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array of lines * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $ret=array(); $sql = "SELECT id_users, nom as name, reponses FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; @@ -623,6 +628,7 @@ class Opensurveysondage extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of status * @@ -630,9 +636,9 @@ class Opensurveysondage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode) { + // phpcs:enable global $langs, $conf; //print 'x'.$status.'-'.$billed; diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 553237059d3..3df5b37c88f 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -79,7 +79,7 @@ function llxHeaderSurvey($title, $head="", $disablejs=0, $disablehead=0, $arrayo // Print logo if ($mysoc->logo) { if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file=thumbs/'.urlencode($mysoc->logo_small); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); } } diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 9672e310938..404843c3eed 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1,6 +1,7 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013-2015 Laurent Destailleur + * Copyright (C) 2014 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -458,7 +459,7 @@ print '
'.$langs->trans('ExpireDate').''; -if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire',0,0,0,'',1,0,1); +if ($action == 'edit') print $form->selectDate($expiredate?$expiredate:$object->date_fin, 'expire', 0, 0, 0, '', 1, 0); else print dol_print_date($object->date_fin,'day'); print '
'. $langs->trans("ExpireDate") .''; -print $form->select_date($champdatefin?$champdatefin:-1,'champdatefin','','','',"add",1,0,1); +print $form->selectDate($champdatefin?$champdatefin:-1, 'champdatefin', '', '', '', "add", 1, 0); print '
'."\n"; diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 4a6dbe63768..e99acdedf5d 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -400,7 +400,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $urllogo=$urlwithroot."/viewimage.php?modulepart=mycompany&file=".$mysoc->logo; + $urllogo=$urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo); $nvpstr = $nvpstr . "&LOGOIMG=" . urlencode($urllogo); } if (! empty($conf->global->PAYPAL_BRANDNAME)) diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index c24d5a8214a..bcd9773c719 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -64,6 +64,7 @@ class ActionsCardProduct } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -72,9 +73,9 @@ class ActionsCardProduct * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; @@ -295,6 +296,7 @@ class ActionsCardProduct } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -304,9 +306,9 @@ class ActionsCardProduct * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf, $langs; $this->getFieldList(); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 3d10988de85..2f0489b6f91 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -63,6 +63,7 @@ class ActionsCardService } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -71,9 +72,9 @@ class ActionsCardService * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; @@ -273,6 +274,7 @@ class ActionsCardService } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -282,9 +284,9 @@ class ActionsCardService * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf; global $search_categ,$sall,$sref,$search_barcode,$snom,$catid; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 52815c1303d..d51a4fa494c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -977,7 +977,7 @@ else } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); - print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); + print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print '
'.$langs->trans("BarcodeValue").''; $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); @@ -1343,7 +1343,7 @@ else } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); - print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); + print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print ''.$langs->trans("BarcodeValue").''; $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); @@ -1639,7 +1639,7 @@ else } if ($action == 'editbarcodetype') { - $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type'); + print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); } else { diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 4eee6ffe502..22b5e4656a7 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -167,6 +167,7 @@ class FormProduct } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return full path to current warehouse in $tab (recursive function) * @@ -174,10 +175,9 @@ class FormProduct * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return String full label with all parents, separated by ' >> ' */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function get_parent_path($tab, $final_label='') { - + //phpcs:enable if(empty($final_label)) $final_label = $tab['label']; if(empty($tab['parent_id'])) return $final_label; @@ -282,6 +282,7 @@ class FormProduct } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a combo box with list of units * pour l'instant on ne definit pas les unites dans la base @@ -292,12 +293,13 @@ class FormProduct * @param int $adddefault Add empty unit called "Default" * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { + //phpcs:enable print $this->load_measuring_units($name, $measuring_style, $default, $adddefault); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a combo box with list of units * For the moment, units labels are defined in measuring_units_string @@ -308,9 +310,9 @@ class FormProduct * @param int $adddefault Add empty unit called "Default" * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { + //phpcs:enable global $langs,$conf,$mysoc; $langs->load("other"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index cdacd56e432..2b5b9c71ba6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -53,7 +53,11 @@ class Product extends CommonObject */ public $table_element='product'; + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_product'; + protected $childtables=array('supplier_proposaldet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -692,19 +696,20 @@ class Product extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check barcode * - * @param string $valuetotest Value to test - * @param string $typefortest Type of barcode (ISBN, EAN, ...) + * @param string $valuetotest Value to test + * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK * -1 ErrorBadBarCodeSyntax * -2 ErrorBarCodeRequired * -3 ErrorBarCodeAlreadyUsed */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_barcode($valuetotest,$typefortest) { + // phpcs:enable global $conf; if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { @@ -1446,6 +1451,7 @@ class Product extends CommonObject + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert a track that we changed a customer price * @@ -1453,9 +1459,9 @@ class Product extends CommonObject * @param int $level price level to change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _log_price($user,$level=0) { + // phpcs:enable global $conf; $now=dol_now(); @@ -1485,6 +1491,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a price line * @@ -1492,9 +1499,9 @@ class Product extends CommonObject * @param int $rowid Line id to delete * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function log_price_delete($user, $rowid) { + // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql.= " WHERE fk_product_price=".$rowid; $resql=$this->db->query($sql); @@ -1514,6 +1521,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read price used by a provider. * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref. @@ -1526,9 +1534,9 @@ class Product extends CommonObject * @param int $fk_soc If of supplier * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0) { + // phpcs:enable global $conf; $result = 0; @@ -2216,15 +2224,16 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats propale pour le produit/service * * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_propale($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2260,15 +2269,16 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats propale pour le produit/service * * @param int $socid Id thirdparty * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_proposal_supplier($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2304,6 +2314,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats commande client pour le produit/service * @@ -2312,9 +2323,9 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Array of stats (nb=nb of order, qty=qty ordered) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,"; @@ -2401,6 +2412,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats commande fournisseur pour le produit/service * @@ -2409,9 +2421,9 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_suppliers, COUNT(DISTINCT c.rowid) as nb,"; @@ -2445,6 +2457,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats expedition client pour le produit/service * @@ -2453,9 +2466,9 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT e.fk_soc) as nb_customers, COUNT(DISTINCT e.rowid) as nb,"; @@ -2493,6 +2506,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats réception fournisseur pour le produit/service * @@ -2501,9 +2515,9 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_reception($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; @@ -2537,15 +2551,16 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats contrat pour le produit/service * - * @param int $socid Id societe + * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_contrat($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2580,15 +2595,16 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats facture pour le produit/service * * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_facture($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2623,15 +2639,16 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats facture pour le produit/service * * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_facture_fournisseur($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2666,6 +2683,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an array formated for showing graphs * @@ -2674,9 +2692,9 @@ class Product extends CommonObject * @param int $year Year (0=current year) * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _get_stats($sql, $mode, $year=0) { + // phpcs:enable $resql = $this->db->query($sql); if ($resql) { @@ -2731,6 +2749,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or customers invoices in which product is included * @@ -2741,9 +2760,9 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2768,6 +2787,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or supplier invoices in which product is included * @@ -2778,9 +2798,9 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2804,6 +2824,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or proposals in which product is included * @@ -2814,9 +2835,9 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2840,6 +2861,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or proposals in which product is included * @@ -2850,9 +2872,9 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2876,6 +2898,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or orders in which product is included * @@ -2886,9 +2909,9 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf, $user; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; @@ -2911,6 +2934,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or orders in which product is included * @@ -2921,9 +2945,9 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf, $user; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; @@ -2946,6 +2970,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link a product/service to a parent product/service * @@ -2955,9 +2980,9 @@ class Product extends CommonObject * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @return int < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1) { + // phpcs:enable // Clean parameters if (! is_numeric($id_pere)) $id_pere=0; if (! is_numeric($id_fils)) $id_fils=0; @@ -3003,6 +3028,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Modify composed product * @@ -3012,9 +3038,9 @@ class Product extends CommonObject * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @return int < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1) { + // phpcs:enable // Clean parameters if (! is_numeric($id_pere)) $id_pere=0; if (! is_numeric($id_fils)) $id_fils=0; @@ -3037,6 +3063,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retire le lien entre un sousproduit et un produit/service * @@ -3044,9 +3071,9 @@ class Product extends CommonObject * @param int $fk_child Id du produit a ne plus lie * @return int < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_sousproduit($fk_parent, $fk_child) { + // phpcs:enable if (! is_numeric($fk_parent)) $fk_parent=0; if (! is_numeric($fk_child)) $fk_child=0; @@ -3064,16 +3091,17 @@ class Product extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si c'est un sous-produit * - * @param int $fk_parent Id du produit auquel le produit est lie - * @param int $fk_child Id du produit lie + * @param int $fk_parent Id du produit auquel le produit est lie + * @param int $fk_child Id du produit lie * @return int < 0 si erreur, > 0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_sousproduit($fk_parent, $fk_child) { + // phpcs:enable $sql = "SELECT fk_product_pere, qty, incdec"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " WHERE fk_product_pere = '".$fk_parent."'"; @@ -3105,6 +3133,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a supplier price for the product. * Note: Duplicate ref is accepted for different quantity only, or for different companies. @@ -3115,9 +3144,9 @@ class Product extends CommonObject * @param float $quantity Quantity minimum for price * @return int < 0 if KO, 0 if link already exists for this product, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity) { + // phpcs:enable global $conf; $now=dol_now(); @@ -3210,14 +3239,15 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des fournisseurs du produit/service * * @return array Tableau des id de fournisseur */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_suppliers() { + // phpcs:enable global $conf; $list = array(); @@ -3243,6 +3273,7 @@ class Product extends CommonObject return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recopie les prix d'un produit/service sur un autre * @@ -3250,9 +3281,9 @@ class Product extends CommonObject * @param int $toId Id product target * @return nt < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_price($fromId, $toId) { + // phpcs:enable $this->db->begin(); // les prix @@ -3272,6 +3303,7 @@ class Product extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Clone links between products * @@ -3279,9 +3311,9 @@ class Product extends CommonObject * @param int $toId Product id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_associations($fromId, $toId) { + // phpcs:enable $this->db->begin(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)'; @@ -3299,6 +3331,7 @@ class Product extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre * @@ -3306,9 +3339,9 @@ class Product extends CommonObject * @param int $toId Id produit cible * @return int < 0 si erreur, > 0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_fournisseurs($fromId, $toId) { + // phpcs:enable $this->db->begin(); $now=dol_now(); @@ -3347,6 +3380,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits * Define value of this->res @@ -3358,9 +3392,9 @@ class Product extends CommonObject * @param int $id_parent Id parent * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_parent=0) { + // phpcs:enable global $conf,$langs; $product = new Product($this->db); @@ -3407,6 +3441,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the tree of subproducts into an array * this->sousprods is loaded by this->get_sousproduits_arbo() @@ -3414,9 +3449,9 @@ class Product extends CommonObject * @param int $multiply Because each sublevel must be multiplicated by parent nb * @return array $this->res */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_arbo_each_prod($multiply=1) { + // phpcs:enable $this->res = array(); if (isset($this->sousprods) && is_array($this->sousprods)) { @@ -3558,15 +3593,16 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tree of all subproducts for product. Tree contains id, name and quantity. * Set this->sousprods * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sousproduits_arbo() { + // phpcs:enable $parent=array(); foreach($this->getChildsArbo($this->id) as $keyChild => $valueChild) // Warning. getChildsArbo can call getChildsArbo recursively. Starting point is $value[0]=id of product @@ -3760,6 +3796,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3768,9 +3805,9 @@ class Product extends CommonObject * @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0,$type=0) { + // phpcs:enable global $conf, $langs; $langs->load('products'); @@ -3855,6 +3892,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adjust stock in a warehouse for product * @@ -3869,9 +3907,9 @@ class Product extends CommonObject * @param int $origin_id Origin id of element * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $inventorycode='', $origin_element='', $origin_id=null) { + // phpcs:enable if ($id_entrepot) { $this->db->begin(); @@ -3901,6 +3939,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adjust stock in a warehouse for product with batch number * @@ -3918,9 +3957,9 @@ class Product extends CommonObject * @param int $origin_id Origin id of element * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='', $inventorycode='', $origin_element='', $origin_id=null) { + // phpcs:enable if ($id_entrepot) { $this->db->begin(); @@ -3950,6 +3989,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. @@ -3964,9 +4004,9 @@ class Product extends CommonObject * @return int < 0 if KO, > 0 if OK * @see load_virtual_stock, getBatchInfo */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stock($option='') { + // phpcs:enable global $conf; $this->stock_reel = 0; @@ -4031,6 +4071,7 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load value ->stock_theorique of a product. Property this->id must be defined. * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. @@ -4038,9 +4079,9 @@ class Product extends CommonObject * @return int < 0 if KO, > 0 if OK * @see load_stock, getBatchInfo */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_virtual_stock() { + // phpcs:enable global $conf; $stock_commande_client=0; @@ -4131,6 +4172,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Move an uploaded file described into $file array into target directory $sdir. * @@ -4138,9 +4180,9 @@ class Product extends CommonObject * @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_photo($sdir, $file) { + // phpcs:enable global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -4173,15 +4215,16 @@ class Product extends CommonObject else return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if at least one photo is available * * @param string $sdir Directory to scan * @return boolean True if at least one photo is available, False if not */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_photo_available($sdir) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; @@ -4210,6 +4253,7 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne tableau de toutes les photos du produit * @@ -4217,9 +4261,9 @@ class Product extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_photos($dir,$nbmax=0) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -4266,15 +4310,16 @@ class Product extends CommonObject return $tabobj; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Efface la photo du produit et sa vignette * * @param string $file Chemin de l'image * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_photo($file) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -4302,29 +4347,31 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load size of image file * * @param string $file Path to file * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_image_size($file) { + // phpcs:enable $file_osencoded=dol_osencode($file); $infoImg = getimagesize($file_osencoded); // Get information on image $this->imgWidth = $infoImg[0]; // Largeur de l'image $this->imgHeight = $infoImg[1]; // Hauteur de l'image } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators this->nb for the dashboard * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user, $hookmanager; $this->nb=array(); @@ -4380,6 +4427,7 @@ class Product extends CommonObject return ($this->type == Product::TYPE_SERVICE ? true : false); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get a barcode from the module to generate barcode values. * Return value is stored into this->barcode @@ -4388,9 +4436,9 @@ class Product extends CommonObject * @param string $type Barcode type (ean, isbn, ...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_barcode($object,$type='') { + // phpcs:enable global $conf; $result=''; @@ -4509,14 +4557,15 @@ class Product extends CommonObject } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return minimum product recommended price * - * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE + * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function min_recommended_price() { + // phpcs:enable global $conf; $maxpricesupplier=0; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 16ff44e563c..fc36c64a3eb 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -73,7 +73,7 @@ class Productbatch extends CommonObject $error=0; // Clean parameters - $this->clean_param(); + $this->cleanParam(); // Check parameters // Put here code to add control on parameters values @@ -204,7 +204,7 @@ class Productbatch extends CommonObject $error=0; // Clean parameters - $this->clean_param(); + $this->cleanParam(); // TODO Check qty is ok for stock move. Negative may not be allowed. if ($this->qty < 0) @@ -402,8 +402,7 @@ class Productbatch extends CommonObject * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - private function clean_param() + private function cleanParam() { if (isset($this->fk_product_stock)) $this->fk_product_stock=(int) trim($this->fk_product_stock); if (isset($this->batch)) $this->batch=trim($this->batch); diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index bb3782be0bb..0d1d7ae4484 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -38,24 +38,35 @@ class Productcustomerprice extends CommonObject */ public $table_element = 'product_customer_price'; - var $entity; - var $datec = ''; - var $tms = ''; - var $fk_product; - var $fk_soc; - var $price; - var $price_ttc; - var $price_min; - var $price_min_ttc; - var $price_base_type; - var $tva_tx; - var $recuperableonly; - var $localtax1_type; - var $localtax1_tx; - var $localtax2_type; - var $localtax2_tx; - var $fk_user; - var $lines = array (); + public $entity; + public $datec = ''; + public $tms = ''; + public $fk_product; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + + public $price; + public $price_ttc; + public $price_min; + public $price_min_ttc; + public $price_base_type; + public $tva_tx; + public $recuperableonly; + public $localtax1_type; + public $localtax1_tx; + public $localtax2_type; + public $localtax2_tx; + + /** + * @var int User ID + */ + public $fk_user; + + public $lines = array (); + /** * Constructor @@ -304,6 +315,7 @@ class Productcustomerprice extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all customer prices in memory from database * @@ -314,9 +326,9 @@ class Productcustomerprice extends CommonObject * @param array $filter Filter for select * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) { + // phpcs:enable global $langs; if ( empty($sortfield)) $sortfield = "t.rowid"; @@ -418,6 +430,7 @@ class Productcustomerprice extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects in memory from database * @@ -428,9 +441,9 @@ class Productcustomerprice extends CommonObject * @param array $filter Filter for sql request * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_log($sortorder, $sortfield, $limit, $offset, $filter = array()) { + // phpcs:enable global $langs; if (! empty($sortfield)) $sortfield = "t.rowid"; @@ -965,23 +978,33 @@ class PriceByCustomerLine */ public $id; - var $entity; - var $datec = ''; - var $tms = ''; - var $fk_product; - var $fk_soc; - var $price; - var $price_ttc; - var $price_min; - var $price_min_ttc; - var $price_base_type; - var $default_vat_code; - var $tva_tx; - var $recuperableonly; - var $localtax1_tx; - var $localtax2_tx; - var $fk_user; - var $import_key; - var $socname; - var $prodref; + public $entity; + public $datec = ''; + public $tms = ''; + public $fk_product; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + + public $price; + public $price_ttc; + public $price_min; + public $price_min_ttc; + public $price_base_type; + public $default_vat_code; + public $tva_tx; + public $recuperableonly; + public $localtax1_tx; + public $localtax2_tx; + + /** + * @var int User ID + */ + public $fk_user; + + public $import_key; + public $socname; + public $prodref; } diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 75fe5282bd1..e58e09c4bfd 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -223,6 +223,7 @@ class Propalmergepdfproduct extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -230,9 +231,9 @@ class Propalmergepdfproduct extends CommonObject * @param string $lang Lang string code * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_product($product_id, $lang='') { + // phpcs:enable global $langs,$conf; $sql = "SELECT"; @@ -436,6 +437,7 @@ class Propalmergepdfproduct extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object in database * @@ -445,9 +447,9 @@ class Propalmergepdfproduct extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_by_product($user, $product_id, $lang_id='', $notrigger=0) { + // phpcs:enable global $conf, $langs; $error=0; @@ -501,15 +503,16 @@ class Propalmergepdfproduct extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object in database * * @param User $user User that deletes * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_by_file($user) { + // phpcs:enable global $conf, $langs; $error=0; @@ -645,14 +648,14 @@ class PropalmergepdfproductLine */ public $id; - var $fk_product; - var $file_name; - var $lang; - var $fk_user_author; - var $fk_user_mod; - var $datec=''; - var $tms=''; - var $import_key; + public $fk_product; + public $file_name; + public $lang; + public $fk_user_author; + public $fk_user_mod; + public $datec=''; + public $tms=''; + public $import_key; /** * Constructor diff --git a/htdocs/product/dynamic_price/class/index.html b/htdocs/product/dynamic_price/class/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/product/dynamic_price/class/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index 0d991ace9fe..c7300be5d20 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -33,7 +33,7 @@ class PriceExpression * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -43,19 +43,19 @@ class PriceExpression * @var string[] Error codes (or messages) */ public $errors = array(); - + /** * @var int ID */ public $id; - - var $title; - var $expression; - + + public $title; + public $expression; + /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = "c_price_expression"; + * @var string Name of table without prefix where object is stored + */ + public $table_element = "c_price_expression"; /** * Constructor @@ -176,14 +176,15 @@ class PriceExpression } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List all price expressions * * @return array Array of price expressions */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_price_expression() { + // phpcs:enable $sql = "SELECT rowid, title, expression"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " ORDER BY title"; @@ -214,15 +215,16 @@ class PriceExpression } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns any existing rowid with specified title * * @param String $title Title of expression * @return int < 0 if KO, 0 if OK but not found, > 0 rowid */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function find_title($title) { + // phpcs:enable $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE title = '".$this->db->escape($title)."'"; diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index f30260a30c0..ebdba3b5949 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -33,26 +33,31 @@ class PriceGlobalVariable * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) */ public $errors = array(); - + /** * @var int ID */ public $id; - - var $code; - var $description; - var $value; - + + public $code; + + /** + * @var string description + */ + public $description; + + public $value; + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index ca81e40beb6..14ea4357a66 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -33,33 +33,38 @@ class PriceGlobalVariableUpdater * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) */ public $errors = array(); - - var $types=array(0, 1); //!< Updater types - var $update_min = 5; //!< Minimal update rate - + + public $types=array(0, 1); //!< Updater types + public $update_min = 5; //!< Minimal update rate + /** * @var int ID */ public $id; - - var $type; - var $description; - var $parameters; - var $fk_variable; - var $update_interval; //!< Interval in mins - var $next_update; //!< Next update timestamp - var $last_status; - + + public $type; + + /** + * @var string description + */ + public $description; + + public $parameters; + public $fk_variable; + public $update_interval; //!< Interval in mins + public $next_update; //!< Next update timestamp + public $last_status; + /** * @var string Name of table without prefix where object is stored */ @@ -68,7 +73,7 @@ class PriceGlobalVariableUpdater /** * Constructor * - * @param DoliDb $db Database handler + * @param DoliDb $db Database handler */ function __construct($db) { @@ -551,6 +556,7 @@ class PriceGlobalVariableUpdater return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update next_update into database * @@ -559,9 +565,9 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_next_update($next_update, $user=0, $notrigger=0) { + // phpcs:enable $error=0; $this->next_update = $next_update; @@ -596,6 +602,7 @@ class PriceGlobalVariableUpdater } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update last_status into database * @@ -604,9 +611,9 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_status($last_status, $user=0, $notrigger=0) { + // phpcs:enable $error=0; $this->last_status = $last_status; diff --git a/htdocs/product/dynamic_price/index.html b/htdocs/product/dynamic_price/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/product/dynamic_price/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 19fa3e3e627..750b675c92a 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -38,7 +38,7 @@ class Inventory extends CommonObject * @var string ID to identify managed object */ public $element = 'inventory'; - + /** * @var string Name of table without prefix where object is stored */ @@ -48,7 +48,7 @@ class Inventory extends CommonObject * @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; - + /** * @var string String with name of icon for inventory */ @@ -99,9 +99,21 @@ class Inventory extends CommonObject 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'default'=>0, 'arrayofkeyval'=>array(0=>'Todo', 1=>'Done', -1=>'Cancel')), ); + /** + * @var int ID + */ public $rowid; + + /** + * @var string Ref + */ public $ref; + + /** + * @var int Entity + */ public $entity; + public $fk_warehouse; public $date_inventory; public $title; @@ -123,22 +135,22 @@ class Inventory extends CommonObject * @var int Name of subtable line */ //public $table_element_line = 'inventorydet'; - + /** * @var int Field with ID of parent key if this field has a parent */ //public $fk_element = 'fk_inventory'; - + /** * @var int Name of subtable class that manage subtable lines */ //public $class_element_line = 'Inventoryline'; - + /** * @var array Array of child tables (child tables to delete before deleting a record) */ //protected $childtables=array('inventorydet'); - + /** * @var InventoryLine[] Array of subtable lines */ @@ -339,6 +351,7 @@ class Inventory extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -346,9 +359,9 @@ class Inventory extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) @@ -471,10 +484,12 @@ class InventoryObjectLine * @var int ID */ public $id; + /** * @var mixed Sample line property 1 */ public $prop1; + /** * @var mixed Sample line property 2 */ diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 5e72fafbc40..14c2a00d477 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -319,11 +319,12 @@ if ($resql) { $objp = $db->fetch_object($resql); - print '
'; $product=new Product($db); $product->fetch($objp->rowid); $product->load_stock(); + + print '
'; print $product->getNomUrl(1,'',16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; + print ''; if ($objp->seuil_stock_alerte != '' && ($product->stock_theorique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; - print $product->stock_theorique; - print ''.$langs->trans("Movements").''.$product->LibStatut($objp->statut,5,0).'
'; print ''; print ''; print ''; print ''; print ''. ''. ''; print ''; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 3d2e1c99e9b..ce947c2003b 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2017 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +20,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ +if (empty($conf) || ! is_object($conf)) { print "Error, template page can't be called as URL"; exit; } @@ -119,11 +119,11 @@ if (empty($conf) || ! is_object($conf)) print ''; print ''; print ''; print ''; } diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 136f0f0702a..370010b07eb 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2017 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,10 +115,10 @@ if (empty($conf) || ! is_object($conf)) print ''; print ''; print ''; print ''; } diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index f4caef2b5ad..c3351a5efff 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010 François Legastelois + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -366,7 +367,7 @@ $nav.=dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"%A").' '; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"day")." \n"; $nav.=''.img_next($langs->trans("Next"))."\n"; $nav.="   (".$langs->trans("Today").")"; -$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.='
'.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 0).' '; $nav.=' '; $picto='calendarweek'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 200851b6307..fdf7b9ea187 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010 François Legastelois + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -369,7 +370,7 @@ $nav ='".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("WeekShort")." ".$week." \n"; $nav.=''.img_next($langs->trans("Next"))."\n"; $nav.="   (".$langs->trans("Today").")"; -$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.='
'.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 0).' '; $nav.=' '; $picto='calendarweek'; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index bc674b2ba95..dfc0b753559 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -569,12 +569,12 @@ if ($action == 'create' && $user->rights->projet->creer) // Date start print '
'; // Date end print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) @@ -822,7 +822,7 @@ elseif ($object->id > 0) // Date start print ''; // Budget diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 61918622743..9af52721787 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -43,8 +43,16 @@ class Project extends CommonObject */ public $table_element = 'projet'; - public $table_element_line = 'projet_task'; - public $fk_element = 'fk_projet'; + /** + * @var int Name of subtable line + */ + public $table_element_line = 'projet_task'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element = 'fk_projet'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'projectpub'; @@ -53,38 +61,43 @@ class Project extends CommonObject */ protected $table_ref_field = 'ref'; - var $description; + /** + * @var string description + */ + public $description; + /** * @var string * @deprecated * @see title */ public $titre; - var $title; - var $date_start; - var $date_end; - var $date_close; - var $socid; // To store id of thirdparty - var $thirdparty_name; // To store name of thirdparty (defined only in some cases) + public $title; + public $date_start; + public $date_end; + public $date_close; - var $user_author_id; //!< Id of project creator. Not defined if shared project. - var $user_close_id; - var $public; //!< Tell if this is a public or private project - var $budget_amount; - var $bill_time; // Is the time spent on project must be invoiced or not + public $socid; // To store id of thirdparty + public $thirdparty_name; // To store name of thirdparty (defined only in some cases) - var $statuts_short; - var $statuts_long; + public $user_author_id; //!< Id of project creator. Not defined if shared project. + public $user_close_id; + public $public; //!< Tell if this is a public or private project + public $budget_amount; + public $bill_time; // Is the time spent on project must be invoiced or not - var $statut; // 0=draft, 1=opened, 2=closed - var $opp_status; // opportunity status, into table llx_c_lead_status - var $opp_percent; // opportunity probability + public $statuts_short; + public $statuts_long; - var $oldcopy; + public $statut; // 0=draft, 1=opened, 2=closed + public $opp_status; // opportunity status, into table llx_c_lead_status + public $opp_percent; // opportunity probability - var $weekWorkLoad; // Used to store workload details of a projet - var $weekWorkLoadPerTask; // Used to store workload details of tasks of a projet + public $oldcopy; + + public $weekWorkLoad; // Used to store workload details of a projet + public $weekWorkLoadPerTask; // Used to store workload details of tasks of a projet /** * @var int Creation date @@ -92,16 +105,19 @@ class Project extends CommonObject * @see date_c */ public $datec; + /** * @var int Creation date */ public $date_c; + /** * @var int Modification date * @deprecated * @see date_m */ public $datem; + /** * @var int Modification date */ @@ -116,10 +132,12 @@ class Project extends CommonObject * Draft status */ const STATUS_DRAFT = 0; + /** * Open/Validated status */ const STATUS_VALIDATED = 1; + /** * Closed status */ @@ -476,15 +494,16 @@ class Project extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of projects * * @param int $socid To filter on a particular third party * @return array List of projects */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($socid='') { + // phpcs:enable global $conf; $projects = array(); @@ -518,6 +537,7 @@ class Project extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of elements for type, linked to a project * @@ -529,9 +549,9 @@ class Project extends CommonObject * @param string $projectkey Equivalent key to fk_projet for actual type * @return mixed Array list of object ids linked to project, < 0 or string if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='', $projectkey='fk_projet') { + // phpcs:enable $elements = array(); if ($this->id <= 0) return $elements; @@ -907,6 +927,7 @@ class Project extends CommonObject return $this->LibStatut($this->statut, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi status label for a status * @@ -914,9 +935,9 @@ class Project extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0) { + // phpcs:enable global $langs; if ($mode == 0) @@ -1580,16 +1601,17 @@ class Project extends CommonObject } - /** - * Associate element to a project - * - * @param string $tableName Table of the element to update - * @param int $elementSelectId Key-rowid of the line of the element to update - * @return int 1 if OK or < 0 if KO - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Associate element to a project + * + * @param string $tableName Table of the element to update + * @param int $elementSelectId Key-rowid of the line of the element to update + * @return int 1 if OK or < 0 if KO + */ function update_element($tableName, $elementSelectId) { + // phpcs:enable $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; if ($tableName == "actioncomm") @@ -1613,6 +1635,7 @@ class Project extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Associate element to a project * @@ -1620,9 +1643,9 @@ class Project extends CommonObject * @param int $elementSelectId Key-rowid of the line of the element to update * @return int 1 if OK or < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_element($tableName, $elementSelectId) { + // phpcs:enable $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; if ($TableName=="actioncomm") @@ -1744,15 +1767,16 @@ class Project extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; // For external user, no check is done on company because readability is managed by public status of project and assignement. @@ -1829,14 +1853,15 @@ class Project extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 9404bbc5aaa..aec0f40443e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -41,7 +41,11 @@ class Task extends CommonObject */ public $table_element='projet_task'; + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_task'; + public $picto = 'task'; protected $childtables=array('projet_task_time'); // To test if we can delete object @@ -52,7 +56,11 @@ class Task extends CommonObject */ public $label; - var $description; + /** + * @var string description + */ + public $description; + var $duration_effective; // total of time spent on this task var $planned_workload; var $date_c; @@ -1711,6 +1719,7 @@ class Task extends CommonObject return $this->LibStatut($this->fk_statut, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for an object * @@ -1718,9 +1727,9 @@ class Task extends CommonObject * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0) { + // phpcs:enable // list of Statut of the task $this->statuts[0]='Draft'; $this->statuts[1]='ToDo'; @@ -1739,59 +1748,59 @@ class Task extends CommonObject { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); + elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); + elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); - if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); - if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); - if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { /*if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - if ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - if ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + elseif ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); + elseif ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); + elseif ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); */ - //return $this->progress.' %'; + //else return $this->progress.' %'; return ' '; } - if ($mode == 6) + elseif ($mode == 6) { /*if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + elseif ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); + elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); + elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); */ - //return $this->progress.' %'; + //else return $this->progress.' %'; return ' '; } } @@ -1829,15 +1838,16 @@ class Task extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; // For external user, no check is done on company because readability is managed by public status of project and assignement. @@ -1903,14 +1913,15 @@ class Task extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $mine=0; $socid=$user->societe_id; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 23ecadd9939..83ebdc47507 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -292,7 +292,7 @@ $listofreferent=array( 'class'=>'SupplierProposal', 'table'=>'supplier_proposal', 'datefieldname'=>'date', - 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'supplier_proposal', 'buttonnew'=>'AddSupplierProposal', 'testnew'=>$user->rights->supplier_proposal->creer, @@ -529,10 +529,10 @@ if (! $showdatefilter) print ''; print '
'; - $form->select_date($pdluo->eatby,'eatby','','',1,'',1,0,1); + print $form->selectDate($pdluo->eatby,'eatby','','',1,'',1,0); print ''; - $form->select_date($pdluo->sellby,'sellby','','',1,'',1,0,1); + print $form->selectDate($pdluo->sellby,'sellby','','',1,'',1,0); print ''.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').''; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index ce1dd5126a9..316d463fb27 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -1,7 +1,8 @@ - * Copyright (C) 2014 Regis Houssin + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Regis Houssin + * Copyright (C) 2018 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -195,10 +196,10 @@ if ($resql) ''. ''. - $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). + $form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, ''). ''; - $searchpicto=$form->showFilterAndCheckAddButtons(0); + $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$langs->trans("EatByDate").''; $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - $form->select_date($eatbyselected,'eatby','','',1,""); + print $form->selectDate($eatbyselected,'eatby','','',1,""); print ''.$langs->trans("SellByDate").''; $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - $form->select_date($sellbyselected,'sellby','','',1,""); + print $form->selectDate($sellbyselected,'sellby','','',1,""); print '
'.$langs->trans("EatByDate").''; - print $form->select_date(($d_eatby?$d_eatby:$pdluo->eatby),'eatby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby),'eatby','','',1,"", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print ''.$langs->trans("SellByDate").''; - print $form->select_date(($d_sellby?$d_sellby:$pdluo->sellby),'sellby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby),'sellby','','',1,"", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print '
'.$langs->trans("DateStart").''; - print $form->select_date(($date_start?$date_start:''),'projectstart',0,0,0,'',1,0,1); + print $form->selectDate(($date_start?$date_start:''), 'projectstart', 0, 0, 0, '', 1, 0); print '
'.$langs->trans("DateEnd").''; - print $form->select_date(($date_end?$date_end:-1),'projectend',0,0,0,'',1,0,1); + print $form->selectDate(($date_end?$date_end:-1), 'projectend', 0, 0, 0, '', 1, 0); print '
'.$langs->trans("DateStart").''; - print $form->select_date($object->date_start?$object->date_start:-1,'projectstart',0,0,0,'',1,0,1); + print $form->selectDate($object->date_start?$object->date_start:-1, 'projectstart', 0, 0, 0, '', 1, 0); print '     '. $langs->trans("ProjectReportDate"); @@ -830,7 +830,7 @@ elseif ($object->id > 0) // Date end print '
'.$langs->trans("DateEnd").''; - print $form->select_date($object->date_end?$object->date_end:-1,'projectend',0,0,0,'',1,0,1); + print $form->selectDate($object->date_end?$object->date_end:-1, 'projectend', 0, 0, 0, '', 1, 0); print '
'; print ''; print ''; print ''; print ''; print ''; -$var = false; - foreach ($listofreferent as $key => $value) { $name=$langs->trans($value['name']); @@ -760,9 +758,9 @@ foreach ($listofreferent as $key => $value) if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew) { $addform.='
'; - if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).' '; elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { - $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).' '; } $addform.='
'; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9ea8e133102..60fc718040f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -70,7 +70,7 @@ $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; -$search_all=GETPOST('search_all', 'alphanohtml'); +$search_all=GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); $search_categ=GETPOST("search_categ",'alpha'); $search_ref=GETPOST("search_ref"); $search_label=GETPOST("search_label"); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c10dc2b9c42..bffe5f4a373 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -480,12 +480,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Date start print '
'; // Date end print ''; // Planned workload diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index b7588257455..fa9796449db 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -390,12 +391,12 @@ if ($id > 0 || ! empty($ref)) // Date start print ''; // Date end print ''; // Planned workload diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 18adfc47bed..e432fcdf7fd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -580,7 +581,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; // Contributor @@ -759,7 +760,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; // Task @@ -965,9 +966,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) { if (empty($task_time->task_date_withhour)) { - print $form->select_date(($date2?$date2:$date1),'timeline',3,3,2,"timespent_date",1,0,1); + print $form->selectDate(($date2?$date2:$date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); } - else print $form->select_date(($date2?$date2:$date1),'timeline',1,1,2,"timespent_date",1,0,1); + else print $form->selectDate(($date2?$date2:$date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); } else { diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 3bee8fd6434..49e1a2de561 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -103,15 +103,14 @@ if (! empty($id)) dol_syslog("cron_run_jobs.php Bad value for parameter job id", LOG_WARNING); exit; } - $filter=array(); $filter['t.rowid']=$id; } -$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter, 0); +$result = $object->fetch_all('ASC,ASC,ASC','t.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0); if ($result<0) { - echo "Error: ".$cronjob->error; - dol_syslog("cron_run_jobs.php fetch Error".$cronjob->error, LOG_WARNING); + echo "Error: ".$object->error; + dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_WARNING); exit; } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 5edf85f9dac..7e09e990221 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -4,6 +4,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 J. Fernando Lagrange + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,11 +100,11 @@ function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayo if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('thumbs/'.$mysoc->logo_small); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); } elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($mysoc->logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); $width=128; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) @@ -624,7 +625,7 @@ if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) } // Birthday print ''."\n"; // Photo print ''."\n"; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 9535ae16583..43508cfe177 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -180,11 +180,11 @@ else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONL $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('thumbs/'.$logosmall); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode($logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $width=96; } // Output html code for logo diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 51536ad5b0b..c1bfd167b51 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -681,12 +681,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global-> $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('thumbs/'.$logosmall); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $width=150; } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode($logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $width=150; } // Output html code for logo diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index bdc301a0dce..01bee23d124 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -219,12 +219,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global-> $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); $width=150; } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$logo); $width=150; } // Output html code for logo diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 47e22e12c8b..b46f651f9b4 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -157,12 +157,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global-> $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); $width=150; } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$logo); $width=150; } // Output html code for logo @@ -534,7 +534,7 @@ if ($ispaymentok) $listofmimes=array(dol_mimetype($file)); } - $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1); + $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1); if ($result < 0) { @@ -546,6 +546,8 @@ if ($ispaymentok) { if ($file) $postactionmessages[] = 'Email sent to member (with invoice document attached)'; else $postactionmessages[] = 'Email sent to member (without any attached document)'; + + // TODO Add actioncomm event } } } @@ -799,6 +801,11 @@ if ($ispaymentok) $content.="
\n"; $content.="tag=".$fulltag."
\ntoken=".$onlinetoken."
\npaymentType=".$paymentType."
\ncurrencycodeType=".$currencyCodeType."
\npayerId=".$payerID."
\nipaddress=".$ipaddress."
\nFinalPaymentAmt=".$FinalPaymentAmt."
\n"; + if (! empty($ErrorCode)) $content.="ErrorCode = ".$ErrorCode."
\n"; + if (! empty($ErrorShortMsg)) $content.="ErrorShortMsg = ".$ErrorShortMsg."
\n"; + if (! empty($ErrorLongMsg)) $content.="ErrorLongMsg = ".$ErrorLongMsg."
\n"; + if (! empty($ErrorSeverityCode)) $content.="ErrorSeverityCode = ".$ErrorSeverityCode."
\n"; + $ishtml=dol_textishtml($content); // May contain urls require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 1e6adb7ca51..72a43dcbc7b 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -43,14 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; // Security check if (empty($conf->paypal->enabled)) accessforbidden('',0,0,1); -$langs->load("main"); -$langs->load("other"); -$langs->load("dict"); -$langs->load("bills"); -$langs->load("companies"); -$langs->load("paybox"); -$langs->load("paypal"); -$langs->load("stripe"); +$langs->loadLangs(array("main","other","dict","bills","companies","paybox","paypal","stripe")); // Clean parameters $PAYPAL_API_USER=""; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index faca27f78c7..e1b160541b2 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php'; // You can find your endpoint's secret in your webhook settings if (isset($_GET['connect'])){ @@ -86,9 +88,12 @@ catch(\UnexpectedValueException $e) { // Do something with $event http_response_code(200); // PHP 5.4 or greater + $langs->load("main"); + +// TODO Do we really need a user in setup just to have an name to fill an email topic when it is a technical system notification email $user = new User($db); -$user->fetch(5); +$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights(); if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) { @@ -126,12 +131,37 @@ if ($event->type == 'payout.created') { if ($result > 0) { - // TODO Use CMail and translation - $body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); - $subject = '[NOTIFICATION] Virement programmée'; - $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard - mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); - return 1; + $subject = '[NOTIFICATION] Stripe payout scheduled'; + if (!empty($user->email)) { + $sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">"; + } else { + $sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; + } + $replyto = $sendto; + $sendtocc = ''; + if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) { + $sendtocc = $conf->global->ONLINE_PAYMENT_SENDEMAIL.'" <'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'>'; + } + + $message = "A bank transfer of ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour'); + + $mailfile = new CMailFile( + $subject, + $sendto, + $replyto, + $message, + array(), + array(), + array(), + $sendtocc, + '', + 0, + -1 + ); + + $ret = $mailfile->sendfile(); + + return 1; } else { diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 02f5786632c..e3a5f33cbeb 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -174,9 +174,9 @@ if ($showbirthday) $nav.=''; if ($pid) $nav.=''; if ($type) $nav.=''; if ($usergroup) $nav.=''; -$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); -$nav.=' '; -$nav.=''; +$nav.= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); +$nav.= ' '; +$nav.= ''; $limit=10; print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit); diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index 614b10c976a..343acab9a4a 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -27,29 +27,29 @@ This page is a sample of page using Dolibarr HTML widget methods. It is designed select_date using tzuser date +// Test1: form->selectDate using tzuser date print "Test 1a: We must have here current date and hour for user (must match hour on browser). Note: Check your are logged so user TZ and DST are known."; $offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; $offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60; print " (dol_tz=".$offsettz." dol_dst=".$dol_dst.")
\n"; -$form->select_date(dol_now(), 'test1a', 1, 1, 0); +print $form->selectDate(dol_now(), 'test1a', 1, 1, 0); print '

'."\n"; print "Test 1b: We must have here current date with hours to 00:00.
"; -$form->select_date('', 'test1b', 1, 1, 0); +print $form->selectDate('', 'test1b', 1, 1, 0); print '

'."\n"; -// Test2: form->select_date using tzuser date +// Test2: form->selectDate using tzuser date print "Test 2: We must have here 1970-01-01 00:00:00 selected (fields can be empty)
\n"; -$form->select_date(dol_get_first_day(1970,1,false), 'test2', 1, 1, 1); +print $form->selectDate(dol_get_first_day(1970,1,false), 'test2', 1, 1, 1); print '

'."\n"; -// Test3: form->select_date for 1970-01-01 00:00:00 +// Test3: form->selectDate for 1970-01-01 00:00:00 print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)
\n"; -$form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); +print $form->selectDate(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); print '

'."\n"; diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php index 674651f9e29..3e2462d889c 100644 --- a/htdocs/public/website/styles.css.php +++ b/htdocs/public/website/styles.css.php @@ -85,7 +85,7 @@ if (empty($pageid)) $objectpage=new WebsitePage($db); $array=$objectpage->fetchAll($object->id); - if (count($array) > 0) + if (is_array($array) && count($array) > 0) { $firstrep=reset($array); $pageid=$firstrep->id; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 13de6e62ccf..4d3a4a55c74 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -333,15 +333,16 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * * @param int $id id object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_element_resource($id) { + // phpcs:enable global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -478,6 +479,7 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load resource objects into $this->lines * @@ -488,9 +490,9 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='') { + // phpcs:enable global $conf; $sql="SELECT "; $sql.= " t.rowid,"; @@ -574,6 +576,7 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects into $this->lines * @@ -584,9 +587,9 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter='') { + // phpcs:enable global $conf; $sql="SELECT "; $sql.= " t.rowid,"; @@ -652,6 +655,7 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects into $this->lines * @@ -662,9 +666,9 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_used($sortorder, $sortfield, $limit, $offset=1, $filter='') { + // phpcs:enable global $conf; if ( ! $sortorder) $sortorder="ASC"; @@ -730,6 +734,7 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch all resources available, declared by modules * Load available resource in array $this->available_resources @@ -738,9 +743,9 @@ class Dolresource extends CommonObject * @deprecated, remplaced by hook getElementResources * @see getElementResources() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_available() { + // phpcs:enable global $conf; if (! empty($conf->modules_parts['resources'])) @@ -752,6 +757,7 @@ class Dolresource extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update element resource into database * @@ -759,9 +765,9 @@ class Dolresource extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_element_resource($user=null, $notrigger=0) { + // phpcs:enable global $conf, $langs; $error=0; @@ -880,14 +886,15 @@ class Dolresource extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load in cache resource type code (setup in dictionary) * * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_code_type_resource() { + // phpcs:enable global $langs; if (count($this->cache_code_type_resource)) return 0; // Cache deja charge @@ -967,6 +974,7 @@ class Dolresource extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -974,9 +982,9 @@ class Dolresource extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 6ed6038af81..b95ba78e2be 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -60,6 +60,7 @@ class FormResource } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a resource * @@ -75,9 +76,9 @@ class FormResource * @param int $limit Limit number of answers * @return string HTML string with */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_resource_list($selected='',$htmlname='fk_resource',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array(), $filterkey='', $outputmode=0, $limit=20) { + // phpcs:enable global $conf,$user,$langs; $out=''; @@ -155,6 +156,7 @@ class FormResource return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return html list of tickets type * @@ -167,9 +169,9 @@ class FormResource * @param int $maxlength Max length of label * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_types_resource($selected='',$htmlname='type_resource',$filtertype='',$format=0, $empty=0, $noadmininfo=0,$maxlength=0) { + // phpcs:enable global $langs,$user; $resourcestat = new Dolresource($this->db); diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 30b1667afcf..2577f5bed5d 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -31,7 +31,7 @@ abstract class ActionsCardCommon * @var DoliDB Database handler. */ public $db; - + var $dirmodule; var $targetmodule; var $canvas; @@ -41,12 +41,12 @@ abstract class ActionsCardCommon var $tpl = array(); //! Object container var $object; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) @@ -70,6 +70,7 @@ abstract class ActionsCardCommon $this->object = $object; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -78,9 +79,9 @@ abstract class ActionsCardCommon * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $conf, $langs, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; @@ -370,15 +371,16 @@ abstract class ActionsCardCommon } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign POST values into object * * @param string $action Action string * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post($action) { + // phpcs:enable global $langs, $mysoc; $this->object->id = $_POST["socid"]; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 1949f696a86..3e18b7944f2 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -67,6 +67,7 @@ class ActionsCardCompany extends ActionsCardCommon } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -75,9 +76,9 @@ class ActionsCardCompany extends ActionsCardCommon * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $conf, $langs, $user, $mysoc; global $form, $formadmin, $formcompany; diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index c662ce2ae6f..5fd7ee01faf 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -84,6 +84,7 @@ class ActionsCardIndividual extends ActionsCardCommon return $return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -92,9 +93,9 @@ class ActionsCardIndividual extends ActionsCardCommon * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $conf, $langs; global $form, $formcompany; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5343c5509a1..427995254fc 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1962,7 +1962,7 @@ else // Capital print '
'; print ''; // Assign a Name diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 1cb4f1c4b65..5f8d8036b22 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -33,7 +33,11 @@ class Address { protected $db; + /** + * @var int ID + */ public $id; + public $type; public $label; public $socid; @@ -230,6 +234,7 @@ class Address } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge depuis la base toutes les adresses d'une societe * @@ -237,9 +242,9 @@ class Address * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($socid, $user=null) { + // phpcs:enable global $langs, $conf; $sql = 'SELECT rowid, nom as name, client, fournisseur'; @@ -324,6 +329,7 @@ class Address } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge depuis la base l'objet adresse * @@ -331,9 +337,9 @@ class Address * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_address($id, $user=null) { + // phpcs:enable global $langs; global $conf; @@ -496,7 +502,12 @@ class Address class AddressLine { protected $db; + + /** + * @var int ID + */ public $id; + public $date_creation; public $date_modification; public $label; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 9c24aecae85..400dc65b0c2 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -47,14 +47,15 @@ class Client extends Societe $this->fournisseur = 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators into this->nb for board * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array("customers" => 0,"prospects" => 0); diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 4f3b666049b..d948ba1d237 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -36,22 +36,22 @@ class CompanyPaymentMode extends CommonObject * @var string ID to identify managed object */ public $element = 'companypaymentmode'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'societe_rib'; - + /** * @var int Does companypaymentmode support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 2; - + /** * @var int Does companypaymentmode support extrafields ? 0=No, 1=Yes */ public $isextrafieldmanaged = 0; - + /** * @var string String with name of icon for companypaymentmode. Must be the part after the 'object_' into object_companypaymentmode.png */ @@ -118,8 +118,17 @@ class CompanyPaymentMode extends CommonObject 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>-2, 'position'=>105), //'aaa' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>0, 'visible'=>-2, 'position'=>185), ); + + /** + * @var int ID + */ public $rowid; - public $fk_soc; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + public $label; public $bank; public $code_banque; @@ -452,6 +461,7 @@ class CompanyPaymentMode extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -459,43 +469,37 @@ class CompanyPaymentMode extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5c15f82952f..53dc04218fa 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -51,7 +51,11 @@ class Societe extends CommonObject */ public $table_element = 'societe'; + /** + * @var int Field with ID of parent key if this field has a parent + */ public $fk_element='fk_soc'; + public $fieldsforcombobox='nom,name_alias'; protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); @@ -90,6 +94,9 @@ class Societe extends CommonObject ); + /** + * @var int Entity + */ public $entity; /** @@ -374,7 +381,11 @@ class Societe extends CommonObject */ public $default_lang; + /** + * @var string Ref + */ public $ref; + public $ref_int; /** * External user reference. @@ -571,15 +582,16 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a contact/address from thirdparty * * @param User $user Object user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_individual(User $user) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contact=new Contact($this->db); @@ -1475,14 +1487,15 @@ class Societe extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define third party as a customer * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_as_client() { + // phpcs:enable if ($this->id) { $newclient=1; @@ -1502,6 +1515,7 @@ class Societe extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1510,9 +1524,9 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_client($remise, $note, User $user) { + // phpcs:enable global $conf, $langs; // Nettoyage parametres @@ -1564,6 +1578,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1572,9 +1587,9 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_supplier($remise, $note, User $user) { + // phpcs:enable global $conf, $langs; // Nettoyage parametres @@ -1626,6 +1641,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount for third party * @@ -1636,9 +1652,9 @@ class Societe extends CommonObject * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, id of discount record if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_except($remise, User $user, $desc, $tva_tx=0, $discount_type=0) { + // phpcs:enable global $langs; // Clean parameters @@ -1771,6 +1787,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the price level * @@ -1778,9 +1795,9 @@ class Societe extends CommonObject * @param User $user Use making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_price_level($price_level, User $user) { + // phpcs:enable if ($this->id) { $now=dol_now(); @@ -1809,6 +1826,7 @@ class Societe extends CommonObject return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1816,14 +1834,12 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_commercial(User $user, $commid) { + // phpcs:enable $error=0; - - if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; @@ -1848,6 +1864,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1855,9 +1872,9 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_commercial(User $user, $commid) { + // phpcs:enable $error=0; $this->context=array('commercial_modified'=>$commid); @@ -2069,6 +2086,7 @@ class Societe extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2076,9 +2094,9 @@ class Societe extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('companies'); @@ -2119,15 +2137,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails existing for third party * * @param int $addthirdparty 1=Add also a record for thirdparty email * @return array Array of contacts emails */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_email_array($addthirdparty=0) { + // phpcs:enable global $langs; $contact_emails = $this->contact_property_array('email',1); @@ -2140,14 +2159,15 @@ class Societe extends CommonObject return $contact_emails; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts mobile phone existing for third party * * @return array Array of contacts emails */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_phone_array() { + // phpcs:enable global $langs; $contact_phone = $this->contact_property_array('mobile'); @@ -2161,6 +2181,7 @@ class Societe extends CommonObject return $contact_phone; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails or mobile existing for third party * @@ -2168,9 +2189,9 @@ class Societe extends CommonObject * @param int $hidedisabled 1=Hide contact if disabled * @return array Array of contacts emails or mobile. Example: array(id=>'Name ') */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_property_array($mode='email', $hidedisabled=0) { + // phpcs:enable global $langs; $contact_property = array(); @@ -2230,14 +2251,15 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array tableau des contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array() { + // phpcs:enable $contacts = array(); $sql = "SELECT rowid, lastname, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$this->id; @@ -2263,14 +2285,15 @@ class Societe extends CommonObject return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array $contacts tableau des contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array_objects() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $contacts = array(); @@ -2299,6 +2322,7 @@ class Societe extends CommonObject return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return property of contact from its id * @@ -2306,9 +2330,9 @@ class Societe extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of contact with format: "Full name " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_get_property($rowid,$mode) { + // phpcs:enable $contact_property=''; if (empty($rowid)) return ''; @@ -2338,15 +2362,16 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return bank number property of thirdparty (label or rum) * * @param string $mode 'label' or 'rum' or 'format' * @return string Bank number */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_rib($mode='label') { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($this->db); @@ -2375,14 +2400,15 @@ class Societe extends CommonObject return 'BadParameterToFunctionDisplayRib'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Array of RIB * * @return array|int 0 if KO, Array of CompanyBanckAccount if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_rib() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".$this->id; $result = $this->db->query($sql); @@ -2404,6 +2430,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attribut un code client a partir du module de controle des codes. * Return value is stored into this->code_client @@ -2412,9 +2439,9 @@ class Societe extends CommonObject * @param int $type Should be 0 to say customer * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codeclient($objsoc=0,$type=0) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2435,6 +2462,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attribut un code fournisseur a partir du module de controle des codes. * Return value is stored into this->code_fournisseur @@ -2443,9 +2471,9 @@ class Societe extends CommonObject * @param int $type Should be 1 to say supplier * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codefournisseur($objsoc=0,$type=1) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2465,15 +2493,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si un code client est modifiable en fonction des parametres * du module de controle des codes. * * @return int 0=No, 1=Yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codeclient_modifiable() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2501,14 +2530,15 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes * * @return int 0=No, 1=Yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codefournisseur_modifiable() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2536,6 +2566,7 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check customer code * @@ -2545,9 +2576,9 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codeclient() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2572,6 +2603,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check supplier code * @@ -2581,9 +2613,9 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codefournisseur() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2608,6 +2640,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie un code compta, suivant le module de code compta. * Peut etre identique a celui saisit ou genere automatiquement. @@ -2616,9 +2649,9 @@ class Societe extends CommonObject * @param string $type Type of thirdparty ('customer' or 'supplier') * @return string Code compta si ok, 0 si aucun, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codecompta($type) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) @@ -2659,15 +2692,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define parent commany of current company * * @param int $id Id of thirdparty to set or '' to remove * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_parent($id) { + // phpcs:enable if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; @@ -2688,15 +2722,16 @@ class Societe extends CommonObject else return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns if a profid sould be verified * * @param int $idprof 1,2,3,4,5,6 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm,5=idprof5,6=idprof6) * @return boolean true , false */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_verifiable($idprof) { + // phpcs:enable global $conf; switch($idprof) @@ -2726,6 +2761,7 @@ class Societe extends CommonObject return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verify if a profid exists into database for others thirds * @@ -2734,9 +2770,9 @@ class Societe extends CommonObject * @param int $socid Id of thirdparty to exclude (if update) * @return boolean True if exists, False if not */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_exists($idprof, $value, $socid=0) { + // phpcs:enable $field = $idprof; switch($idprof) // For backward compatibility @@ -2785,6 +2821,7 @@ class Societe extends CommonObject else return false; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...) * @@ -2793,9 +2830,9 @@ class Societe extends CommonObject * @return int <=0 if KO, >0 if OK * TODO better to have this in a lib than into a business class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_check($idprof,$soc) { + // phpcs:enable global $conf; $ok=1; @@ -2935,6 +2972,7 @@ class Societe extends CommonObject return $ok; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an url to check online a professional id or empty string * @@ -2943,9 +2981,9 @@ class Societe extends CommonObject * @return string Url or empty string if no URL known * TODO better in a lib than into business class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_url($idprof,$thirdparty) { + // phpcs:enable global $conf,$langs,$hookmanager; $url=''; @@ -2988,14 +3026,15 @@ class Societe extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Indique si la societe a des projets * * @return bool true si la societe a des projets, false sinon */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function has_projects() { + // phpcs:enable $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; $resql = $this->db->query($sql); if ($resql) @@ -3090,14 +3129,15 @@ class Societe extends CommonObject return isInEEC($this); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge la liste des categories fournisseurs * * @return int 0 if success, <> 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadSupplierCateg() { + // phpcs:enable $this->SupplierCategories = array(); $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; @@ -3118,15 +3158,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert link supplier - category * * @param int $categorie_id Id of category * @return int 0 if success, <> 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFournisseurInCategory($categorie_id) { + // phpcs:enable if ($categorie_id > 0 && $this->id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_fournisseur (fk_categorie, fk_soc) "; @@ -3142,6 +3183,7 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a third party into database from a member object * @@ -3150,9 +3192,9 @@ class Societe extends CommonObject * @param string $socalias Alias name of third party to force * @return int <0 if KO, id of created account if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member(Adherent $member, $socname='', $socalias='') { + // phpcs:enable global $user,$langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -3419,15 +3461,16 @@ class Societe extends CommonObject return $this->LibProspLevel($this->fk_prospectlevel); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of prospect level * * @param int $fk_prospectlevel Prospect level * @return string label of level */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspLevel($fk_prospectlevel) { + // phpcs:enable global $langs; $lib=$langs->trans("ProspectLevel".$fk_prospectlevel); @@ -3440,6 +3483,7 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set prospect level * @@ -3447,9 +3491,9 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_prospect_level(User $user) { + // phpcs:enable return $this->update($this->id, $user); } @@ -3465,6 +3509,7 @@ class Societe extends CommonObject return $this->LibProspCommStatut($this->stcomm_id, $mode, $label); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3473,9 +3518,9 @@ class Societe extends CommonObject * @param string $label Label to use for status for added status * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspCommStatut($statut, $mode=0, $label='') { + // phpcs:enable global $langs; $langs->load('customers'); @@ -3519,6 +3564,7 @@ class Societe extends CommonObject return "Error, mode/status not found"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set outstanding value * @@ -3526,9 +3572,9 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_OutstandingBill(User $user) { + // phpcs:enable return $this->update($this->id, $user); } @@ -3685,15 +3731,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return amount of bill not paid * * @return int Amount in debt for thirdparty * @deprecated */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_OutstandingBill() { + // phpcs:enable /* Accurate value of remain to pay is to sum remaintopay for each invoice $paiement = $invoice->getSommePaiement(); $creditnotes=$invoice->getSumCreditNotesUsed(); @@ -3739,15 +3786,16 @@ class Societe extends CommonObject return $this->LibCustProspStatut($this->client); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibCustProspStatut($statut) { + // phpcs:enable global $langs; $langs->load('companies'); diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index e6aabf68f6d..690eacd4037 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -39,17 +39,17 @@ class SocieteAccount extends CommonObject * @var string ID to identify managed object */ public $element = 'societeaccount'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'societe_account'; - + /** * @var array Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var string String with name of icon for societeaccount. Must be the part after the 'object_' into object_myobject.png */ @@ -100,13 +100,23 @@ class SocieteAccount extends CommonObject 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'default'=>1, 'arrayofkeyval'=>array('1'=>'Active','0'=>'Disabled')), ); public $rowid; + + /** + * @var int Entity + */ public $entity; + public $key_account; public $login; public $pass_encoding; public $pass_crypted; public $pass_temp; - public $fk_soc; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + public $site; public $date_last_login; public $date_previous_login; @@ -395,6 +405,7 @@ class SocieteAccount extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -402,9 +413,9 @@ class SocieteAccount extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index bce7fe94541..b74b66a1a44 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -361,7 +361,7 @@ if ($sql_select) { $resql=$db->query($sql); if (!$resql) dol_print_error($db); - + $num = $db->num_rows($resql); $param="&socid=".$socid."&type_element=".$type_element; @@ -384,7 +384,7 @@ if ($sql_select) print ''; print ''; print ''; print ''; // Name diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 7b2272c407b..970f3085392 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -84,10 +84,10 @@ $search_categ_cus=trim(GETPOST("search_categ_cus",'int')); $search_categ_sup=trim(GETPOST("search_categ_sup",'int')); $search_country=GETPOST("search_country",'intcomma'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); +$search_staff=GETPOST("search_staff",'int'); $search_status=GETPOST("search_status",'int'); $search_type=GETPOST('search_type','alpha'); -$search_level_from = GETPOST("search_level_from","alpha"); -$search_level_to = GETPOST("search_level_to","alpha"); +$search_level = GETPOST("search_level", "array"); $search_stcomm=GETPOST('search_stcomm','int'); $search_import_key = GETPOST("search_import_key","alpha"); $search_btn=GETPOST('button_search','alpha'); @@ -184,6 +184,7 @@ $arrayfields=array( 's.phone'=>array('label'=>"Phone", 'checked'=>1), 's.fax'=>array('label'=>"Fax", 'checked'=>0), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), + 'staff.code'=>array('label'=>"Staff", 'checked'=>0), 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), @@ -258,10 +259,10 @@ if (empty($reshook)) $search_vat=''; $search_type=''; $search_type_thirdparty=''; + $search_staff=''; $search_status=-1; $search_stcomm=''; - $search_level_from=''; - $search_level_to=''; + $search_level=''; $search_import_key=''; $toselect=''; $search_array_options=array(); @@ -318,80 +319,22 @@ if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$la if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects"); if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers"); -// If both parameters are set, search for everything BETWEEN them -if ($search_level_from != '' && $search_level_to != '') -{ - // Ensure that these parameters are numbers - $search_level_from = (int) $search_level_from; - $search_level_to = (int) $search_level_to; - - // If from is greater than to, reverse orders - if ($search_level_from > $search_level_to) - { - $tmp = $search_level_to; - $search_level_to = $search_level_from; - $search_level_from = $tmp; - } - - // Generate the SQL request - $sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range'; -} -// If only "from" parameter is set, search for everything GREATER THAN it -else if ($search_level_from != '') -{ - // Ensure that this parameter is a number - $search_level_from = (int) $search_level_from; - - // Generate the SQL request - $sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range'; -} -// If only "to" parameter is set, search for everything LOWER THAN it -else if ($search_level_to != '') -{ - // Ensure that this parameter is a number - $search_level_to = (int) $search_level_to; - - // Generate the SQL request - $sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range'; -} -// If no parameters are set, dont search for anything -else -{ - $sortwhere = '0 as is_in_range'; -} - // Select every potentiels, and note each potentiels which fit in search parameters -dol_syslog('societe/list.php',LOG_DEBUG); -$sql = "SELECT code, label, sortorder, ".$sortwhere; +$tab_level = array(); +$sql = "SELECT code, label, sortorder"; $sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $sql.= " WHERE active > 0"; $sql.= " ORDER BY sortorder"; - $resql = $db->query($sql); if ($resql) { - $tab_level = array(); - $search_levels = array(); - while ($obj = $db->fetch_object($resql)) { // Compute level text $level=$langs->trans($obj->code); if ($level == $obj->code) $level=$langs->trans($obj->label); - - // Put it in the array sorted by sortorder - $tab_level[$obj->sortorder] = $level; - - // If this potentiel fit in parameters, add its code to the $search_levels array - if ($obj->is_in_range == 1) - { - $search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"'; - } + $tab_level[$obj->code] = $level; } - - // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. - // If no paramters was set, $search_levels will be empty - $search_levels = implode(',', $search_levels); } else dol_print_error($db); @@ -401,6 +344,7 @@ $sql.= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, $sql.= " s.tms as date_update, s.datec as date_creation,"; $sql.= " s.code_compta,s.code_compta_fournisseur,"; $sql.= " typent.code as typent_code,"; +$sql.= " staff.code as staff_code,"; $sql.= " country.code as country_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " region.code_region as region_code, region.nom as region_name"; @@ -419,16 +363,16 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; // We'll need this table joined to the select in order to filter by categ if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ -$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // We'll need this table joined to the select in order to filter by sale if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE s.fk_stcomm = st.id"; -$sql.= " AND s.entity IN (".getEntity('societe').")"; +$sql.= " WHERE s.entity IN (".getEntity('societe').")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale @@ -453,8 +397,8 @@ if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fourniss if ($search_town) $sql.= natural_search("s.town",$search_town); if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); -if ($search_region) $sql.= natural_search("region.nom",$search_region); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_region) $sql.= natural_search("region.nom",$search_region); +if ($search_country && $search_country != '-1') $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; if ($search_email) $sql.= natural_search("s.email",$search_email); if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone); if (strlen($search_fax)) $sql.= natural_search("s.phone", $search_fax); @@ -470,11 +414,12 @@ if (strlen($search_vat)) $sql.= natural_search("s.tva_intra",$search_vat); if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; -if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status); +if ($search_status!='' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2); if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode); -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; -if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); +if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql.= natural_search("s.fk_typent", $search_type_thirdparty, 2); +if (! empty($search_staff) && $search_staff != '-1') $sql.= natural_search("s.fk_effectif", $search_staff, 2); +if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3); +if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm", $search_stcomm, 2); if ($search_import_key) $sql.= natural_search("s.import_key",$search_import_key); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -567,13 +512,12 @@ if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6 if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_type != '') $param.='&search_type='.urlencode($search_type); -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +if (is_array($search_level) && count($search_level)) foreach($search_level as $slevel) $param.='&search_level[]='.urlencode($slevel); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm); -if ($search_level_from != '') $param.='&search_level_from='.urlencode($search_level_from); -if ($search_level_to != '') $param.='&search_level_to='.urlencode($search_level_to); if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); if ($type != '') $param.='&type='.urlencode($type); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -612,7 +556,7 @@ if ($user->rights->societe->creer) $newcardbutton.= ''; } -print ''; +print ''; if ($optioncss != '') print ''; print ''; print ''; @@ -711,48 +655,48 @@ if (! empty($arrayfields['s.nom']['checked'])) { print ''; } if (! empty($arrayfields['s.name_alias']['checked'])) { print ''; } // Barcode if (! empty($arrayfields['s.barcode']['checked'])) { print ''; } // Customer code if (! empty($arrayfields['s.code_client']['checked'])) { print ''; } // Supplier code if (! empty($arrayfields['s.code_fournisseur']['checked'])) { print ''; } // Account Customer code if (! empty($arrayfields['s.code_compta']['checked'])) { print ''; } // Account Supplier code if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) { print ''; } // Town @@ -766,21 +710,21 @@ if (! empty($arrayfields['s.town']['checked'])) if (! empty($arrayfields['s.zip']['checked'])) { print ''; } // State if (! empty($arrayfields['state.nom']['checked'])) { print ''; } // Region if (! empty($arrayfields['region.nom']['checked'])) { print ''; } // Country @@ -797,18 +741,25 @@ if (! empty($arrayfields['typent.code']['checked'])) print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } +// Staff +if (! empty($arrayfields['staff.code']['checked'])) +{ + print ''; +} if (! empty($arrayfields['s.email']['checked'])) { // Email print ''; } if (! empty($arrayfields['s.phone']['checked'])) { // Phone print ''; } if (! empty($arrayfields['s.fax']['checked'])) @@ -822,14 +773,14 @@ if (! empty($arrayfields['s.url']['checked'])) { // Url print ''; } if (! empty($arrayfields['s.siren']['checked'])) { // IdProf1 print ''; } if (! empty($arrayfields['s.siret']['checked'])) @@ -850,28 +801,28 @@ if (! empty($arrayfields['s.idprof4']['checked'])) { // IdProf4 print ''; } if (! empty($arrayfields['s.idprof5']['checked'])) { // IdProf5 print ''; } if (! empty($arrayfields['s.idprof6']['checked'])) { // IdProf6 print ''; } if (! empty($arrayfields['s.tva_intra']['checked'])) { // Vat number print ''; } @@ -889,37 +840,16 @@ if (! empty($arrayfields['customerorsupplier']['checked'])) print ''; print ''; } +// Prospect level if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { - // Prospect level print ''; } - +// Prospect status if (! empty($arrayfields['s.fk_stcomm']['checked'])) { - // Prospect status print ''; } if (! empty($arrayfields['s.import_key']['checked'])) { print ''; } // Action column @@ -984,6 +914,7 @@ if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titr if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'],$_SERVER["PHP_SELF"],"staff.code","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'],$_SERVER["PHP_SELF"],"s.fax","",$param,'',$sortfield,$sortorder); @@ -1069,13 +1000,13 @@ while ($i < min($num, $limit)) // Customer code if (! empty($arrayfields['s.code_client']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Supplier code if (! empty($arrayfields['s.code_fournisseur']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Account customer code @@ -1132,6 +1063,15 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; } + // Staff + if (! empty($arrayfields['staff.code']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } if (! empty($arrayfields['s.email']['checked'])) { print "\n"; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index f8fcacb2bb3..d855e89f712 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -550,13 +550,17 @@ if (empty($reshook)) $db->begin(); + if (empty($newcu)) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; + } else { $sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account"; $sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'"; $sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! - + } + $resql = $db->query($sql); $num = $db->num_rows($resql); - if (empty($num)) + if (empty($num) && !empty($newcu)) { $societeaccount = new SocieteAccount($db); $societeaccount->fk_soc = $object->id; @@ -826,7 +830,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print ''; print ''; - print "\n"; + print ''; + print ""; + print "\n"; $nbremote = 0; $nblocal = 0; @@ -907,6 +913,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (empty($companypaymentmodetemp->stripe_card_ref)) print $langs->trans("Local"); else print $langs->trans("LocalAndRemote"); print ''; + print ''; print ''; print ''; + print ''; print ''; -print ''; +print ''; + print ''; - // Ref - print "\n"; + print ''; + // Ref + $url='https://dashboard.stripe.com/test/payments/'.$charge->id; + if ($servicestatus) + { + $url='https://dashboard.stripe.com/payments/'.$charge->id; + } + print "\n"; // Stripe customer print "\n"; // Link @@ -153,23 +162,26 @@ if (!$rowid) { print $societestatic->getNomUrl(1); } - if ($memberstatic->id > 0) + elseif ($memberstatic->id > 0) { print $memberstatic->getNomUrl(1); } print "\n"; // Origine print "\n"; // Date payment print '\n"; @@ -190,14 +202,16 @@ if (!$rowid) // Status print '\n"; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 5e3cfc7f522..901997cef3b 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -28,15 +28,36 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This set stripe glo */ class Stripe extends CommonObject { + /** + * @var int ID + */ public $rowid; - public $fk_soc; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + public $fk_key; + + /** + * @var int ID + */ public $id; + public $mode; + + /** + * @var int Entity + */ public $entity; + public $statut; + public $type; + public $code; + public $message; /** @@ -314,18 +335,19 @@ class Stripe extends CommonObject /** * Create charge with public/payment/newpayment.php, stripe/card.php, cronjobs or REST API * - * @param int $amount Amount to pay - * @param string $currency EUR, GPB... - * @param string $origin Object type to pay (order, invoice, contract...) - * @param int $item Object id to pay - * @param string $source src_xxxxx or card_xxxxx - * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() - * @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount() + * @param int $amount Amount to pay + * @param string $currency EUR, GPB... + * @param string $origin Object type to pay (order, invoice, contract...) + * @param int $item Object id to pay + * @param string $source src_xxxxx or card_xxxxx + * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() + * @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount() * @param int $status Status (0=test, 1=live) * @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email + * @param boolean $capture Set capture flag to true (take payment) or false (wait) * @return Stripe */ - public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0) + public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0, $capture=true) { global $conf; @@ -396,9 +418,9 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, + "capture" => $capture, "metadata" => $metadata, "source" => "$source" )); @@ -406,9 +428,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "description" => "Stripe payment: ".$description, + "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" @@ -431,9 +453,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, + "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index f0c950d85ac..6560d42d137 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 ThibaultFOUCART * * 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 @@ -639,36 +640,24 @@ print ''; print ''; @@ -1490,7 +1491,7 @@ if ($action == 'create') print ''; print ''; print ''; - $form->select_date($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); + print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); print ''; print ''; } else { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a9b44339930..ecd940fea96 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García @@ -49,20 +49,27 @@ class SupplierProposal extends CommonObject * @var string ID to identify managed object */ public $element='supplier_proposal'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='supplier_proposal'; - - public $table_element_line='supplier_proposaldet'; + + /** + * @var int Name of subtable line + */ + public $table_element_line='supplier_proposaldet'; + public $fk_element='fk_supplier_proposal'; + public $picto='propal'; + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -74,24 +81,25 @@ class SupplierProposal extends CommonObject */ protected $table_ref_field = 'ref'; - var $socid; // Id client + public $socid; // Id client /** * @deprecated * @see user_author_id */ - var $author; - var $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande - var $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande - var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (processed/billed) - var $date; // Date of proposal - var $date_livraison; + public $author; + + public $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande + public $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande + public $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (processed/billed) + public $date; // Date of proposal + public $date_livraison; /** * @deprecated * @see date_creation */ - var $datec; + public $datec; /** * Creation date @@ -103,7 +111,7 @@ class SupplierProposal extends CommonObject * @deprecated * @see date_validation */ - var $datev; + public $datev; /** * Validation date @@ -112,70 +120,76 @@ class SupplierProposal extends CommonObject public $date_validation; - var $user_author_id; - var $user_valid_id; - var $user_close_id; + public $user_author_id; + public $user_valid_id; + public $user_close_id; /** * @deprecated * @see price_ht */ - var $price; + public $price; + /** * @deprecated * @see total_tva */ - var $tva; + public $tva; + /** * @deprecated * @see total_ttc */ - var $total; + public $total; - var $cond_reglement_code; - var $mode_reglement_code; - var $remise = 0; - var $remise_percent = 0; - var $remise_absolue = 0; + public $cond_reglement_code; + public $mode_reglement_code; + public $remise = 0; + public $remise_percent = 0; + public $remise_absolue = 0; - var $products=array(); - var $extraparams=array(); + public $products=array(); + public $extraparams=array(); - var $lines = array(); - var $line; + public $lines = array(); + public $line; - var $labelstatut=array(); - var $labelstatut_short=array(); + public $labelstatut=array(); + public $labelstatut_short=array(); - var $nbtodo; - var $nbtodolate; + public $nbtodo; + public $nbtodolate; - var $specimen; + public $specimen; // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Draft status */ const STATUS_DRAFT = 0; + /** * Validated status */ const STATUS_VALIDATED = 1; + /** * Signed quote */ const STATUS_SIGNED = 2; + /** * Not signed quote, canceled */ const STATUS_NOTSIGNED = 3; + /** * Billed or closed/processed quote */ @@ -203,9 +217,10 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add line into array products - * $this->client doit etre charge + * $this->client doit etre charge * * @param int $idproduct Product Id to add * @param int $qty Quantity @@ -215,9 +230,9 @@ class SupplierProposal extends CommonObject * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0) { + // phpcs:enable global $conf, $mysoc; if (! $qty) $qty = 1; @@ -259,15 +274,16 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the proposal in DB * * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1074,6 +1090,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert into DB a supplier_proposal object completely defined by its data members (ex, results from copy). * @@ -1081,9 +1098,9 @@ class SupplierProposal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { + // phpcs:enable $this->products=$this->lines; return $this->create($user); @@ -1504,6 +1521,7 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1511,9 +1529,9 @@ class SupplierProposal extends CommonObject * @param int $date_livraison Delivery date * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { + // phpcs:enable if (! empty($user->rights->supplier_proposal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal "; @@ -1534,6 +1552,7 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -1541,9 +1560,9 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->supplier_proposal->creer)) @@ -1568,6 +1587,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -1575,9 +1595,9 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->supplier_proposal->creer)) @@ -1841,15 +1861,16 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Set draft status + * Set draft status * * @param User $user Object user that modify * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user) { + // phpcs:enable global $conf,$langs; $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal SET fk_statut = 0"; @@ -1868,6 +1889,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of askprice (eventually filtered on user) into an array * @@ -1881,9 +1903,9 @@ class SupplierProposal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datec', $sortorder='DESC') { + // phpcs:enable global $conf,$user; $ga = array(); @@ -2133,16 +2155,17 @@ class SupplierProposal extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return label of a status (draft, validated, ...) + * Return label of a status (draft, validated, ...) * - * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label + * @param int $statut id statut + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { + // phpcs:enable // Init/load array of translation of status if (empty($this->labelstatut) || empty($this->labelstatut_short)) { @@ -2162,21 +2185,22 @@ class SupplierProposal extends CommonObject $statuttrans=''; if ($statut==0) $statuttrans='statut0'; - if ($statut==1) $statuttrans='statut1'; - if ($statut==2) $statuttrans='statut3'; - if ($statut==3) $statuttrans='statut5'; - if ($statut==4) $statuttrans='statut6'; + elseif ($statut==1) $statuttrans='statut1'; + elseif ($statut==2) $statuttrans='statut3'; + elseif ($statut==3) $statuttrans='statut5'; + elseif ($statut==4) $statuttrans='statut6'; if ($mode == 0) return $this->labelstatut[$statut]; - if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; - if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); - if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); - if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 1) return $this->labelstatut_short[$statut]; + elseif ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + elseif ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); + elseif ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; + elseif ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2184,9 +2208,9 @@ class SupplierProposal extends CommonObject * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $user, $langs; $now=dol_now(); @@ -2338,14 +2362,15 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -2658,7 +2683,7 @@ class SupplierProposalLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -2668,31 +2693,32 @@ class SupplierProposalLine extends CommonObjectLine * @var string ID to identify managed object */ public $element='supplier_proposaldet'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='supplier_proposaldet'; - var $oldline; + public $oldline; // From llx_supplier_proposaldet - var $rowid; // deprecated - + public $rowid; // deprecated + /** * @var int ID */ public $id; - - var $fk_supplier_proposal; - var $fk_parent_line; - var $desc; // Description ligne - var $fk_product; // Id produit predefini + + public $fk_supplier_proposal; + public $fk_parent_line; + public $desc; // Description ligne + public $fk_product; // Id produit predefini + /** * @deprecated * @see product_type */ - var $fk_product_type; + public $fk_product_type; /** * Product type * @var int @@ -2700,89 +2726,94 @@ class SupplierProposalLine extends CommonObjectLine */ public $product_type = Product::TYPE_PRODUCT; - var $qty; - var $tva_tx; - var $subprice; - var $remise_percent; - var $fk_remise_except; + public $qty; + public $tva_tx; + public $subprice; + public $remise_percent; + public $fk_remise_except; - var $rang = 0; + public $rang = 0; - var $fk_fournprice; - var $pa_ht; - var $marge_tx; - var $marque_tx; + public $fk_fournprice; + public $pa_ht; + public $marge_tx; + public $marque_tx; - var $special_code; // Tag for special lines (exlusive tags) + public $special_code; // Tag for special lines (exlusive tags) // 1: frais de port // 2: ecotaxe // 3: option line (when qty = 0) - var $info_bits = 0; // Liste d'options cumulables: + public $info_bits = 0; // Liste d'options cumulables: // Bit 0: 0 si TVA normal - 1 si TVA NPR // Bit 1: 0 ligne normale - 1 si ligne de remise fixe - var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne - var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne - var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne + public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne + public $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne + public $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne /** * @deprecated * @see remise_percent, fk_remise_except */ - var $remise; + public $remise; + /** * @deprecated * @see subprice */ - var $price; + public $price; // From llx_product /** * @deprecated * @see product_ref */ - var $ref; + public $ref; + /** * Product reference * @var string */ public $product_ref; + /** * @deprecated * @see product_label */ - var $libelle; + public $libelle; + /** * Product label * @var string */ public $product_label; + /** * Product description * @var string */ public $product_desc; - var $localtax1_tx; // Local tax 1 - var $localtax2_tx; // Local tax 2 - var $localtax1_type; // Local tax 1 type - var $localtax2_type; // Local tax 2 type - var $total_localtax1; // Line total local tax 1 - var $total_localtax2; // Line total local tax 2 + public $localtax1_tx; // Local tax 1 + public $localtax2_tx; // Local tax 2 + public $localtax1_type; // Local tax 1 type + public $localtax2_type; // Local tax 2 type + public $total_localtax1; // Line total local tax 1 + public $total_localtax2; // Line total local tax 2 - var $skip_update_total; // Skip update price total for special lines + public $skip_update_total; // Skip update price total for special lines - var $ref_fourn; - var $ref_supplier; + public $ref_fourn; + public $ref_supplier; // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_subprice; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_subprice; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Class line Contructor @@ -3185,15 +3216,16 @@ class SupplierProposalLine extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update DB line fields total_xxx * Used by migration * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b6e744672e8..e3664554e14 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2017 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,6 +108,7 @@ if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_ if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1; if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover; +if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked; if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak; if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; @@ -143,9 +145,11 @@ $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( // Hover color $colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); +$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '0')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_CHECKED)); if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) { $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); + $colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_CHECKED)); } //$colortopbordertitle1=$colorbackhmenu1; @@ -177,7 +181,7 @@ $colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); // Norma $tmppart=explode(',',$colorbacktabcard1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } -else { $colortextbacktab='111111'; } +else { $colortextbacktab='000000'; } // Format color value to match expected format (may be 'FFFFFF' or '255,255,255') @@ -191,6 +195,7 @@ $colorbacklineimpair2=join(',',colorStringToArray($colorbacklineimpair2)); $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); +if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',',colorStringToArray($colorbacklinepairchecked)); $colorbackbody=join(',',colorStringToArray($colorbackbody)); $colortexttitlenotab=join(',',colorStringToArray($colortexttitlenotab)); $colortexttitle=join(',',colorStringToArray($colortexttitle)); @@ -218,6 +223,7 @@ print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; print 'colorbacklinepair1='.$colorbacklinepair1."\n"; print 'colorbacklinepair2='.$colorbacklinepair2."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; +print 'colorbacklinepairchecked='.$colorbacklinepairchecked."\n"; print '$colortexttitlenotab='.$colortexttitlenotab."\n"; print '$colortexttitle='.$colortexttitle."\n"; print '$colortext='.$colortext."\n"; @@ -748,6 +754,9 @@ select.flat.selectlimit { .marginleftonly { margin-left: 10px !important; } +.marginleftonlyshort { + margin-left: 4px !important; +} .nomarginleft { margin-left: 0px !important; } @@ -1875,16 +1884,27 @@ if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { } .login_table input#username, .login_table input#password, .login_table input#securitycode { border: none; - border-bottom: solid 1px rgba(180,180,180,.4); + /* border-bottom: solid 1px rgba(180,180,180,.4); */ padding: 5px; margin-left: 5px; margin-top: 5px; + margin-bottom: 5px; } .login_table input#username:focus, .login_table input#password:focus, .login_table input#securitycode:focus { outline: none !important; - /* box-shadow: none; - -webkit-box-shadow: 0 0 0 50px #FFF inset; - box-shadow: 0 0 0 50px #FFF inset;*/ +} +.login_table .trinputlogin { + margin: 8px; +} +.login_table .tdinputlogin { + background-color: #fff; + border: 2px solid #ccc; + min-width: 200px; + border-radius: 2px; +} +.login_table .tdinputlogin .fa { + padding-left: 10px; + width: 14px; } .login_main_message { text-align: center; @@ -2460,21 +2480,24 @@ span.butAction, span.butActionDelete { cursor: pointer; /*color: #fff !important; background: rgb(); - border: 1px solid rgb();*/ + border: 1px solid rgb(); border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); - border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; border-top-left-radius: 0 !important; - border-bottom-left-radius: 0 !important; + border-bottom-left-radius: 0 !important;*/ } a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } -.butAction:hover, .butActionNew:hover { +.butAction:hover { -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); } +.butActionNew:hover { + text-decoration: underline; + box-shadow: unset !important; +} .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete { background: rgb(239, 232, 230); @@ -2695,7 +2718,9 @@ table.paddingtopbottomonly tr td { background: rgb() !important; } tr.liste_titre_filter td.liste_titre { -/* border-bottom: 1px solid #ddd; */ + /* border-bottom: 1px solid #ddd; */ + padding-top: 2px; + padding-bottom: 2px; } .liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd { @@ -2931,6 +2956,12 @@ div.pagination li.paginationafterarrows { background: rgb() !important; /* Must be background to be stronger than background of odd or even */ } + +.highlight { + background: rgb() !important; /* Must be background to be stronger than background of odd or even */ +} + + .nohover:hover { background: unset; } @@ -3875,6 +3906,13 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im float: right; padding-top: 8px; } +.websiteselectionsection { + border-left: 1px solid #bbb; + border-right: 1px solid #bbb; + margin-left: 0px; + padding-left: 8px; + margin-right: 5px; +} /* ============================================================================== */ @@ -4877,7 +4915,81 @@ span.noborderoncategories { /* ============================================================================== */ -/* Multiselect with checkbox */ +/* External lib multiselect with checkbox */ +/* ============================================================================== */ + +.multi-select-container { + display: inline-block; + position: relative; +} + +.multi-select-menu { + position: absolute; + left: 0; + top: 0.8em; + float: left; + min-width: 100%; + background: #fff; + margin: 1em 0; + padding: 0.4em 0; + border: 1px solid #aaa; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); + display: none; +} + +.multi-select-menu input { + margin-right: 0.3em; + vertical-align: 0.1em; +} + +.multi-select-button { + display: inline-block; + max-width: 20em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + background-color: #fff; + cursor: default; + + border: none; + border-bottom: solid 1px rgba(0,0,0,.2); + padding: 5px; + padding-left: 2px; + height: 17px; +} +.multi-select-button:focus { + outline: none; + border-bottom: 1px solid #666; +} + +.multi-select-button:after { + content: ""; + display: inline-block; + width: 0; + height: 0; + border-style: solid; + border-width: 0.5em 0.23em 0em 0.23em; + border-color: #444 transparent transparent transparent; + margin-left: 0.4em; +} + +.multi-select-container--open .multi-select-menu { display: block; } + +.multi-select-container--open .multi-select-button:after { + border-width: 0 0.4em 0.4em 0.4em; + border-color: transparent transparent #999 transparent; +} + +.multi-select-menuitem { + clear: both; + float: left; + padding-left: 5px +} + + +/* ============================================================================== */ +/* Native multiselect with checkbox */ /* ============================================================================== */ ul.ulselectedfields { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index aa02805c5cc..049288664a6 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -108,6 +109,7 @@ if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_ if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1; if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER==$colorbacklinepairhover; +if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked; if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak; if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; @@ -145,9 +147,11 @@ $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( // Hover color $colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); +$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '0')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_CHECKED)); if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) { $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); + $colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_CHECKED)); } if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; @@ -193,6 +197,7 @@ $colorbacklineimpair2=join(',',colorStringToArray($colorbacklineimpair2)); $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); +if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',',colorStringToArray($colorbacklinepairchecked)); $colorbackbody=join(',',colorStringToArray($colorbackbody)); $colortexttitlenotab=join(',',colorStringToArray($colortexttitlenotab)); $colortexttitle=join(',',colorStringToArray($colortexttitle)); @@ -211,6 +216,7 @@ print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; print 'colorbacklinepair1='.$colorbacklinepair1."\n"; print 'colorbacklinepair2='.$colorbacklinepair2."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; +print 'colorbacklinepairchecked='.$colorbacklinepairchecked."\n"; print '$colortexttitlenotab='.$colortexttitlenotab."\n"; print '$colortexttitle='.$colortexttitle."\n"; print '$colortext='.$colortext."\n"; @@ -735,6 +741,9 @@ select.flat.selectlimit { .marginleftonly { margin-left: 10px !important; } +.marginleftonlyshort { + margin-left: 4px !important; +} .nomarginleft { margin-left: 0px !important; } @@ -1866,17 +1875,29 @@ form#login { } .login_table input#username, .login_table input#password, .login_table input#securitycode{ border: none; - border-bottom: solid 1px rgba(180,180,180,.4); + /* border-bottom: solid 1px rgba(180,180,180,.4); */ padding: 5px; margin-left: 18px; margin-top: 5px; + margin-bottom: 5px; } .login_table input#username:focus, .login_table input#password:focus, .login_table input#securitycode:focus { outline: none !important; - /* box-shadow: none; - -webkit-box-shadow: 0 0 0 50px #FFF inset; - box-shadow: 0 0 0 50px #FFF inset;*/ } +.login_table .trinputlogin { + margin: 8px; +} +.login_table .tdinputlogin { + background-color: #fff; + border: 2px solid #ccc; + min-width: 200px; + border-radius: 2px; +} +.login_table .tdinputlogin .fa { + padding-left: 10px; + width: 14px; +} + .login_main_message { text-align: center; max-width: 570px; @@ -2664,6 +2685,8 @@ table.paddingtopbottomonly tr td { } tr.liste_titre_filter td.liste_titre { border-bottom: 1px solid #FDFFFF; + padding-top: 2px; + padding-bottom: 2px; } .liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd { @@ -2907,6 +2930,12 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { } + +.highlight { + background: rgb() !important; /* Must be background to be stronger than background of odd or even */ +} + + .oddeven, .evenodd, .impair, .nohover .impair:hover, tr.impair td.nohover { font-family: ; @@ -4745,7 +4774,81 @@ span.noborderoncategories { /* ============================================================================== */ -/* Multiselect with checkbox */ +/* External lib multiselect with checkbox */ +/* ============================================================================== */ + +.multi-select-container { + display: inline-block; + position: relative; +} + +.multi-select-menu { + position: absolute; + left: 0; + top: 0.8em; + float: left; + min-width: 100%; + background: #fff; + margin: 1em 0; + padding: 0.4em 0; + border: 1px solid #aaa; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); + display: none; +} + +.multi-select-menu input { + margin-right: 0.3em; + vertical-align: 0.1em; +} + +.multi-select-button { + display: inline-block; + max-width: 20em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + background-color: #fff; + cursor: default; + + border: none; + border-bottom: solid 1px rgba(0,0,0,.2); + padding: 5px; + padding-left: 2px; + height: 17px; +} +.multi-select-button:focus { + outline: none; + border-bottom: 1px solid #666; +} + +.multi-select-button:after { + content: ""; + display: inline-block; + width: 0; + height: 0; + border-style: solid; + border-width: 0.5em 0.23em 0em 0.23em; + border-color: #444 transparent transparent transparent; + margin-left: 0.4em; +} + +.multi-select-container--open .multi-select-menu { display: block; } + +.multi-select-container--open .multi-select-button:after { + border-width: 0 0.4em 0.4em 0.4em; + border-color: transparent transparent #999 transparent; +} + +.multi-select-menuitem { + clear: both; + float: left; + padding-left: 5px +} + + +/* ============================================================================== */ +/* Native multiselect with checkbox */ /* ============================================================================== */ ul.ulselectedfields { diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 5e9748a6027..845ca8ca773 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -39,21 +39,21 @@ class ActionsTicket * @var DoliDB Database handler. */ public $db; - + public $dao; public $mesg; - + /** * @var string Error code (or message) */ public $error; - + /** * @var string[] Error codes (or messages) */ public $errors = array(); - + //! Numero de l'erreur public $errno = 0; @@ -61,9 +61,17 @@ class ActionsTicket public $template; public $label; - public $description; + + /** + * @var string description + */ + public $description; public $fk_statut; + + /** + * @var int Thirdparty ID + */ public $fk_soc; /** @@ -1309,6 +1317,7 @@ class ActionsTicket } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * load_previous_next_ref * @@ -1316,9 +1325,9 @@ class ActionsTicket * @param int $fieldid Id * @return int 0 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_ref($filter, $fieldid) { + // phpcs:enable $this->getInstanceDao(); return $object->load_previous_next_ref($filter, $fieldid); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 74f5c825e6c..03aec1eb818 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -216,8 +216,6 @@ class Ticket extends CommonObject const STATUS_CANCELED = 9; - - /** * Constructor * @@ -1169,6 +1167,7 @@ class Ticket extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label of object * @@ -1176,146 +1175,146 @@ class Ticket extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) { + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) { + elseif ($mode == 2) { if ($statut == 0) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 1) { + elseif ($statut == 1) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 3) { + elseif ($statut == 3) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 4) { + elseif ($statut == 4) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 5) { + elseif ($statut == 5) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 6) { + elseif ($statut == 6) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 8) { + elseif ($statut == 8) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 9) { + elseif ($statut == 9) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } } - if ($mode == 3) { + elseif ($mode == 3) { if ($statut == 0) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket'); } - if ($statut == 1) { + elseif ($statut == 1) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket'); } - if ($statut == 3) { + elseif ($statut == 3) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket'); } - if ($statut == 4) { + elseif ($statut == 4) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket'); } - if ($statut == 5) { + elseif ($statut == 5) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket'); } - if ($statut == 6) { + elseif ($statut == 6) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket'); } - if ($statut == 8) { + elseif ($statut == 8) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket'); } - if ($statut == 9) { + elseif ($statut == 9) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket'); } } - if ($mode == 4) { + elseif ($mode == 4) { if ($statut == 0) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 1) { + elseif ($statut == 1) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 3) { + elseif ($statut == 3) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 4) { + elseif ($statut == 4) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 5) { + elseif ($statut == 5) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 6) { + elseif ($statut == 6) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 8) { + elseif ($statut == 8) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - if ($statut == 9) { + elseif ($statut == 9) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } } - if ($mode == 5) { + elseif ($mode == 5) { if ($statut == 0) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket'); } - if ($statut == 1) { + elseif ($statut == 1) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket'); } - if ($statut == 3) { + elseif ($statut == 3) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket'); } - if ($statut == 4) { + elseif ($statut == 4) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket'); } - if ($statut == 5) { + elseif ($statut == 5) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket'); } - if ($statut == 6) { + elseif ($statut == 6) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket'); } - if ($statut == 8) { + elseif ($statut == 8) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket'); } - if ($statut == 9) { + elseif ($statut == 9) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket'); } } @@ -1489,8 +1488,6 @@ class Ticket extends CommonObject dol_syslog(get_class($this) . "::assignUser " . $this->error, LOG_ERR); return - 1; } - - return 0; } /** @@ -2447,15 +2444,16 @@ class Ticket extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if at least one photo is available * * @param string $sdir Directory to scan * @return boolean True if at least one photo is available, False if not */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_photo_available($sdir) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; global $conf; @@ -2488,7 +2486,10 @@ class Ticket extends CommonObject */ class TicketsLine { - public $id; + /** + * @var int ID + */ + public $id; /** * @var string $ref Ticket reference @@ -2501,8 +2502,8 @@ class TicketsLine public $track_id; /** - * Thirdparty ID - */ + * @var int Thirdparty ID + */ public $fk_soc; /** diff --git a/htdocs/ticket/class/ticketlogs.class.php b/htdocs/ticket/class/ticketlogs.class.php index e006759ed51..c5e77bc9dae 100644 --- a/htdocs/ticket/class/ticketlogs.class.php +++ b/htdocs/ticket/class/ticketlogs.class.php @@ -57,7 +57,10 @@ class Ticketlogs// extends CommonObject */ public $table_element = 'ticketlogs'; //!< Name of table without prefix where object is stored - public $id; + /** + * @var int ID + */ + public $id; public $fk_track_id; public $fk_user_create; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 136384877fb..2820e9e4690 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -48,13 +48,12 @@ $cancel = GETPOST('cancel','alpha'); $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -// Ok if user->rights->salaries->read or user->rights->salaries->payment->write or user->rights->hrm->read +// Ok if user->rights->salaries->read or user->rights->hrm->read //$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2); $ok=false; if ($user->id == $id) $ok=true; // A user can always read its own card -if ($user->rights->salaries->read) $ok=true; -if ($user->rights->salaries->payment->write) $ok=true; -if ($user->rights->hrm->read) $ok=true; +if (! empty($user->rights->salaries->read)) $ok=true; +if (! empty($user->rights->hrm->read)) $ok=true; if (! $ok) { accessforbidden(); @@ -293,7 +292,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco * Last salaries */ if (! empty($conf->salaries->enabled) && - ($user->rights->salaries->read || ($user->rights->salaries->read && $object->id == $user->id)) + ($user->rights->salaries->read && $object->id == $user->id) ) { $salary = new PaymentSalary($db); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 528d56dcdba..dc2437af825 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,6 +13,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1010,7 +1011,7 @@ if ($action == 'create' || $action == 'adduserldap') } else { - print ''; + print ''; } print ''; } @@ -1158,21 +1159,21 @@ if ($action == 'create' || $action == 'adduserldap') // Date employment print ''; print ''; print "\n"; // Date employment END print ''; print ''; print "\n"; // Date birth print ''; print ''; print "\n"; @@ -2454,14 +2455,14 @@ else // Date employment print ''; print ''; print "\n"; // Date employmentEnd print ''; print ''; print "\n"; @@ -2469,7 +2470,7 @@ else // Date birth print ''; print ''; print "\n"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index adde437575c..3f3e217dc04 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -76,6 +76,10 @@ class User extends CommonObject public $admin; public $login; public $api_key; + + /** + * @var int Entity + */ public $entity; //! Clear password in memory @@ -103,6 +107,10 @@ class User extends CommonObject public $contactid; public $fk_member; + + /** + * @var int User ID + */ public $fk_user; public $clicktodial_url; @@ -1176,6 +1184,7 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external * @@ -1184,9 +1193,9 @@ class User extends CommonObject * @param string $password Password to force * @return int <0 if error, if OK returns id of created user */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_contact($contact,$login='',$password='') { + // phpcs:enable global $conf,$user,$langs; $error=0; @@ -1254,6 +1263,7 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user into database from a member object * @@ -1261,9 +1271,9 @@ class User extends CommonObject * @param string $login Login to force * @return int <0 if KO, if OK, return id of created account */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member($member,$login='') { + // phpcs:enable global $conf,$user,$langs; // Positionne parametres @@ -1328,14 +1338,15 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign rights by default * * @return integer erreur <0, si ok renvoi le nbre de droits par defaut positionnes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_default_rights() { + // phpcs:enable global $conf; $sql = "SELECT id FROM ".MAIN_DB_PREFIX."rights_def"; @@ -1663,15 +1674,16 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour en base de la date de derniere connexion d'un utilisateur * Fonction appelee lors d'une nouvelle connexion * * @return <0 si echec, >=0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_last_login_date() { + // phpcs:enable $now=dol_now(); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; @@ -1829,6 +1841,7 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Send new password by email * @@ -1837,9 +1850,9 @@ class User extends CommonObject * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @TODO Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function send_password($user, $password='', $changelater=0) { + // phpcs:enable global $conf,$langs; global $dolibarr_main_url_root; @@ -1944,14 +1957,15 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read clicktodial information for user * * @return <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_clicktodial() { + // phpcs:enable $sql = "SELECT url, login, pass, poste "; $sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; $sql.= " WHERE u.fk_user = ".$this->id; @@ -1981,14 +1995,15 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update clicktodial info * * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_clicktodial() { + // phpcs:enable $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; @@ -2021,6 +2036,7 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add user into a group * @@ -2029,9 +2045,9 @@ class User extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetInGroup($group, $entity, $notrigger=0) { + // phpcs:enable global $conf, $langs, $user; $error=0; @@ -2082,6 +2098,7 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a user from a group * @@ -2090,9 +2107,9 @@ class User extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function RemoveFromGroup($group, $entity, $notrigger=0) { + // phpcs:enable global $conf,$langs,$user; $error=0; @@ -2355,6 +2372,7 @@ class User extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2362,9 +2380,9 @@ class User extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('users'); @@ -2402,6 +2420,7 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -2411,9 +2430,9 @@ class User extends CommonObject * 2=Return key only (RDN) (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN; @@ -2422,14 +2441,15 @@ class User extends CommonObject return $dn; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); @@ -2692,6 +2712,7 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update user using data from the LDAP * @@ -2699,9 +2720,9 @@ class User extends CommonObject * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_ldap2dolibarr(&$ldapuser) { + // phpcs:enable // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) global $user, $conf; @@ -2729,15 +2750,16 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return and array with all instanciated first level children users of current user * * @return void * @see getAllChildIds */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_children() { + // phpcs:enable $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; $sql.= " WHERE fk_user = ".$this->id; @@ -2767,8 +2789,7 @@ class User extends CommonObject * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - private function load_parentof() + private function loadParentOf() { global $conf; @@ -2780,7 +2801,7 @@ class User extends CommonObject $sql.= " WHERE fk_user <> 0"; $sql.= " AND entity IN (".getEntity('user').")"; - dol_syslog(get_class($this)."::load_parentof", LOG_DEBUG); + dol_syslog(get_class($this)."::loadParentOf", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2797,6 +2818,7 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau * Set and return this->users that is an array sorted according to tree with arrays of: @@ -2810,9 +2832,9 @@ class User extends CommonObject * @param string $filter SQL filter on users * @return array Array of users $this->users. Note: $this->parentof is also set. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_tree($deleteafterid=0, $filter='') { + // phpcs:enable global $conf, $user; global $hookmanager; @@ -2822,7 +2844,7 @@ class User extends CommonObject $this->users = array(); // Init this->parentof that is array(id_son=>id_parent, ...) - $this->load_parentof(); + $this->loadParentOf(); // Init $this->users array $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates @@ -2941,6 +2963,7 @@ class User extends CommonObject return $childids; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * For user id_user and its childs available in this->users, define property fullpath and fullname. * Function called by get_full_tree(). @@ -2949,9 +2972,9 @@ class User extends CommonObject * @param int $protection Deep counter to avoid infinite loop (no more required, a protection is added with array useridfound) * @return int < 0 if KO (infinit loop), >= 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_user($id_user,$protection=0) { + // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); if (! empty($this->users[$id_user]['fullpath'])) @@ -3004,14 +3027,15 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); @@ -3075,6 +3099,7 @@ class User extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return property of user from its id * @@ -3082,9 +3107,9 @@ class User extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of user with format: "Full name " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function user_get_property($rowid,$mode) { + // phpcs:enable $user_property=''; if (empty($rowid)) return ''; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 98d20bd0ad5..78ef5b7a390 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -39,16 +39,19 @@ class UserGroup extends CommonObject * @var string ID to identify managed object */ public $element='usergroup'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='usergroup'; - + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto='group'; - public $entity; // Entity of group + /** + * @var int Entity of group + */ + public $entity; public $name; // Name of group /** @@ -803,6 +806,7 @@ class UserGroup extends CommonObject return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -810,9 +814,9 @@ class UserGroup extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('users'); return ''; @@ -895,6 +899,7 @@ class UserGroup extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -904,9 +909,9 @@ class UserGroup extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_GROUP_DN; @@ -916,14 +921,15 @@ class UserGroup extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); @@ -986,7 +992,7 @@ class UserGroup extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 0d7cabba4e4..4250465ff09 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -42,10 +42,11 @@ if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuse global $conf, $langs, $user; // Appel des triggers -include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; -$interface=new Interfaces($db); -$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf); -if ($result < 0) { $error++; } +// TODO @deprecated Remove this. Hook must be used, not this trigger. +//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; +//$interface=new Interfaces($db); +//$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf); +//if ($result < 0) { $error++; } // Fin appel triggers // Hooks on logout diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 7e04adab9a7..575af204618 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -188,7 +188,7 @@ if ($result > 0) // Add notification form - print_fiche_titre($langs->trans("AddNewNotification"),'',''); + print load_fiche_titre($langs->trans("AddNewNotification"),'',''); print '
'; print ''; @@ -276,7 +276,7 @@ if ($result > 0) } // List of active notifications - print_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','',''); + print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','',''); // Line with titles print '
'.$langs->trans("From").' '; - print $form->select_date($dates,'dates',0,0,1,'',1,0,1); + print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0); print ''.$langs->trans("to").' '; - print $form->select_date($datee,'datee',0,0,1,'',1,0,1); + print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0); print ''; print ''; @@ -565,8 +565,6 @@ print ''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$langs->trans("DateStart").''; - print $form->select_date(($date_start?$date_start:''),'dateo',1,1,0,'',1,1,1); + print $form->selectDate(($date_start?$date_start:''), 'dateo', 1, 1, 0, '', 1, 1); print '
'.$langs->trans("DateEnd").''; - print $form->select_date(($date_end?$date_end:-1),'datee',-1,1,0,'',1,1,1); + print $form->selectDate(($date_end?$date_end:-1),'datee', -1, 1, 0, '', 1, 1); print '
'.$langs->trans("DateStart").''; - print $form->select_date($object->date_start,'dateo',1,1,0,'',1,0,1); + print $form->selectDate($object->date_start, 'dateo', 1, 1, 0, '', 1, 0); print '
'.$langs->trans("DateEnd").''; - print $form->select_date($object->date_end?$object->date_end:-1,'datee',1,1,0,'',1,0,1); + print $form->selectDate($object->date_end?$object->date_end:-1, 'datee', 1, 1, 0, '', 1, 0); print '
'; //$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $newdate=''; - print $form->select_date($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0, 1); + print $form->selectDate($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0); print ''; //$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $newdate=''; - print $form->select_date($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0, 1); + print $form->selectDate($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0); print '
'.$langs->trans("DateToBirth").''; -print $form->select_date($birthday,'birth',0,0,1,"newmember",1,0,1); +print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); print '
'.$langs->trans("URLPhoto").'
'.fieldLabel('Capital','capital').' '.$langs->trans("Currency".$conf->currency).'
'; // date - print $formother->select_month($month?$month:-1,'month',1); + print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle'); $formother->select_year($year?$year:-1,'year',1, 20, 1); print ''; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b7ce405b433..f53a9042fca 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -264,7 +264,7 @@ print '
'; * Last third parties modified */ $max=15; -$sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur"; +$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur"; $sql.= ", s.code_client"; $sql.= ", s.code_fournisseur"; $sql.= ", s.logo"; @@ -313,6 +313,7 @@ if ($result) $thirdparty_static->code_client = $objp->code_client; $thirdparty_static->code_fournisseur = $objp->code_fournisseur; $thirdparty_static->canvas=$objp->canvas; + $thirdparty_static->email = $objp->email; print '
'; if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; - 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 $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, $sort, 'maxwidth100'); + 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 ''; - $options_from = ''; // Generate in $options_from the list of each option sorted - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) - { - $options_from .= ''; - } - array_reverse($tab_level, true); // Reverse the list - $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) - { - $options_to .= ''; - } - - // Print these two select - print $langs->trans("From").' '; - print ' '; - print $langs->trans("to").' '; - + print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2); print ''; $arraystcomm=array(); foreach($prospectstatic->cacheprospectstatus as $key => $val) @@ -951,14 +881,14 @@ if (! empty($arrayfields['s.tms']['checked'])) // Status if (! empty($arrayfields['s.status']['checked'])) { - print ''; + print ''; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1); print ''; - print ''; + print ''; print ''.$obj->code_client.''.$obj->code_client.''.$obj->code_fournisseur.''.$obj->code_fournisseur.''; + if (! is_array($staffArray) || count($staffArray)==0) $staffArray = $formcompany->effectif_array(1); + print $staffArray[$obj->staff_code]; + print '".$obj->email."'.$langs->trans('Default').''.$langs->trans('Note').'
'.$langs->trans('DateModification').'
'; + print dol_print_date($companypaymentmodetemp->tms, 'dayhour'); + print ''; if ($user->rights->societe->creer) { @@ -1018,6 +1027,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print $langs->trans("Remote"); + //if ($src->cvc_check == 'fail') print ' - CVC check fail'; + print ''; + //var_dump($src); + print ''; print ''; if ($user->rights->societe->creer) diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 2f325f3001f..c2ea3d987a5 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -23,10 +23,10 @@ if (empty($conf) || ! is_object($conf)) } // Sale representative -print '
'; +print '
'; print $langs->trans('SalesRepresentatives'); print ''; +print ''; $listsalesrepresentatives=$object->getSalesRepresentatives($user); $nbofsalesrepresentative=count($listsalesrepresentatives); diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 19d12a33005..6a4dd8713f7 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov * Copyright (C) 2018 ptibogxiv + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,10 +71,14 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_USER_ACCOUNT_FOR_ACTIONS", GETPOST('STRIPE_USER_ACCOUNT_FOR_ACTIONS', 'int'), 'chaine', 0, '', $conf->entity); + if (! $result > 0) { + $error ++; + } + $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -116,10 +121,8 @@ if ($action == 'setvalue' && $user->admin) if ($action=="setlive") { $liveenable = GETPOST('value','int'); - $res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable,'yesno',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) - { + $res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable, 'yesno', 0, '', $conf->entity); + if ($res > 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else @@ -251,6 +254,11 @@ print 'name; print '
'; +print $langs->trans("StripeUserAccountForActions").''; +print $form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); +print '
'; print $langs->trans("BankAccount").''; print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); @@ -357,4 +365,3 @@ if (! empty($conf->use_javascript_ajax)) // End of page llxFooter(); $db->close(); - diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 2f3d184fdb9..b5f0238e9a2 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -125,15 +125,19 @@ if (!$rowid) // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata - if (! empty($tmparray['CUS'])) + if (! empty($tmparray['CUS']) && $tmparray['CUS'] > 0) { $societestatic->fetch($tmparray['CUS']); } + elseif (! empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) + { + $societestatic->fetch($charge->metadata->dol_thirdparty_id); + } else { $societestatic->id = 0; } - if (! empty($tmparray['MEM'])) + if (! empty($tmparray['MEM']) && $tmparray['MEM'] > 0) { $memberstatic->fetch($tmparray['MEM']); } @@ -142,9 +146,14 @@ if (!$rowid) $memberstatic->id = 0; } - print '
".$charge->id."
".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."".$charge->customer.""; - print $FULLTAG; - if ($charge->metadata->source=="order"){ + if ($charge->metadata->dol_type=="order"){ $object = new Commande($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_order')." ".$object->ref.""; - } elseif ($charge->metadata->source=="invoice"){ + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_order')." ".$object->ref.""; + } else print $FULLTAG; + } elseif ($charge->metadata->dol_type=="invoice"){ $object = new Facture($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_invoice')." ".$object->ref.""; - } + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_invoice')." ".$object->ref.""; + } else print $FULLTAG; + } else print $FULLTAG; print "'.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."'; if ($charge->refunded=='1'){ - print $langs->trans("refunded"); + print img_picto($langs->trans("refunded"),'statut6'); } elseif ($charge->paid=='1'){ - print $langs->trans("".$charge->status.""); + + print img_picto($langs->trans("".$charge->status.""),'statut4'); + } else { $label="Message: ".$charge->failure_message."
"; $label.="Réseau: ".$charge->outcome->network_status."
"; $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); - print $form->textwithpicto($langs->trans("".$charge->status.""),$label,1); + print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""),'statut8'),$label,1); } print "
id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print' >'; -if ($src->object=='card'){ -if ($src->brand == 'Visa') {$brand='cc-visa';} -elseif ($src->brand == 'MasterCard') {$brand='cc-mastercard';} -elseif ($src->brand == 'American Express') {$brand='cc-amex';} -elseif ($src->brand == 'Discover') {$brand='cc-discover';} -elseif ($src->brand == 'JCB') {$brand='cc-jcb';} -elseif ($src->brand == 'Diners Club') {$brand='cc-diners-club';} -else {$brand='credit-card-alt';} -print ''; -} -elseif ($src->object=='source' && $src->type=='card'){ -if ($src->card->brand == 'Visa') {$brand='cc-visa';} -elseif ($src->card->brand == 'MasterCard') {$brand='cc-mastercard';} -elseif ($src->card->brand == 'American Express') {$brand='cc-amex';} -elseif ($src->card->brand == 'Discover') {$brand='cc-discover';} -elseif ($src->card->brand == 'JCB') {$brand='cc-jcb';} -elseif ($src->card->brand == 'Diners Club') {$brand='cc-diners-club';} -else {$brand='credit-card-alt';} - -print ''; -} -elseif ($src->object=='source' && $src->type=='sepa_debit'){ -print ''; -} + if ($src->object=='card') + { + print img_credit_card($src->brand); + } + elseif ($src->object=='source' && $src->type=='card') + { + print img_credit_card($src->card->brand); + } + elseif ($src->object=='source' && $src->type=='sepa_debit') + { + print ''; + } print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print' >'; if ($src->object=='card'){ -print '**** '.$src->last4.'
Exp. '.$src->exp_month.'/'.$src->exp_year.''; + print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; print '
'; if ($src->country) { @@ -679,7 +668,7 @@ print ''; else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object=='source' && $src->type=='card'){ - print $src->owner->name.'
**** '.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print $src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '
'; if ($src->card->country) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 47dec6ae956..cbd9eaac58f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1,15 +1,16 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012-2013 Christophe Battarel - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2014 Ferran Marcet +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -628,7 +629,7 @@ if (empty($reshook)) if(!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); $pu_ht = $productsupplier->fourn_pu; @@ -1133,9 +1134,9 @@ if ($action == 'create') $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); - $form->select_date($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask"); + print $form->selectDate($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask"); } else { - $form->select_date($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1); + print $form->selectDate($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1); } print '
'.$langs->trans("DateEmployment").''; - echo $form->select_date(GETPOST('dateemployment'),'dateemployment',0,0,1,'form'.'dateemployment',1,0,1); + print $form->selectDate(GETPOST('dateemployment'), 'dateemployment', 0, 0, 1, 'formdateemployment', 1, 0); print '
'.$langs->trans("DateEmploymentEnd").''; - echo $form->select_date(GETPOST('dateemploymentend'),'dateemploymentend',0,0,1,'form'.'dateemploymentend',1,0,1); + print $form->selectDate(GETPOST('dateemploymentend'), 'dateemploymentend', 0, 0, 1, 'formdateemploymentend', 1, 0); print '
'.$langs->trans("DateToBirth").''; - echo $form->select_date(GETPOST('birth'),'birth',0,0,1,'createuser',1,0,1); + print $form->selectDate(GETPOST('birth'), 'birth', 0, 0, 1, 'createuser', 1, 0); print '
'.$langs->trans("DateEmployment").''; - echo $form->select_date(GETPOST('dateemployment')?GETPOST('dateemployment'):$object->dateemployment,'dateemployment',0,0,1,'form'.'dateemployment',1,0,1); + print $form->selectDate(GETPOST('dateemployment')?GETPOST('dateemployment'):$object->dateemployment, 'dateemployment', 0, 0, 1, 'formdateemployment', 1, 0); print '
'.$langs->trans("DateEmploymentEnd").''; - echo $form->select_date(GETPOST('dateemploymentend')?GETPOST('dateemploymentend'):$object->dateemploymentend,'dateemploymentend',0,0,1,'form'.'dateemploymentend',1,0,1); + print $form->selectDate(GETPOST('dateemploymentend')?GETPOST('dateemploymentend'):$object->dateemploymentend, 'dateemploymentend', 0, 0, 1, 'formdateemploymentend', 1, 0); print '
'.$langs->trans("DateToBirth").''; - echo $form->select_date(GETPOST('birth')?GETPOST('birth'):$object->birth,'birth',0,0,1,'updateuser',1,0,1); + print $form->selectDate(GETPOST('birth')?GETPOST('birth'):$object->birth, 'birth', 0, 0, 1, 'updateuser', 1, 0); print '
'; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 5c2869847c6..563ff54c490 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2010-2015 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,6 +110,12 @@ if (empty($reshook)) { $tabparam["MAIN_SIZE_LISTE_LIMIT"] = ''; } + if (GETPOST("check_AGENDA_DEFAULT_VIEW") == "on") { + $tabparam["AGENDA_DEFAULT_VIEW"] = $_POST["AGENDA_DEFAULT_VIEW"]; + } else { + $tabparam["AGENDA_DEFAULT_VIEW"] = ''; + } + if (GETPOST("check_MAIN_THEME") == "on") { $tabparam["MAIN_THEME"] = $_POST["main_theme"]; } else { @@ -137,6 +144,12 @@ if (empty($reshook)) { $tabparam["THEME_ELDY_USE_HOVER"] = 0; } + if (GETPOST('check_THEME_ELDY_USE_CHECKED') == 'on') { + $tabparam["THEME_ELDY_USE_CHECKED"] = 1; + } else { + $tabparam["THEME_ELDY_USE_CHECKED"] = 0; + } + $result = dol_set_user_param($db, $conf, $object, $tabparam); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); @@ -216,6 +229,9 @@ if ($action == 'edit') if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); } else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); } + if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); } + else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); } + if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); } else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); } @@ -224,8 +240,9 @@ if ($action == 'edit') } init_myfunc(); jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); }); - jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); }); jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); }); + jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); }); + jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); }); jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); }); jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); }); jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); }); @@ -244,7 +261,7 @@ if ($action == 'edit') print ''; - print ''; print ''; - // Langue par defaut + // Language by default print ''; print ''; - print ''; print ''; - // Taille max des listes + // Max size of lists print ''; print ''; - print ''; print ''; + // AGENDA_DEFAULT_VIEW + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''."\n"; + print '
'; print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); print 'conf->MAIN_LANDING_PAGE)?" checked":""); + print 'conf->MAIN_LANDING_PAGE)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; @@ -252,28 +269,40 @@ if ($action == 'edit') //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0); print '
'.$langs->trans("Language").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print $s?$s.' ':''; print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print 'conf->MAIN_LANG_DEFAULT)?" checked":""); + print 'conf->MAIN_LANG_DEFAULT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print $formadmin->select_language((! empty($object->conf->MAIN_LANG_DEFAULT)?$object->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1,null,0,0,(! empty($dolibarr_main_demo))); print '
'.$langs->trans("MaxSizeList").''.$conf->global->MAIN_SIZE_LISTE_LIMIT.'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); + print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").'
'.$langs->trans("AGENDA_DEFAULT_VIEW").' conf->AGENDA_DEFAULT_VIEW)?" checked":""); + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo + print '> '.$langs->trans("UsePersonalValue").''."\n"; + $tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); + print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, ''); + print '

'; // Theme @@ -301,12 +330,11 @@ else print '
'.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
'.$langs->trans("LandingPage").''; print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); print 'conf->MAIN_LANDING_PAGE)?" checked":""); + print 'conf->MAIN_LANDING_PAGE)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; @@ -319,26 +347,35 @@ else print '
'.$langs->trans("Language").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print ($s?$s.' ':''); print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print 'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; $s=(isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : ''); print ($s?$s.' ':''); print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):(! empty($object->conf->MAIN_LANG_DEFAULT)?$langs->trans("Language_".$object->conf->MAIN_LANG_DEFAULT):'')); print '
'.$langs->trans("MaxSizeList").''.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:' ').'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'' . (! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?$object->conf->MAIN_SIZE_LISTE_LIMIT:' ') . '
'.$langs->trans("AGENDA_DEFAULT_VIEW").' conf->AGENDA_DEFAULT_VIEW)?" checked":"").'> '.$langs->trans("UsePersonalValue").''."\n"; + $tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); + if (! empty($object->conf->AGENDA_DEFAULT_VIEW)) print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1); + print '

'; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index cf13529d23a..26555d6f59e 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -177,11 +177,11 @@ $rowspan=2; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('thumbs/'.$mysoc->logo_small); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); } elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($mysoc->logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); $width=128; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 9f3dafdc153..be73db1fff0 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -137,7 +137,7 @@ $var = false; llxHeader('', $title); -//print_fiche_titre($title); +//print load_fiche_titre($title); $h=0; $head[$h][0] = DOL_URL_ROOT.'/variants/card.php?id='.$object->id; @@ -243,7 +243,7 @@ if ($action == 'edit') { ?> trans("PossibleValues")); + print load_fiche_titre($langs->trans("PossibleValues")); if ($action == 'edit_value') { print ''; diff --git a/htdocs/variants/create.php b/htdocs/variants/create.php index 0e491be448d..4f2d53bb75f 100644 --- a/htdocs/variants/create.php +++ b/htdocs/variants/create.php @@ -66,7 +66,7 @@ $title = $langs->trans('NewProductAttribute'); llxHeader('', $title); -print_fiche_titre($title); +print load_fiche_titre($title); dol_fiche_head(); diff --git a/htdocs/variants/create_val.php b/htdocs/variants/create_val.php index 8213148327d..86372df9f59 100644 --- a/htdocs/variants/create_val.php +++ b/htdocs/variants/create_val.php @@ -118,7 +118,7 @@ print ''; print ''; print ''; -print_fiche_titre($langs->trans('NewProductAttributeValue')); +print load_fiche_titre($langs->trans('NewProductAttributeValue')); dol_fiche_head(); diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index 49265f25001..d07c8bf66d0 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -160,7 +160,7 @@ if (! empty($id) || ! empty($ref)) { dol_fiche_end(); } - print_fiche_titre($langs->trans('ProductCombinationGenerator')); + print load_fiche_titre($langs->trans('ProductCombinationGenerator')); $dictionary_attr = array(); diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index dbe76ae49c4..45393d07303 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -37,7 +37,8 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Some value of modulepart can be used to get resources that are public so no login are required. -if ((isset($_GET["modulepart"]) && ($_GET["modulepart"] == 'mycompany' || $_GET["modulepart"] == 'companylogo'))) +// Note that only directory logo is free to access without login. +if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file'])) { if (! defined("NOLOGIN")) define("NOLOGIN",1); if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site. @@ -82,7 +83,6 @@ function llxFooter() require 'main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $action=GETPOST('action','alpha'); $original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP). $hashp=GETPOST('hashp','aZ09'); @@ -96,6 +96,7 @@ if (empty($original_file) && empty($hashp) && $modulepart != 'barcode') accessfo if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility + /* * Actions */ diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index d4e29841821..1629a698673 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -39,57 +40,57 @@ class Website extends CommonObject * @var string Id to identify managed objects */ public $element = 'website'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'website'; - + /** * @var array Does website support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; - + /** * @var string String with name of icon for website. Must be the part after the 'object_' into object_myobject.png */ public $picto = 'globe'; /** - * @var int + * @var int Entity */ public $entity; - + /** - * @var string + * @var string Ref */ public $ref; - + /** - * @var string + * @var string description */ public $description; - + /** - * @var int + * @var int Status */ public $status; - + /** * @var mixed */ public $date_creation; - + /** * @var mixed */ public $tms = ''; - + /** * @var integer */ public $fk_default_home; - + /** * @var string */ @@ -137,11 +138,17 @@ class Website extends CommonObject if (isset($this->status)) { $this->status = trim($this->status); } - if (empty($this->date_creation)) $this->date_creation = $now; - if (empty($this->date_modification)) $this->date_modification = $now; + if (empty($this->date_creation)) { + $this->date_creation = $now; + } + if (empty($this->date_modification)) { + $this->date_modification = $now; + } // Check parameters - if (empty($this->entity)) { $this->entity = $conf->entity; } + if (empty($this->entity)) { + $this->entity = $conf->entity; + } // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; @@ -158,7 +165,7 @@ class Website extends CommonObject $sql .= ' '.((empty($this->entity) && $this->entity != '0')?'NULL':$this->entity).','; $sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").','; $sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").','; - $sql .= ' '.(! isset($this->status)?'NULL':$this->status).','; + $sql .= ' '.(! isset($this->status)?'1':$this->status).','; $sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).','; $sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").","; $sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).','; @@ -178,16 +185,16 @@ class Website extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + // if (!$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers - } - } + // // Call triggers + // $result = $this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + // } + } // Commit or rollback if ($error) { @@ -484,6 +491,14 @@ class Website extends CommonObject } } + if (! $error && ! empty($this->ref)) + { + global $dolibarr_main_data_root; + $pathofwebsite=$dolibarr_main_data_root.'/website/'.$this->ref; + + dol_delete_dir_recursive($pathofwebsite); + } + // Commit or rollback if ($error) { $this->db->rollback(); @@ -695,6 +710,7 @@ class Website extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -702,38 +718,32 @@ class Website extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); @@ -865,7 +875,7 @@ class Website extends CommonObject $allaliases = $objectpageold->pageurl; $allaliases.= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : ''); - $line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; + $line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2... $line.= "\n"; fputs($fp, $line); @@ -906,6 +916,15 @@ class Website extends CommonObject $line.= ");"; $line.= "\n"; fputs($fp, $line); + + // Add line to update home page id during import + //var_dump($this->fk_default_home.' - '.$objectpageold->id.' - '.$objectpageold->newid);exit; + if ($this->fk_default_home > 0 && ($objectpageold->id == $this->fk_default_home) && ($objectpageold->newid > 0)) // This is the record with home page + { + $line = "UPDATE llx_website SET fk_default_home = ".($objectpageold->newid > 0 ? $this->db->escape($objectpageold->newid)."__+MAX_llx_website_page__" : "null")." WHERE rowid = __WEBSITE_ID__;"; + $line.= "\n"; + fputs($fp, $line); + } } fclose($fp); @@ -963,6 +982,15 @@ class Website extends CommonObject dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/containers', $conf->website->dir_output.'/'.$object->ref, 0, 1); // Overwrite if exists + // Now generate the master.inc.php page + $filemaster=$conf->website->dir_output.'/'.$object->ref.'/master.inc.php'; + $result = dolSaveMasterFile($filemaster); + if (! $result) + { + $this->errors[]='Failed to write file '.$filemaster; + $error++; + } + dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists @@ -987,7 +1015,7 @@ class Website extends CommonObject $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); if ($runsql <= 0) { - $this->errors[]='Failed to load sql file '.$sqlfile.'.'; + $this->errors[]='Failed to load sql file '.$sqlfile; $error++; } diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 4b313808e0d..e60a0d2bcfe 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -39,12 +39,12 @@ class WebsitePage extends CommonObject * @var string Id to identify managed objects */ public $element = 'websitepage'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'website_page'; - + /** * @var string String with name of icon for websitepage. Must be the part after the 'object_' into object_myobject.png */ @@ -55,7 +55,12 @@ class WebsitePage extends CommonObject public $aliasalt; public $type_container; public $title; + + /** + * @var string description + */ public $description; + public $keywords; public $htmlheader; public $content; @@ -153,7 +158,9 @@ class WebsitePage extends CommonObject $sql .= " t.status,"; $sql .= " t.grabbed_from,"; $sql .= " t.date_creation,"; - $sql .= " t.tms as date_modification"; + $sql .= " t.tms as date_modification,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_modif"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level $sql .= ' WHERE 1 = 1'; @@ -195,6 +202,8 @@ class WebsitePage extends CommonObject $this->grabbed_from = $obj->grabbed_from; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); + $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_modif = $obj->fk_user_modif; } $this->db->free($resql); @@ -245,7 +254,9 @@ class WebsitePage extends CommonObject $sql .= " t.status,"; $sql .= " t.grabbed_from,"; $sql .= " t.date_creation,"; - $sql .= " t.tms as date_modification"; + $sql .= " t.tms as date_modification,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_modif"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; // Manage filter @@ -294,6 +305,8 @@ class WebsitePage extends CommonObject $record->grabbed_from = $obj->grabbed_from; $record->date_creation = $this->db->jdate($obj->date_creation); $record->date_modification = $this->db->jdate($obj->date_modification); + $record->fk_user_create = $obj->fk_user_create; + $record->fk_user_modif = $obj->fk_user_modif; //var_dump($record->id); $records[$record->id] = $record; } @@ -388,6 +401,7 @@ class WebsitePage extends CommonObject $object->ref = $newref; $object->pageurl = $newref; $object->aliasalt = ''; + $object->fk_user_create = $user->id; $object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title; if (! empty($newlang)) $object->lang=$newlang; if ($istranslation) $object->fk_page = $fromid; @@ -467,6 +481,7 @@ class WebsitePage extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -474,9 +489,9 @@ class WebsitePage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) @@ -485,27 +500,27 @@ class WebsitePage extends CommonObject if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); @@ -521,6 +536,8 @@ class WebsitePage extends CommonObject */ public function initAsSpecimen() { + global $user; + $this->id = 0; $now=dol_now(); @@ -538,5 +555,6 @@ class WebsitePage extends CommonObject $this->grabbed_from = ''; $this->date_creation = $now - (24 * 30 * 3600); $this->date_modification = $now - (24 * 7 * 3600); + $this->fk_user_create = $user->id; } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ce8be81e2cd..590423de2e4 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2018 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 @@ -58,6 +58,7 @@ $type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha'); $section_dir = GETPOST('section_dir', 'alpha'); $file_manager = GETPOST('file_manager', 'alpha'); +if (GETPOST('deletesite','alpha')) { $action='deletesite'; } if (GETPOST('delete','alpha')) { $action='delete'; } if (GETPOST('preview','alpha')) $action='preview'; if (GETPOST('createsite','alpha')) { $action='createsite'; } @@ -139,6 +140,7 @@ $filerobot=$pathofwebsite.'/robots.txt'; $filehtaccess=$pathofwebsite.'/.htaccess'; $filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php'; $fileindex=$pathofwebsite.'/index.php'; +$filewrapper=$pathofwebsite.'/wrapper.php'; // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); @@ -178,6 +180,7 @@ if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfil if ($action == 'seteditinline') { dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1); + dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of show included containers header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int')); exit; } @@ -187,6 +190,19 @@ if ($action == 'unseteditinline') header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int')); exit; } +if ($action == 'setshowsubcontainers') +{ + dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 1); + dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 0); // Force disable of edit inline + header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int')); + exit; +} +if ($action == 'unsetshowsubcontainers') +{ + dolibarr_del_const($db, 'WEBSITE_SUBCONTAINERSINLINE'); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int')); + exit; +} // Add directory /* @@ -714,6 +730,41 @@ if ($action == 'addcontainer') } } +// Delete site +if ($action == 'deletesite') +{ + $error = 0; + + $db->begin(); + + $res = $object->fetch(0, $websitekey); + $website = $object; + + if ($res > 0) + { + $res = $object->delete($user); + if ($res <= 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SiteDeleted", $object->ref, $websitekey), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + $db->rollback(); + dol_print_error($db); + } +} + // Delete page if ($action == 'delete') { @@ -945,7 +996,7 @@ if ($action == 'setashome') // Generate the index.php page to be the home page //------------------------------------------------- - $result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl); + $result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper); if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); else setEventMessages('Failed to write file '.$fileindex, null, 'errors'); @@ -1083,19 +1134,7 @@ if ($action == 'updatemeta') // Now generate the master.inc.php page - dol_syslog("We regenerate the master file (because we update meta)"); - dol_delete_file($filemaster); - - $mastercontent = ''."\n"; - $result = file_put_contents($filemaster, $mastercontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); - + $result = dolSaveMasterFile($filemaster); if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); // Now delete the alias.php page @@ -1283,16 +1322,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf // Now generate the master.inc.php page - dol_syslog("We regenerate the master file"); - dol_delete_file($filemaster); - - $mastercontent = ''."\n"; - $result = file_put_contents($filemaster, $mastercontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); + $result = dolSaveMasterFile($filemaster); if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); @@ -1374,6 +1404,21 @@ if ($action == 'importsiteconfirm') { if (! empty($_FILES)) { + // Check symlink to medias and restore it if ko + $pathtomedias=DOL_DATA_ROOT.'/medias'; + $pathtomediasinwebsite=$pathofwebsite.'/medias'; + if (! is_link(dol_osencode($pathtomediasinwebsite))) + { + dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); + dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists + $result = symlink($pathtomedias, $pathtomediasinwebsite); + if (! $result) + { + setEventMessages($langs->trans("ErrorFieldToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + $action = 'importsite'; + } + } + if (is_array($_FILES['userfile']['tmp_name'])) $userfiles=$_FILES['userfile']['tmp_name']; else $userfiles=array($_FILES['userfile']['tmp_name']); @@ -1590,6 +1635,8 @@ if (count($object->records) > 0) print ''; } + print ''; + print '   '; print ''; @@ -1635,11 +1682,11 @@ if (count($object->records) > 0) //print ''; $htmltext =$langs->trans("SetHereVirtualHost", $dataroot); $htmltext.='
'; - $htmltext.='
'; - $htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot); - $htmltext.='
'; $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT); + $htmltext.='
'; + $htmltext.='
'; + $htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot); print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost'); print ''; @@ -1819,14 +1866,18 @@ if (count($object->records) > 0) print ''; + print '
'; + print '
'; if ($websitepage->grabbed_from) { //print ''; + $langs->trans("EditInLine"); print ''.img_picto($langs->trans("EditInLineOff"),'switch_off','',false,0,0,'','nomarginleft').''; } else { //print ''; + print $langs->trans("EditInLine"); if (empty($conf->global->WEBSITE_EDITINLINE)) { print ''.img_picto($langs->trans("EditInLineOff"),'switch_off','',false,0,0,'','nomarginleft').''; @@ -1836,8 +1887,19 @@ if (count($object->records) > 0) print ''.img_picto($langs->trans("EditInLineOn"),'switch_on','',false,0,0,'','nomarginleft').''; } } - - print '   '; + print '
'; + print '
'; + print $langs->trans("ShowSubcontainers"); + if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE)) + { + print ''.img_picto($langs->trans("ShowSubContainersOff"),'switch_off','',false,0,0,'','nomarginleft').''; + } + else + { + print ''.img_picto($langs->trans("ShowSubContainersOn"),'switch_on','',false,0,0,'','nomarginleft').''; + } + print '
'; + print '
'; if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print ''; else print ''; @@ -2149,7 +2211,7 @@ if ($action == 'createsite') dol_fiche_head($head, 'card', $langs->trans("AddSite"), -1, 'globe'); */ - if ($action == 'createcontainer') print_fiche_titre($langs->trans("AddSite")); + if ($action == 'createcontainer') print load_fiche_titre($langs->trans("AddSite")); print ''."\n"; //print '
'; @@ -2211,7 +2273,7 @@ if ($action == 'importsite') print '
'; - print_fiche_titre($langs->trans("ImportSite")); + print load_fiche_titre($langs->trans("ImportSite")); dol_fiche_head(array(), '0', '', -1); @@ -2243,7 +2305,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') dol_fiche_head($head, 'card', $langs->trans("AddPage"), -1, 'globe'); */ - if ($action == 'createcontainer') print_fiche_titre($langs->trans("AddPage")); + if ($action == 'createcontainer') print load_fiche_titre($langs->trans("AddPage")); print ''."\n"; //print '
'; diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index 53136bf67b2..fb807e44345 100755 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -1,8 +1,9 @@ #!/usr/bin/env php - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry +/* Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +103,7 @@ $periodlink = ''; $exportlink = ''; $nom = $langs->trans("ReportThirdParty"); -$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); +$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $description = $langs->trans("DescThirdPartyReport"); $builddate=dol_now(); diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index b97b8c5b20c..8ffefa0ca9a 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -143,6 +143,12 @@ $object = new Cronjob($db); $filter=array(); if (! empty($id)) { + if (! is_numeric($id)) + { + echo "Error: Bad value for parameter job id"; + dol_syslog("cron_run_jobs.php Bad value for parameter job id", LOG_WARNING); + exit; + } $filter['t.rowid']=$id; } @@ -162,7 +168,7 @@ foreach($object->lines as $val) $qualifiedjobs[] = $val; } -// TODO This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. +// TODO Duplicate. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. $nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index 69edbd68f48..63601cb33d3 100644 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -252,6 +252,7 @@ class CoreTest extends PHPUnit_Framework_TestCase // This is code copied from main.inc.php !!!!!!!!!!!!!!! + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). * @@ -261,6 +262,7 @@ class CoreTest extends PHPUnit_Framework_TestCase */ function testSqlAndScriptInject($val, $type) { + // phpcs:enable $inj = 0; // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) if ($type != 2)