From d0f83141fbaa5bb61a43bf803fa5a432eb2e7098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:38:01 +0200 Subject: [PATCH 001/345] FIX: Bad variable usage --- htdocs/accountancy/admin/account.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index c42a8d7079b..340cb3e18d5 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -65,8 +65,7 @@ if ($action == 'delete') { $accounting = new AccountingAccount($db); if ($action == 'disable') { - $accounting = $accounting->fetch($id); - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); } @@ -75,10 +74,7 @@ if ($action == 'disable') { setEventMessage($accounting->error, 'errors'); } } else if ($action == 'enable') { - - $accounting = $accounting->fetch($id); - - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } $action = 'update'; @@ -206,4 +202,4 @@ if ($result) { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); From bab1dd13e248a08bd01cd9336a7291f2bcfce7c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:42:07 +0200 Subject: [PATCH 002/345] FIX: missing extends --- htdocs/accountancy/class/accountingaccount.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 82c3ec3ca10..f91f21343f8 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -26,7 +26,7 @@ /** * Classe permettant la gestion des comptes generaux de compta */ -class AccountingAccount +class AccountingAccount extends CommonObject { var $db; var $id; @@ -426,4 +426,4 @@ class AccountingAccount return - 1; } } -} \ No newline at end of file +} From 7b300b0a9dfdc2d9c852febb6e2c0fb02bd20e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:42:21 +0200 Subject: [PATCH 003/345] FIX: Missing variable declaration --- htdocs/accountancy/class/accountingaccount.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index f91f21343f8..4ecd0b3c8e1 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -107,6 +107,7 @@ class AccountingAccount extends CommonObject { global $conf, $langs; $error = 0; + $now = dol_now(); // Clean parameters if (isset($this->fk_pcg_version)) From b1ad7af527f039c0c4888408c7ae9034f4cbe26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:42:33 +0200 Subject: [PATCH 004/345] FIX: Missing extends --- htdocs/accountancy/class/bookkeeping.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 2788526de05..e9bbc7d5958 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -27,7 +27,7 @@ /** * Class to manage accountancy book keeping */ -class BookKeeping +class BookKeeping extends CommonObject { var $db; var $id; @@ -709,4 +709,4 @@ class BookKeepingLine var $fk_user_author; var $code_journal; var $piece_num; -} \ No newline at end of file +} From 64da1b1dc03326dfcc9785314948a36bd3bc1daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:43:49 +0200 Subject: [PATCH 005/345] FIX: Removed HTML file preventing PHP service --- htdocs/accountancy/customer/index.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 htdocs/accountancy/customer/index.html diff --git a/htdocs/accountancy/customer/index.html b/htdocs/accountancy/customer/index.html deleted file mode 100644 index e69de29bb2d..00000000000 From 9a141215bb279e46b7c2fda8c30e13cd489156d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:46:53 +0200 Subject: [PATCH 006/345] FIX: Moved code to where the variable is defined --- htdocs/accountancy/journal/bankjournal.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 82c3a09e20a..ef39e5668a0 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -137,17 +137,18 @@ if ($result) { $tabpay = array (); $tabbq = array (); $tabtp = array (); - $tabcompany[$obj->rowid] = array ( - 'id' => $obj->socid, - 'name' => $obj->name, - 'code_client' => $obj->code_compta - ); $tabtype = array (); $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); + $tabcompany[$obj->rowid] = array ( + 'id' => $obj->socid, + 'name' => $obj->name, + 'code_client' => $obj->code_compta + ); + // Controls $compta_bank = $obj->account_number; if ($obj->label == '(SupplierInvoicePayment)') @@ -580,4 +581,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } -$db->close(); \ No newline at end of file +$db->close(); From cc68966d7282f17176ce9baf52d188a2d69d72dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:49:07 +0200 Subject: [PATCH 007/345] FIX: Missing declaration --- htdocs/accountancy/journal/purchasesjournal.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index e0c2ceb8e36..09d93d5cd50 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -246,7 +246,9 @@ if ($action == 'export_csv') { header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_achats.csv'); - + + $companystatic = new Fournisseur($db); + if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert { foreach ( $tabfac as $key => $val ) { @@ -468,4 +470,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } -$db->close(); \ No newline at end of file +$db->close(); From 332caa2b7124ca6e314d5b119d2ee8676c903504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:51:21 +0200 Subject: [PATCH 008/345] FIX: missing global declaration --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1059d1af07d..50b9a35f4fe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2768,7 +2768,7 @@ abstract class CommonObject */ function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0) { - global $conf,$langs,$user,$object,$hookmanager; + global $conf, $hookmanager, $inputalsopricewithtax, $langs, $user; print ''; From 852758c81c0bba13e3769804695206884e91e8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:52:22 +0200 Subject: [PATCH 009/345] FIX: Removed concatenation on undeclared variable --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5cf872eb3d8..937f904c512 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1297,7 +1297,7 @@ class Form // Method with no ajax //$out.='
'; - $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); + $out=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); $out.=''; $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); From 4c7ae3d14b66e836b13b2fd6d11d56bb924127eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:54:04 +0200 Subject: [PATCH 010/345] FIX: Missing parameter declaration --- htdocs/core/lib/accounting.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index e7313c73aee..7b18de022f6 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -25,10 +25,11 @@ /** * Prepare array with list of admin tabs + * @param Object $object Accounting account * * @return array Array of tabs to show */ -function admin_accounting_prepare_head() +function admin_accounting_prepare_head($object) { global $langs, $conf; @@ -189,4 +190,4 @@ function length_exportsage($txt, $len, $end) } } return $res; -} \ No newline at end of file +} From 7c7276b5aaaf3c3dc515f4299e6e2e4b8ee8e892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:57:15 +0200 Subject: [PATCH 011/345] FIX: Removed undeclared variable --- htdocs/societe/consumption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0aa9f0e5979..10d0f69dd8e 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -67,7 +67,7 @@ if (GETPOST("button_removefilter")) } // Customer or supplier selected in drop box $thirdTypeSelect = GETPOST("third_select_id"); -$type_element = GETPOST('type_element')?GETPOST('type_element'):$type_element; +$type_element = GETPOST('type_element')?GETPOST('type_element'):''; $langs->load("companies"); From c7c809a6095ceae7697bfe9b24f6bb7a7fb5fd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 12:02:17 +0200 Subject: [PATCH 012/345] FIX: Wrong type hinting --- .../class/fournisseur.commande.class.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4e8c3a650b0..07964e69d58 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1062,25 +1062,25 @@ class CommandeFournisseur extends CommonOrder * Add order line * * @param string $desc Description - * @param double $pu_ht Unit price - * @param double $qty Quantity - * @param double $txtva Taux tva - * @param double $txlocaltax1 Localtax1 tax - * @param double $txlocaltax2 Localtax2 tax + * @param float $pu_ht Unit price + * @param float $qty Quantity + * @param float $txtva Taux tva + * @param float $txlocaltax1 Localtax1 tax + * @param float $txlocaltax2 Localtax2 tax * @param int $fk_product Id produit * @param int $fk_prod_fourn_price Id supplier price * @param string $fourn_ref Supplier reference - * @param double $remise_percent Remise + * @param float $remise_percent Remise * @param string $price_base_type HT or TTC - * @param double $pu_ttc Unit price TTC + * @param float $pu_ttc Unit price TTC * @param int $type Type of line (0=product, 1=service) * @param int $info_bits More information - * @param int $notrigger Disable triggers - * @param timestamp $date_start Date start of service - * @param timestamp $date_end Date end of service + * @param bool $notrigger Disable triggers + * @param int $date_start Date start of service + * @param int $date_end Date end of service * @return int <=0 if KO, >0 if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0, $notrigger=false, $date_start='', $date_end='') + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null) { global $langs,$mysoc; From 3a0d4cd47f139e57d8a9c81db00d4c6ab8b27c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:22:22 +0200 Subject: [PATCH 013/345] =?UTF-8?q?FIX:=C2=A0Missing=20visibility=20of=20s?= =?UTF-8?q?tatic=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d5d16efc2e9..c4bb2afcd44 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -54,7 +54,7 @@ class ExtraFields var $error; var $errno; - static $type2label=array( + public static $type2label=array( 'varchar'=>'String', 'text'=>'TextLong', 'int'=>'Int', From 37c0b9606b7c7db25fb714b3ae3b37ae9bb8b573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:32:50 +0200 Subject: [PATCH 014/345] FIX: Removed unused variable --- scripts/accountancy/export-thirdpartyaccount.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index 2556457f38e..f1ff769059c 100644 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -164,7 +164,6 @@ if ($resql) { header('Content-Disposition: attachment;filename=export_csv.csv'); $obj = $db->fetch_object($resql); - $var = ! $var; print '"' . $obj->compta . '",'; print '"' . $obj->address . '",'; @@ -237,4 +236,4 @@ if ($resql) { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); From 131997eeb8684df3c6012a134ef6cabe064011a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:39:17 +0200 Subject: [PATCH 015/345] FIX: Removed undeclared variables --- htdocs/core/modules/action/rapport.pdf.php | 2 +- htdocs/core/modules/cheque/pdf/pdf_blochet.class.php | 2 +- htdocs/core/modules/rapport/pdf_paiement.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 1f03ea19d62..3bf7eddecce 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -127,7 +127,7 @@ class CommActionRapport $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 1112150a0e9..c2ac3aaa628 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -120,7 +120,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters=array('outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 683034156da..a4b73f22e90 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -126,7 +126,7 @@ class pdf_paiement $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters=array('file'=>$file,'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks From afcebea440e2752945f67b95a43fa9d6a47ec90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:40:43 +0200 Subject: [PATCH 016/345] FIX: Missing global declaration --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- htdocs/core/modules/project/pdf/pdf_baleine.modules.php | 2 +- htdocs/core/modules/rapport/pdf_paiement.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index fa2e3c85c06..80cf628838d 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -106,7 +106,7 @@ class pdf_soleil extends ModelePDFFicheinter */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc; + global $conf, $hookmanager, $langs, $user; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index 58dd367757e..0165a01a9bc 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -92,7 +92,7 @@ class pdf_baleine extends ModelePDFProjects */ function write_file($object,$outputlangs) { - global $user,$langs,$conf; + global $conf, $hookmanager, $langs, $user; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index a4b73f22e90..6f48cc1baca 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -91,7 +91,7 @@ class pdf_paiement { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - global $user,$langs,$conf; + global $conf, $hookmanager, $langs, $user; $socid=0; if ($user->societe_id) $socid=$user->societe_id; From f68cb3bfcbbf9e659066e53d532bd27ab345256b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:52:59 +0200 Subject: [PATCH 017/345] FIX: Variable declared boolean --- htdocs/core/modules/modSyslog.class.php | 2 +- htdocs/core/modules/modUser.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 563b2e31fa0..f2b5f80ff32 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -50,7 +50,7 @@ class modSyslog extends DolibarrModules // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Activate debug logs (syslog)"; // Can be enabled / disabled only in the main company - $this->core_enabled = 1; + $this->core_enabled = true; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index a59031b4a44..55e96f02262 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -49,7 +49,7 @@ class modUser extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des utilisateurs (requis)"; - $this->always_enabled = 1; // Can't be disabled + $this->always_enabled = true; // Can't be disabled // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; From eea9a76589c6138dea1e06c8774d7c6a1522cfd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:09:03 +0200 Subject: [PATCH 018/345] FIX: Variable might not be traversable --- htdocs/accountancy/journal/bankjournal.php | 144 +++++++++++---------- htdocs/accountancy/journal/cashjournal.php | 107 +++++++-------- htdocs/comm/action/peruser.php | 77 ++++++----- htdocs/compta/bank/class/account.class.php | 8 +- htdocs/core/class/html.form.class.php | 19 +-- htdocs/core/lib/json.lib.php | 2 +- htdocs/user/class/usergroup.class.php | 2 +- 7 files changed, 192 insertions(+), 167 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ef39e5668a0..ca862098bd3 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -170,83 +170,87 @@ if ($result) { } $links = $object->get_url($obj->rowid); - foreach ( $links as $key => $val ) { + // get_url may return -1 which is not traversable + if (is_array($links)) { - $tabtype[$obj->rowid] = $links[$key]['type']; + foreach ( $links as $key => $val ) { - if ($links[$key]['type'] == 'payment') - { - $paymentstatic->id = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } - else if ($links[$key]['type'] == 'payment_supplier') - { - $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } - else if ($links[$key]['type'] == 'company') - { - $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; - $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); - $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } - else if ($links[$key]['type'] == 'sc') - { - $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; + $tabtype[$obj->rowid] = $links[$key]['type']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); - if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { - if ($reg[1] == 'socialcontribution') - $reg[1] = 'SocialContribution'; - $chargestatic->lib = $langs->trans($reg[1]); - } - else + if ($links[$key]['type'] == 'payment') { - $chargestatic->lib = $links[$key]['label']; - } - $chargestatic->ref = $chargestatic->lib; - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - - $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) + $paymentstatic->id = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); + } + else if ($links[$key]['type'] == 'payment_supplier') { - $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + $paymentsupplierstatic->id = $links[$key]['url_id']; + $paymentsupplierstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); } + else if ($links[$key]['type'] == 'company') + { + $societestatic->id = $links[$key]['url_id']; + $societestatic->nom = $links[$key]['label']; + $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); + $tabtp[$obj->rowid][$compta_soc] += $obj->amount; + } + else if ($links[$key]['type'] == 'sc') + { + $chargestatic->id = $links[$key]['url_id']; + $chargestatic->ref = $links[$key]['url_id']; + + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { + if ($reg[1] == 'socialcontribution') + $reg[1] = 'SocialContribution'; + $chargestatic->lib = $langs->trans($reg[1]); + } + else + { + $chargestatic->lib = $links[$key]['label']; + } + $chargestatic->ref = $chargestatic->lib; + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + + $sqlmid = 'SELECT cchgsoc.accountancy_code'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) + { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + } + } + else if ($links[$key]['type'] == 'payment_vat') + { + $paymentvatstatic->id = $links[$key]['url_id']; + $paymentvatstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } + else if ($links[$key]['type'] == 'payment_salary') + { + $paymentsalstatic->id = $links[$key]['url_id']; + $paymentsalstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); + $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + } + else if ($links[$key]['type'] == 'banktransfert') + { + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } + /*else { + $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; + }*/ } - else if ($links[$key]['type'] == 'payment_vat') - { - $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } - else if ($links[$key]['type'] == 'payment_salary') - { - $paymentsalstatic->id = $links[$key]['url_id']; - $paymentsalstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; - } - else if ($links[$key]['type'] == 'banktransfert') - { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } - /*else { - $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; - }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index 33b1e4359c1..e2994ce57e6 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -157,64 +157,67 @@ if ($result) { } $links = $object->get_url($obj->rowid); - foreach ( $links as $key => $val ) { + // get_url may return -1 which is not traversable + if (is_array($links)) { + foreach ($links as $key => $val) { - $tabtype[$obj->rowid] = $links[$key]['type']; + $tabtype[$obj->rowid] = $links[$key]['type']; - if ($links[$key]['type'] == 'payment') { - $paymentstatic->id = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'payment_supplier') { - $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'company') { + if ($links[$key]['type'] == 'payment') { + $paymentstatic->id = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); + } else if ($links[$key]['type'] == 'payment_supplier') { + $paymentsupplierstatic->id = $links[$key]['url_id']; + $paymentsupplierstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); + } else if ($links[$key]['type'] == 'company') { - $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; - $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); - $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { + $societestatic->id = $links[$key]['url_id']; + $societestatic->nom = $links[$key]['label']; + $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); + $tabtp[$obj->rowid][$compta_soc] += $obj->amount; + } else if ($links[$key]['type'] == 'sc') { - $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; + $chargestatic->id = $links[$key]['url_id']; + $chargestatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); - if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { - if ($reg[1] == 'socialcontribution') - $reg[1] = 'SocialContribution'; - $chargestatic->lib = $langs->trans($reg[1]); - } else { - $chargestatic->lib = $links[$key]['label']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { + if ($reg[1] == 'socialcontribution') + $reg[1] = 'SocialContribution'; + $chargestatic->lib = $langs->trans($reg[1]); + } else { + $chargestatic->lib = $links[$key]['label']; + } + $chargestatic->ref = $chargestatic->lib; + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + + $sqlmid = 'SELECT cchgsoc.accountancy_code'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + } + } else if ($links[$key]['type'] == 'payment_vat') { + + $paymentvatstatic->id = $links[$key]['url_id']; + $paymentvatstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } else if ($links[$key]['type'] == 'banktransfert') { + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; } - $chargestatic->ref = $chargestatic->lib; - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - - $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; - } - } else if ($links[$key]['type'] == 'payment_vat') { - - $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } else if ($links[$key]['type'] == 'banktransfert') { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; + /*else { + $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; + }*/ } - /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; - }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; @@ -530,4 +533,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 8bcd1c7289b..ccb544ac4bb 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -600,41 +600,56 @@ else // Loop on each user to show calendar $sav = $tmpday; $showheader = true; -foreach ($usernames as $username) -{ - echo ""; - echo '' . $username->getNomUrl(1). ''; - $tmpday = $sav; - $i = 0; - for ($iter_day = 0; $iter_day < 7; $iter_day++) - { - if (($i + 1) < $begin_d || ($i + 1) > $end_d) - { +// listUsersForGroup may return -1 which is not traversable +if (is_array($usernames)) { + foreach ($usernames as $username) { + echo ""; + echo '' . $username->getNomUrl(1) . ''; + $tmpday = $sav; + + $i = 0; + for ($iter_day = 0; $iter_day < 7; $iter_day++) { + if (($i + 1) < $begin_d || ($i + 1) > $end_d) { + $i++; + continue; + } + + // Show days of the current week + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); + $tmparray = dol_getdate($curtime, 'fast'); + $tmpday = $tmparray['mday']; + $tmpmonth = $tmparray['mon']; + $tmpyear = $tmparray['year']; + + $style = 'cal_current_month'; + if ($iter_day == 6) $style .= ' cal_other_month'; + $today = 0; + $todayarray = dol_getdate($now, 'fast'); + if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) $today = 1; + if ($today) $style = 'cal_today_peruser'; + + show_day_events2( + $username, + $tmpday, + $month, + $year, + $monthshown, + $style, + $eventarray, + 0, + $maxnbofchar, + $newparam, + 1, + 300, + $showheader + ); + $i++; - continue; } - - // Show days of the current week - $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime,'fast'); - $tmpday = $tmparray['mday']; - $tmpmonth = $tmparray['mon']; - $tmpyear = $tmparray['year']; - - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month'; - $today=0; - $todayarray=dol_getdate($now,'fast'); - if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; - if ($today) $style='cal_today_peruser'; - - show_day_events2($username, $tmpday, $month, $year, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader); - - $i++; + echo "\n"; + $showheader = false; } - echo "\n"; - $showheader = false; } echo "\n"; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4ca6175d785..cd428f927b2 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -164,10 +164,10 @@ class Account extends CommonObject * TODO Move this into AccountLine * Return array with links from llx_bank_url * - * @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 Array of links + * @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 or -1 on error */ function get_url($fk_bank='', $url_id='', $type='') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 937f904c512..6b0e9b4d895 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1302,14 +1302,17 @@ class Form $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); if (count($assignedtouser)) $out.='
'; - foreach($assignedtouser as $key => $value) - { - $userstatic->fetch($key); - $out.=$userstatic->getNomUrl(1); - //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); - //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); - $out.='
'; - } + // dol_json_decode may return false on error which is not traversable + if (is_array($assignedtouser)) { + foreach($assignedtouser as $key => $value) + { + $userstatic->fetch($key); + $out.=$userstatic->getNomUrl(1); + //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); + //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); + $out.='
'; + } + } //$out.=''; return $out; diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 69dbb4eba1a..00d5970d77e 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -218,7 +218,7 @@ if (! function_exists('json_decode')) * * @param string $json Json encoded to PHP Object or Array * @param bool $assoc False return an object, true return an array. Try to always use it with true ! - * @return mixed Object or Array + * @return mixed Object or Array or false on error */ function dol_json_decode($json, $assoc=false) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index b801c2660aa..9bd0d64fe4c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -178,7 +178,7 @@ class UserGroup extends CommonObject * * @param string $excludefilter Filter to exclude * @param int $mode 0=Return array of user instance, 1=Return array of users id only - * @return array Array of users + * @return array|-1 Array of users or -1 on error */ function listUsersForGroup($excludefilter='', $mode=0) { From a7964c4a9ad4af94b6796b727b304e3ebb9f43c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:20:48 +0200 Subject: [PATCH 019/345] FIX: Replaced deprecated call --- htdocs/accountancy/customer/list.php | 4 ++-- htdocs/accountancy/supplier/list.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 02602262e2c..03e31d44a96 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -63,7 +63,7 @@ if ($action == 'ventil') { $cpt = 0; foreach ( $mesCasesCochees as $maLigneCochee ) { // print '
id selectionnee : '.$monChoix."
"; - $maLigneCourante = split("_", $maLigneCochee); + $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; @@ -234,4 +234,4 @@ if ($result) { } $db->close(); -llxFooter(); \ No newline at end of file +llxFooter(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 84f548344b8..817b07c178e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -65,7 +65,7 @@ if ($action == 'ventil') { foreach ( $mesCasesCochees as $maLigneCochee ) { // print '
id selectionnee : '.$monChoix."
"; - $maLigneCourante = split("_", $maLigneCochee); + $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; From e87b1d68b6fce80fd66e255c6a654b5981232d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:22:05 +0200 Subject: [PATCH 020/345] FIX: Replaced deprecated property --- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/cashjournal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ca862098bd3..218c4dd46df 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -191,7 +191,7 @@ if ($result) { else if ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; + $societestatic->name = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; } diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index e2994ce57e6..ac7cbeb2f77 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -173,7 +173,7 @@ if ($result) { } else if ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; + $societestatic->name = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; } else if ($links[$key]['type'] == 'sc') { From c20f5b186e6e8997feb7fb0f989c69afdbec2612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:25:18 +0200 Subject: [PATCH 021/345] Qual: Updated code documentation --- htdocs/core/modules/DolibarrModules.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e4d1f834b4a..69dabf04219 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -192,10 +192,10 @@ abstract class DolibarrModules * Enables a module. * Inserts all informations into database * - * @param string[] $array_sql SQL requests to be executed when enabling module - * @param string $options String with options when disabling module ('newboxdefonly|noboxes') + * @param string[]|array $array_sql SQL requests to be executed when enabling module + * @param string $options String with options when disabling module ('newboxdefonly|noboxes') * - * @return int 1 if OK, 0 if KO + * @return int 1 if OK, 0 if KO */ function _init($array_sql, $options='') { From e9175d5d663430c9b4e21988e4d87b3b9cff52b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:26:42 +0200 Subject: [PATCH 022/345] Qual: date type doesn't exist --- htdocs/core/lib/report.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 9c701441765..d41594c3193 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -31,7 +31,7 @@ * @param string $period Period of report * @param string $periodlink Link to switch period * @param string $description Description -* @param date $builddate Date generation +* @param int $builddate Date generation * @param string $exportlink Link for export or '' * @param array $moreparam Array with list of params to add into form * @param string $calcmode Calculation mode From b21d85a1da139aafe593ba4300b3d58d3f3b102b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:28:56 +0200 Subject: [PATCH 023/345] FIX: Function was expecting a boolean not a string --- htdocs/comm/action/index.php | 2 +- htdocs/comm/action/peruser.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2318c45f132..7cec34cb6db 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -986,7 +986,7 @@ elseif ($action == 'show_week') // View by week { // Show days of the current week $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime,'fast'); + $tmparray = dol_getdate($curtime, true); $tmpday = $tmparray['mday']; $tmpmonth = $tmparray['mon']; $tmpyear = $tmparray['year']; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ccb544ac4bb..ec6243c7ae7 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -617,7 +617,7 @@ if (is_array($usernames)) { // Show days of the current week $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime, 'fast'); + $tmparray = dol_getdate($curtime, true); $tmpday = $tmparray['mday']; $tmpmonth = $tmparray['mon']; $tmpyear = $tmparray['year']; @@ -625,7 +625,7 @@ if (is_array($usernames)) { $style = 'cal_current_month'; if ($iter_day == 6) $style .= ' cal_other_month'; $today = 0; - $todayarray = dol_getdate($now, 'fast'); + $todayarray = dol_getdate($now, true); if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) $today = 1; if ($today) $style = 'cal_today_peruser'; From bd03cb439d91954e18274024a7ec29dc3fa61811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:36:37 +0200 Subject: [PATCH 024/345] FIX: Function expects an int, not a boolean --- htdocs/comm/action/peruser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ec6243c7ae7..5afda948a77 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -800,9 +800,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color = ''; //init if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h,0,0,$month,$day,$year,false,false); - $b = dol_mktime((int) $h,30,0,$month,$day,$year,false,false); - $c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,false); + $a = dol_mktime((int) $h,0,0,$month,$day,$year,false,0); + $b = dol_mktime((int) $h,30,0,$month,$day,$year,false,0); + $c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,0); $dateendtouse=$event->date_end_in_calendar; if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++; From 0f71b7e0b0f5f5f4628355028dd33eeedee87175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:38:07 +0200 Subject: [PATCH 025/345] FIX: Typo --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20b030a9226..2acf4071052 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -822,7 +822,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false) * @param string $tzoutput true or 'gmt' => string is for Greenwich location * false or 'tzserver' => output string is for local PHP server TZ usage * 'tzuser' => output string is for local browser TZ usage - * @param Tranlsate $outputlangs Object lang that contains language for text translation. + * @param Translate $outputlangs Object lang that contains language for text translation. * @param boolean $encodetooutput false=no convert into output pagecode * @return string Formated date or '' if time is null * From 4296766ea96dfbb13de71d282ca1bcc9bd86476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Fri, 19 Sep 2014 03:03:24 +0200 Subject: [PATCH 026/345] Qual: Coding style --- htdocs/core/lib/accounting.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 7b18de022f6..69e47569b07 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -25,6 +25,7 @@ /** * Prepare array with list of admin tabs + * * @param Object $object Accounting account * * @return array Array of tabs to show From e9f754395d280e614bd8f59f9a16e9055124c137 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 10 Nov 2014 13:09:58 +0100 Subject: [PATCH 027/345] Start bank extrafields --- htdocs/compta/bank/class/account.class.php | 61 ++++++++++++++++++- htdocs/core/lib/bank.lib.php | 33 ++++++++++ .../llx_bank_account_extrafields.key.sql | 20 ++++++ .../tables/llx_bank_account_extrafields.sql | 26 ++++++++ 4 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_bank_account_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_bank_account_extrafields.sql diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e2a039cf2d8..a50a7f448a9 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -343,7 +343,7 @@ class Account extends CommonObject */ function create($user='') { - global $langs,$conf; + global $langs,$conf, $hookmanager; // Clean parameters if (! $this->min_allowed) $this->min_allowed=0; @@ -441,6 +441,23 @@ class Account extends CommonObject $this->error=$this->db->lasterror(); return -3; } + + // Actions on extra fields (by external module or standard code) + $hookmanager->initHooks(array('bankdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + return -4; + } + } + } + else if ($reshook < 0) return -5; } return $this->id; } @@ -466,7 +483,7 @@ class Account extends CommonObject */ function update($user='') { - global $langs,$conf; + global $langs,$conf, $hookmanager; // Clean parameters if (! $this->min_allowed) $this->min_allowed=0; @@ -517,6 +534,25 @@ class Account extends CommonObject $result = $this->db->query($sql); if ($result) { + + // Actions on extra fields (by external module or standard code) + $hookmanager->initHooks(array('bankdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + return -1; + } + } + } + else if ($reshook < 0) return -1; + + return 1; } else @@ -663,6 +699,15 @@ class Account extends CommonObject $this->min_allowed = $obj->min_allowed; $this->min_desired = $obj->min_desired; $this->comment = $obj->comment; + + // Retreive all extrafield for thirdparty + // fetch optionals attributes and labels + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + + return 1; } else @@ -694,6 +739,18 @@ class Account extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { + + // Remove extrafields + if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + return -1; + dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); + } + } + return 1; } else { diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 488a4c3a530..e3fb787657b 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -89,6 +89,39 @@ function bank_prepare_head($object) return $head; } +/** + * Prepare array with list of tabs + * + * @param Object $object Object related to tabs + * @return array Array of tabs to shoc + */ +function bank_admin_prepare_head($object) +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT . '/admin/bank.php'; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'general'; + $h++; + + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin'); + + $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes'; + $h++; + + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin', 'remove'); + + return $head; + } /** * Check account number informations for a bank account diff --git a/htdocs/install/mysql/tables/llx_bank_account_extrafields.key.sql b/htdocs/install/mysql/tables/llx_bank_account_extrafields.key.sql new file mode 100644 index 00000000000..0f6e8052115 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bank_account_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2014 Florian Henry +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_bank_account_extrafields ADD INDEX idx_bank_account_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql b/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql new file mode 100644 index 00000000000..97b1508237c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql @@ -0,0 +1,26 @@ +-- ======================================================================== +-- Copyright (C) 2014 Florian Henry +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_bank_account_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + From 9c795d2c4b5f95bdd8f647e8ba7aa9b30fd106e3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 10 Nov 2014 13:18:27 +0100 Subject: [PATCH 028/345] Finnish bank extrafeilds --- htdocs/admin/bank.php | 4 + htdocs/admin/bank_extrafields.php | 154 ++++++++++++++++++++++++++++++ htdocs/compta/bank/card.php | 37 +++++++ 3 files changed, 195 insertions(+) create mode 100644 htdocs/admin/bank_extrafields.php diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index de1f7662373..9b5cb77e072 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->load("admin"); @@ -89,6 +90,9 @@ print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup'); print '
'; +$head = bank_admin_prepare_head(null); +dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account'); + print ''; print ''; print ''; diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php new file mode 100644 index 00000000000..b28c8b417c3 --- /dev/null +++ b/htdocs/admin/bank_extrafields.php @@ -0,0 +1,154 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/bank_extrafields.php + * \ingroup bank + * \brief Page to setup extra fields of bank + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("banks"); +$langs->load("admin"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='bank_account'; //Must be the $element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +llxHeader('',$langs->trans("BankSetupModule"),$help_url); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup'); + + +$head = bank_admin_prepare_head(null); + +dol_fiche_head($head, 'attributes', $langs->trans("Bank"), 0, 'account'); + + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print '
'; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print "
'.$langs->trans("Parameters").'
"; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; + // $i++; +} + +print "
'.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_pos[$key]."".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print "  ".img_delete()."
"; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel + /* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 81596540489..9b4efe79eb1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $langs->load("banks"); $langs->load("categories"); @@ -48,6 +49,10 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); +$account = new Account($db); +$extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($account->table_element); /* * Actions @@ -100,6 +105,9 @@ if ($_POST["action"] == 'add') $error++; } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$account); + if (! $error) { $id = $account->create($user); @@ -172,6 +180,9 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $error++; } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$account); + if (! $error) { $result = $account->update($user); @@ -306,6 +317,15 @@ if ($action == 'create') $doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print ''; + + // Other attributes + $parameters=array('colspan' => 3); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $account->showOptionals($extrafields,'edit',$parameters); + } + print ''; @@ -461,6 +481,14 @@ else print ''.$langs->trans("Comment").''; print ''.$account->comment.''; + // Other attributes + $parameters=array('colspan' => 3); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $account->showOptionals($extrafields); + } + print ''; print '
'; @@ -615,6 +643,15 @@ else $doleditor->Create(); print ''; + // Other attributes + $parameters=array('colspan' => 3); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $account->showOptionals($extrafields,'edit'); + } + + print ''; print '
'; From 7c617b3515261a95c80f43855de2e8a91abaa561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 Nov 2014 11:21:31 +0100 Subject: [PATCH 029/345] Update card.php --- htdocs/expedition/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8984e4c5424..1b1dbedfe59 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -664,7 +664,8 @@ if ($action == 'create') print ''.$langs->trans("DateDeliveryPlanned").''; print ''; //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. - print $form->select_date($object->date_livraison?$object->date_livraison:-1,'date_delivery',1,1); + $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); print "\n"; print ''; From 917423dc0c76e557fac2fcca0c1114ced4cea52b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 26 Nov 2014 14:16:59 +0100 Subject: [PATCH 030/345] add default payment mode select --- htdocs/comm/card.php | 4 ++++ htdocs/fourn/card.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index d0dd842cd7c..7c47c25409d 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -347,6 +347,10 @@ if ($id > 0) print ''; if ($action == 'editmode') { + if (empty($object->mode_reglement_id)) + { + $object->mode_reglement_id=$conf->global->MAIN_PAYMENT_MODE_DEFAULT; + } $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); } else diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 3e234af68cd..30c55c7b130 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -232,6 +232,10 @@ if ($object->fetch($id)) print ''; if ($action == 'editmode') { + if (empty($object->mode_reglement_supplier_id)) + { + $object->mode_reglement_supplier_id=$conf->global->MAIN_PAYMENT_MODE_DEFAULT; + } $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'mode_reglement_supplier_id'); } else From 21f14320cf08f487d8f4b98b83c2e3ad05e2da62 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Nov 2014 05:07:04 +0100 Subject: [PATCH 031/345] Untranslatable token in datepicker --- htdocs/core/datepicker.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 7e0333bc5aa..67af3c7e083 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -39,6 +39,7 @@ require_once '../main.inc.php'; if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php $langs->load("main"); +$langs->load("agenda"); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); @@ -57,7 +58,7 @@ if (GETPOST('mode') && GETPOST('mode') == 'test') } else { - print 'Calendar'; + print ''.$langs->trans("Calendar").''; } // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) From ea70159a7e72cf5057bc5dc95f5ffb50662f6cab Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Nov 2014 05:07:39 +0100 Subject: [PATCH 032/345] Activate the HTML5 Doctype --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c8553f29291..9250384880b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -959,11 +959,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->css)) $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default - print ''; + //print ''; //print ''; //print ''; //print ''; - //print ''; + print ''; print "\n"; if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; else print ''."\n"; From 92c093055ca148d1253ab2f596e00367b915c1b7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Nov 2014 05:41:57 +0100 Subject: [PATCH 033/345] Add meta balise for viewport & scale --- htdocs/main.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9250384880b..f9ff80dd366 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -975,6 +975,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // Displays meta print ''."\n"; // Evite indexation par robots print ''."\n"; + print ''."\n"; // Needed for Responsive Web Design $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; print ''."\n"; From 217cacbc295a16daafb33e48494fa6f1531fac0e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 27 Nov 2014 17:26:06 +0100 Subject: [PATCH 034/345] To avoid over wrighting lines --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3223412dc5f..bc0a9e71f38 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -897,7 +897,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al if (! empty($linkedobject["date_title"]) && ! empty($linkedobject["date_value"])) { - $posy+=3; + $posy+=7; $pdf->SetXY($posx,$posy); $pdf->MultiCell($w, $h, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align); } From b98c0a3208098512a0b9645b578c0a83bfaff2ba Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Nov 2014 20:32:29 +0100 Subject: [PATCH 035/345] Login - Better presentation with RWD --- htdocs/core/tpl/login.tpl.php | 9 +++------ htdocs/theme/eldy/style.css.php | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 23d8dd4f326..844f874a711 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -67,6 +67,8 @@ $(document).ready(function () { +
+ @@ -76,7 +78,7 @@ $(document).ready(function () {
-
+
@@ -130,11 +132,6 @@ if (! empty($hookmanager->resArray['options'])) { -
- - - -
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 5ac8a76fb53..08c5fbcf2ff 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -849,7 +849,7 @@ form#login { vertical-align: middle; } .login_table_title { - max-width: 540px; + max-width: 320px; color: #888888; text-shadow: 1px 1px 1px #FFF; } @@ -863,7 +863,7 @@ form#login { padding-right:6px; padding-top:12px; padding-bottom:12px; - max-width: 540px; + max-width: 320px; background-color: #FFFFFF; From c3d66b037dc0cc13e078b7357d1f095413091ff9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 28 Nov 2014 10:35:02 +0100 Subject: [PATCH 036/345] Revert "add default payment mode select" This reverts commit 917423dc0c76e557fac2fcca0c1114ced4cea52b. --- htdocs/comm/card.php | 4 ---- htdocs/fourn/card.php | 4 ---- 2 files changed, 8 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 7c47c25409d..d0dd842cd7c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -347,10 +347,6 @@ if ($id > 0) print '
'; -print ''; + print "
'; if ($action == 'editmode') { - if (empty($object->mode_reglement_id)) - { - $object->mode_reglement_id=$conf->global->MAIN_PAYMENT_MODE_DEFAULT; - } $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); } else diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 30c55c7b130..3e234af68cd 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -232,10 +232,6 @@ if ($object->fetch($id)) print ''; if ($action == 'editmode') { - if (empty($object->mode_reglement_supplier_id)) - { - $object->mode_reglement_supplier_id=$conf->global->MAIN_PAYMENT_MODE_DEFAULT; - } $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'mode_reglement_supplier_id'); } else From 15311fb643fc0d44524ab420abc5809d56b83eb8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 28 Nov 2014 12:41:53 +0100 Subject: [PATCH 037/345] form should not be inside table --- htdocs/accountancy/admin/importaccounts.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 9e5c59f4555..6358bf353f3 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -120,6 +120,9 @@ if ($result) { $i = 0; print_barre_liste($langs->trans("ImportAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); + print '
' . "\n"; + print ''; + print ''; print ''; print ''; @@ -132,9 +135,6 @@ if ($result) { $form = new Form($db); $htmlacc = new FormVentilation($db); - print '' . "\n"; - print ''; - $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); From d156e1ba82217abba188ac2b645243a76a804773 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 28 Nov 2014 12:51:08 +0100 Subject: [PATCH 038/345] form should be outside table --- htdocs/accountancy/admin/journaux.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index f7507cda234..84c8042027a 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -112,8 +112,8 @@ foreach ( $list as $key ) { print ''; } -print ''; print "
' . $langs->trans("accountingaccount") . '' . $langs->trans("label") . '
\n"; +print ''; print '
'; From 64260cde726df9979899922b5c04598d77296beb Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 29 Nov 2014 07:07:27 +0100 Subject: [PATCH 039/345] Add button in admin->GUISetup to activate Html5 --- htdocs/admin/ihm.php | 61 +++++++++++++++++++++++------------ htdocs/langs/en_US/admin.lang | 3 +- htdocs/main.inc.php | 4 +-- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 23e7cc96363..f2312ee042f 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -53,29 +53,30 @@ $searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name if ($action == 'update') { - dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'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_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'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_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_ACTIVATE_HTML5", $_POST["MAIN_ACTIVATE_HTML5"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT",$_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities - dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities + dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities + dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities // This one is not always defined if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); @@ -119,7 +120,7 @@ if ($action == 'edit') // Edit print_fiche_titre($langs->trans("Language"),'','').'
'; print ''; - print ''; + print ''; print ''; print ''; @@ -172,6 +173,17 @@ if ($action == 'edit') // Edit print ''; print ''; print ''; + + // Activate Html5 - Developement - Only available on Eldy template + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) + { + $var=!$var; + print ''; + print ''; + print ''; + } // Max size of lists $var=!$var; @@ -351,6 +363,15 @@ else // Show print ''; print ''; print ""; + + // Activate Html5 - Developement - Only available on Eldy template + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) + { + $var=!$var; + print ''; + print ''; + print ""; + } $var=!$var; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a524ff8a5fe..4aee36d73ab 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -887,7 +887,8 @@ MessageLogin=Login page message PermanentLeftSearchForm=Permanent search form on left menu DefaultLanguage=Default language to use (language code) EnableMultilangInterface=Enable multilingual interface -EnableShowLogo=Show logo on left menu +EnableShowLogo=Show logo on left menu +EnableHtml5=Enable Html5 (Developement - Only available on Eldy template) SystemSuccessfulyUpdated=Your system has been updated successfully CompanyInfo=Company/foundation information CompanyIds=Company/foundation identities diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 87b69b56443..199436eae65 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -959,11 +959,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->css)) $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default - //print ''; + if (empty($conf->global->MAIN_ACTIVATE_HTML5)) print ''; //print ''; //print ''; //print ''; - print ''; + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) print ''; // Html5 - Developement - Only available on Eldy template print "\n"; if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; else print ''."\n"; From c27e2676e3b79db13af1b0f411afc6d14f2ad75c Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 29 Nov 2014 07:08:35 +0100 Subject: [PATCH 040/345] Modify presentation of login page --- htdocs/core/tpl/login.tpl.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c34894e49c3..a12a960aaec 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -67,6 +67,11 @@ $(document).ready(function () { +
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
 
'.$langs->trans("EnableHtml5").''; + print $form->selectyesno('MAIN_ACTIVATE_HTML5',$conf->global->MAIN_ACTIVATE_HTML5,1); + print ' 
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ' 
'.$langs->trans("EnableHtml5").'' . yn($conf->global->MAIN_ACTIVATE_HTML5) . ' 
'.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '
@@ -74,12 +79,6 @@ $(document).ready(function () {
-
\n"; print '

'; - +print ''; llxFooter(); $db->close(); \ No newline at end of file From b33612d2311ebbc3242a39319188908479096229 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 1 Dec 2014 12:09:05 +0100 Subject: [PATCH 045/345] close form should be outside button --- htdocs/accountancy/admin/journaux.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index 84c8042027a..d97af918f90 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -113,9 +113,9 @@ foreach ( $list as $key ) { } print "\n"; -print ''; print '
'; +print ''; print '
'; From d7dcd153f0d519a0e0d4c998b7810d2cde785246 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 1 Dec 2014 12:21:54 +0100 Subject: [PATCH 046/345] missing close form --- htdocs/accountancy/bookkeeping/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 608c62cf1d0..a24ed34e052 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -358,7 +358,8 @@ else print ''; print ''; } - print ""; + print ''; + print ''; } } } From e18196eac6052d1f67ffa4c2892f35572988533c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 1 Dec 2014 16:50:27 +0100 Subject: [PATCH 047/345] to avoid undefined method --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6291790d008..9d0de035223 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -27,7 +27,7 @@ /** * Class to manage accountancy book keeping */ -class BookKeeping +class BookKeeping extends CommonObject { var $db; var $error; From 477aeecdac467663a3fbe42aaa5cdf27130b17e5 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 2 Dec 2014 22:30:40 +0100 Subject: [PATCH 048/345] #1725 Missing table cells in services list header --- htdocs/product/liste.php | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index cab06a7f387..44a6a69da2e 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -324,12 +324,16 @@ else print ''; print ''; print ''; + + // Barcode if (! empty($conf->barcode->enabled)) { print ''; print ''; print ''; } + + // Date modification print ''; print ' '; print ''; @@ -363,16 +367,7 @@ else print ''; print ' '; print ''; - //desiredstock - print ''; - print ' '; - print ''; - } - else - { - print ''; - print ' '; - print ''; + // Desired stock print ''; print ' '; print ''; @@ -501,15 +496,6 @@ else print $product_static->stock_reel; print ''; } - else - { - print ''; - print ' '; - print ''; - print ''; - print ' '; - print ''; - } } // Status (to buy) From ceba894d5748271162e7474b1184a2c6ea8edd97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Dec 2014 13:26:47 +0100 Subject: [PATCH 049/345] Start to work on new generation combo box. --- htdocs/comm/propal.php | 14 +- htdocs/core/class/conf.class.php | 3 + htdocs/core/class/html.form.class.php | 38 +++- htdocs/core/class/html.formcompany.class.php | 192 ++++++++---------- htdocs/core/lib/ajax.lib.php | 31 +-- htdocs/core/tpl/contacts.tpl.php | 14 +- .../jquery/plugins/select2/select2.js | 4 +- htdocs/langs/en_US/admin.lang | 2 + htdocs/projet/tasks/contact.php | 5 +- htdocs/public/test/test_forms.php | 9 +- htdocs/societe/admin/societe.php | 8 +- 11 files changed, 161 insertions(+), 159 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index aa75945f0ea..5feb7769a43 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1151,6 +1151,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal-> } } + /* * View */ @@ -1236,12 +1237,13 @@ if ($action == 'create') print '
'; print ''; print ''; - if ($origin != 'project' && $originid) { print ''; print ''; } + dol_fiche_head(); + print ''; // Reference @@ -1435,16 +1437,13 @@ if ($action == 'create') print "
\n"; - print '
'; - - /* * Combobox pour la fonction de copie */ if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print ''; - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
'; if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { // For backward compatibility @@ -1514,9 +1513,10 @@ if ($action == 'create') } print ''; } - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '

'; - + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; + dol_fiche_end(); + $langs->load("bills"); print '
'; print ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e079efb8ecc..ece24bfee34 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -432,6 +432,9 @@ class Conf // Define list of limited modules if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. + // Enable select2 + if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)) $conf->global->MAIN_USE_JQUERY_MULTISELECT='select2'; + // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 14b7c78cc7d..08bc3b4c85e 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -825,9 +825,22 @@ class Form } else { + if (! $forcecombo) + { + $out.=' + '; + } + if (count($events)) // Add management of event { - print ''; } else { @@ -4119,10 +4142,11 @@ class Form * @param int $disabled Html select box is disabled * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort * @param string $morecss Add more class to css styles + * @param int $addjscombo Add js combo * @return string HTML select string. * @see multiselectarray */ - static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='') + static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0) { global $conf, $langs; @@ -4131,13 +4155,15 @@ class Form $out=''; // Add code for jquery to use multiselect - if (empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) + if ($addjscombo && empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; - $out=' + $out.=' '; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index e45fffff759..413dc3d1544 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -520,118 +520,105 @@ class FormCompany * @param string $htmlname Name of HTML form * @param array $limitto Disable answers that are not id in this array list * @param int $forceid This is to force another object id than object->id - * @param array $events More js events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param string $moreparam String with more param to add into url when noajax search is used. * @return int The selected third party ID */ - function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='', $forceid=0, $events=array(), $moreparam='') + function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='', $forceid=0, $moreparam='') { global $conf, $langs; - // On recherche les societes - $sql = "SELECT s.rowid, s.nom as name FROM"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; - if ($selected && $conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) $sql.= " AND s.rowid = ".$selected; + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) + { + // Use Ajax search + $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); + + $socid=0; $name=''; + if ($selected > 0) + { + $tmpthirdparty=new Societe($this->db); + $result = $tmpthirdparty->fetch($selected); + if ($result > 0) + { + $socid = $selected; + $name = $tmpthirdparty->name; + } + } + + // Refresh contacts list on thirdparty list change + $htmloption=''; + + $events=array(); + $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); + if (count($events)) // If there is some ajax events to run once selection is done, we add code here to run events + { + print ''; + } + + print "\n".''."\n"; + print ''; + print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength); + return $socid; + } else { + // Search to list thirdparties + $sql = "SELECT s.rowid, s.nom as name FROM"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; // For ajax search we limit here. For combo list, we limit later - if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT - && is_array($limitto) && count($limitto)) + if (is_array($limitto) && count($limitto)) { $sql.= " AND s.rowid IN (".join(',',$limitto).")"; } - } - $sql.= " ORDER BY s.nom ASC"; + $sql.= " ORDER BY s.nom ASC"; - $resql = $this->db->query($sql); - if ($resql) - { - if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) + $resql = $this->db->query($sql); + if ($resql) { - // Use Ajax search - $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); - - $socid=0; - if ($selected) - { - $obj = $this->db->fetch_object($resql); - $socid = $obj->rowid?$obj->rowid:''; - } - - // We recall a page after a small delay when a new input has been selected - $htmloption=''; - //$javaScript = "window.location=\'".$_SERVER['PHP_SELF']."?".$var_id."=".($forceid>0?$forceid:$object->id)."&".$htmlname."=\' + document.getElementById(\'".$htmlname."\').value;"; - //$htmloption.= 'onChange="ac_delay(\''.$javaScript.'\',\'500\');"'; // When we select with mouse - //$htmloption.= 'onKeyUp="if (event.keyCode== 13) { ac_delay(\''.$javaScript.'\',\'500\'); }"'; // When we select with keyboard - - if (count($events)) // If there is some ajax events to run once selection is done, we add code here to run events - { - print ''; - } - - print "\n".''."\n"; - //print ''; - //print ''; - //print ''; - //print '
'; - if ($obj->rowid == 0) - { - print ''; - } - else - { - print ''; - } - print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength); - //print '
'; - //print "\n"; - return $socid; - } - else - { - // No Ajax search print '\n"; return $firstCompany; } - } - else - { - dol_print_error($this->db); + else + { + dol_print_error($this->db); + print 'Error sql'; + } } } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 3966b29f874..df7c09d9274 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -323,34 +323,23 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; - /* Some properties for combobox: - minLengthToAutocomplete: 2, - comboboxContainerClass: "comboboxContainer", - comboboxValueContainerClass: "comboboxValueContainer", - comboboxValueContentClass: "comboboxValueContent", - comboboxDropDownClass: "comboboxDropDownContainer", - comboboxDropDownButtonClass: "comboboxDropDownButton", - comboboxDropDownItemClass: "comboboxItem", - comboboxDropDownItemHoverClass: "comboboxItemHover", - comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader", - comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer", - animationType: "slide", - width: "500px" */ - $msg = ' -
+